Skip to main content

Upload Dataset

The upload_dataset tool creates a new dataset on the Knowledgator platform by uploading validated in-memory records or raw JSON string content.


Tool Overview​

  • Tool Name: upload_dataset
  • Underlying Endpoint: POST /datasets/
  • SDK Methods: kg.datasets.create(..., file=...) / kg.datasets.upload (Python) / kg.datasets.upload (TypeScript)
  • Architecture: Stateless In-Memory Proxy — The MCP server does not store uploaded files on its local container filesystem. It streams data directly to the API via multipart form data without persistent disk storage.

Parameters​

ParameterTypeRequiredDescription
nameStringYesDataset name (e.g. "Customer Feedback Sentiment"). Must match the pattern ^[a-zA-Z0-9- .()]+$.
dataArray of ObjectsNoIn-memory list of sample dictionaries. Either data or json_content must be provided.
json_contentStringNoRaw JSON string representing the dataset samples array.
dataset_typeStringNoTarget task type: classification (comprehend-it), ner (extract-it), instruct-it, or relation-extraction. Defaults to classification.
short_descriptionStringNoOptional human-readable description (max 1024 characters).

Behavior & Safeguards​

  1. Schema Validation: The tool automatically verifies that the payload is a non-empty array of objects containing required text and label keys for the given task type before transmitting to the platform.
  2. Stateless Memory Safety: Data is serialized to bytes directly in memory and streamed via multipart upload. No temporary files are leaked or retained inside the MCP container.

Example Usage​

Natural Language Prompt to Agent​

"Upload a 2-sample sentiment dataset named 'Feedback Sentiment' to Knowledgator."

Tool Call Arguments​

{
"name": "upload_dataset",
"arguments": {
"name": "Feedback Sentiment",
"dataset_type": "classification",
"data": [
{
"text": "The delivery was remarkably quick and the product quality exceeded expectations.",
"label": "positive"
},
{
"text": "Item arrived damaged and customer support did not respond.",
"label": "negative"
}
],
"short_description": "Curated customer feedback samples"
}
}

Tool Response​

{
"status": "success",
"dataset_id": "7ca64731-01be-4835-b6d8-6014e7a8e2cb",
"dataset_name": "Feedback Sentiment",
"sample_count": 2,
"dataset_type": "comprehend-it",
"format": "json",
"size_bytes": 284,
"dataset_status": "valid",
"short_description": "Curated customer feedback samples"
}