Download Dataset
The download_dataset tool downloads the sample records of an existing dataset directly in memory using the Model Context Protocol.
Tool Overview
- Tool Name:
download_dataset - Underlying Endpoint:
GET /datasets/{dataset_id}/download/ - SDK Methods:
kg.datasets.download(Python) /kg.datasets.download(TypeScript) - Architecture: Stateless Direct Download — Follows platform HTTP 307 storage redirects automatically and parses the JSON samples directly in memory without saving temporary files to the MCP container.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dataset_id | String | Yes | Unique UUID of the dataset to download. |
timeout_ms | Integer | No | Request timeout in milliseconds (defaults to KG_MCP_REQUEST_TIMEOUT_MS, default 60000ms). |
Storage Redirection & Behavior
- Storage Redirection Handling: The Knowledgator API issues an HTTP 307 redirect to an object storage URL. The MCP server automatically follows this redirect to fetch the payload.
- Metadata vs Raw Data:
download_datasetreturns the raw dataset records directly (e.g.List[Dict[str, Any]]). To inspect metadata such as total file size, format, status, or timestamps without downloading all records, useget_dataset_details. - Context Window Protection (LLM Guidance):
- For small and moderate datasets,
download_datasetreturns the full sample list directly to the agent. - For very large datasets (thousands of records), streaming to local workspace disk via the Python SDK (
kg.datasets.download(..., file_path=...)) or TypeScript SDK (kg.datasets.download(..., { filePath })) is recommended to avoid consuming large amounts of context window tokens.
- For small and moderate datasets,
Example Usage
Natural Language Prompt to Agent
"Download dataset 'd655eda9-ca67-4a86-a8bc-5b3911233c79' and inspect the first few items."
Tool Call Arguments
{
"name": "download_dataset",
"arguments": {
"dataset_id": "d655eda9-ca67-4a86-a8bc-5b3911233c79"
}
}
Tool Response
[
{
"text": "The battery life on this laptop lasts over 12 hours under normal office workloads.",
"label": "positive"
},
{
"text": "The hinge started making a creaking sound after three days of use.",
"label": "negative"
}
]