Skip to content
TerraLabTerraLabDocs
Markdown

Extract a hosted dataset for an area

A hosted dataset from the TerraLab catalogue cut to an area: a GeoTIFF or a vector file with its licence, or only the statistics.

MCP toolextract_dataset on https://mcp.terra-lab.ai/mcp
GroupData catalog

Use it

Connect the MCP server to your assistant and ask in plain words: the assistant picks extract_dataset when the request fits and fills the arguments below. These are valid arguments:

{"dataset":"esa_worldcover","area":{"place":"Nakuru, Kenya","radius_m":5000}}
{"dataset":"esa_worldcover","area":{"place":"Gare de Montpellier Saint-Roch","radius_m":2000},"summary":true}
{"dataset":"cod_ab_idn","area":{"place":"Bandung, Indonesia","radius_m":10000},"variables":{"LEVEL":"3"}}

Parameters

NameTypeRequiredDescription
datasetstringNoA dataset id from find_datasets, such as "esa_worldcover", "ghs_pop", "cod_ab_idn", or a portolan: id, or the https URL of a public GeoParquet. Up to 400 characters.
areaobjectNoThe area: a bbox, or a place (name, address or coordinates) with an optional radius in metres. The place the user asks about, not the user's own location.
area.bboxarray of numberNo[west, south, east, north] in decimal degrees (WGS 84). Exactly 4 items.
area.placestring or objectNoA place name or address, or a point.
area.radius_mnumberNoRadius around the place in metres. From 1 to 100000.
variablesobjectNoValues for the dataset's variables, as find_datasets lists them: {"LEVEL": "2"}, {"RETURN_PERIOD": "100"}, {"YEAR": "2015"}.
summarybooleanNoRasters: return the class shares or statistics only, without a file. Default false.
formatsarray of stringNoVectors: extra download formats. A GeoPackage is always included.

Response

structuredContent holds the result, content the same result as text for a model, and isError is true when the tool refused the request or failed; then structuredContent.code, message and hint say what to change.

{
  "structuredContent": {
    "sources": [{ "name": "...", "licence": "...", "url": "..." }],
    "downloads": [{ "label": "...", "format": "...", "url": "...", "name": "..." }]
  },
  "content": [{ "type": "text", "text": "..." }],
  "isError": false
}

Every result lists its sources with their licence. File results come as downloads: each link builds its file when opened.

Errors

A missing key answers 401, an empty balance 402, too many calls 429. A call that fails or finds nothing is not counted. See Errors and rate limits.

Description for agents

The text the server gives an agent to decide when to call this tool:

Use this when the user wants a dataset from the TerraLab catalogue cut to an area, as a GIS file or as numbers: "ESA WorldCover for 5 km around Nakuru as a GeoTIFF". Give dataset (an id from find_datasets) and area (a place with radius_m, or a bbox). Rasters: a GeoTIFF on the dataset's own grid, licence in the file and in a zip, plus class shares or min, max and mean (summary true: numbers only). Vectors: a GeoPackage (GeoJSON, KML, Shapefile or CSV on request) with the feature count. Limits: 4,000 x 4,000 pixels (8 million for 64-bit data) or 20,000 features per call; a larger area gets area_too_large with retry_with, the same call on an area that fits (send it as it is), never a partial file. Some datasets need variables (admin level, year, return period): find_datasets lists them. A Portolan collection (a portolan: id from find_datasets) or any public GeoParquet URL is cut in place: the features whose box meets the area, with variables picking a partition ({"year": "2024"}; the newest otherwise). Quote the licence and attribution in the answer. Not for OpenStreetMap or Overture (extract_open_data), elevation (get_elevation), forest type (get_forest_type) or satellite images (get_satellite_image). Never use the user's current location unless they type it. Download links build their file when opened; no file is saved. The user opens the file in QGIS or any GIS: this server cannot load it into the user's own QGIS or any app on their computer. Never pass these links to open_gis_file: list every format the user needs in formats, in this one call.

Call it over HTTP

The same tool is also callable over HTTP with an API key: POST https://mcp.terra-lab.ai/v1/tools/extract_dataset with the arguments as the JSON body.

curl -X POST https://mcp.terra-lab.ai/v1/tools/extract_dataset \
  -H "Authorization: Bearer $TERRALAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dataset":"esa_worldcover","area":{"place":"Nakuru, Kenya","radius_m":5000}}'
import os
import requests

response = requests.post(
    "https://mcp.terra-lab.ai/v1/tools/extract_dataset",
    headers={"Authorization": f"Bearer {os.environ['TERRALAB_API_KEY']}"},
    json={
        "dataset": "esa_worldcover",
        "area": {
            "place": "Nakuru, Kenya",
            "radius_m": 5000,
        },
    },
    timeout=120,
)
response.raise_for_status()
print(response.json()["structuredContent"])
const response = await fetch('https://mcp.terra-lab.ai/v1/tools/extract_dataset', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.TERRALAB_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "dataset": "esa_worldcover",
    "area": {
      "place": "Nakuru, Kenya",
      "radius_m": 5000
    }
  }),
});
const data = await response.json();
console.log(data.structuredContent);

Was this page helpful?

Updated Nov 23, 2026