gfw_query
Pack: global-forest-watch · Connect: https://pipeworx.io/mcp (see Connect below for a single-pack URL)
No MCP client? Call it directly: GET https://gateway.pipeworx.io/v1/tools/gfw_query for the schema, then POST the same URL with its arguments for the data.
Run a read-only SQL SELECT against one Global Forest Watch dataset version — e.g. tree cover loss hectares by year inside an area, or deforestation alerts inside a bounding box. The table is always called data; use gfw_dataset to see the available columns first. Almost every GFW dataset (tree cover loss/gain, GLAD/RADD alerts, fire alerts, carbon, primary forest) is a RASTER TILE SET, not a plain table — a geometry (GeoJSON Polygon/MultiPolygon) is REQUIRED to scope the pixels queried, or the API answers 422 “Raster tile set queries require a geometry”. Omit it only for the few vector-table datasets (e.g. wdpa_protected_areas). Requires your own free GFW API key, passed as _apiKey.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
dataset | string | yes | Dataset name, e.g. “umd_tree_cover_loss”. |
version | string | no | Version, e.g. “latest” or “v1.13”. Default “latest”. |
sql | string | yes | A SELECT statement over the table data, e.g. “SELECT umd_tree_cover_loss__year, SUM(area__ha) AS loss_ha FROM data WHERE umd_tree_cover_loss__year > 0 GROUP BY umd_tree_cover_loss__year”. SELECT only; a LIMIT is appended if you omit one. |
geometry | object | no | GeoJSON Polygon or MultiPolygon ({“type”:“Polygon”,“coordinates”:[…]}) scoping the query spatially. REQUIRED for raster tile set datasets — which is most of them; see gfw_dataset’s version_assets. Example, a ~0.2° box over Rondônia, Brazil: {“type”:“Polygon”,“coordinates”:[[[-63.0,-9.0],[-62.8,-9.0],[-62.8,-8.8],[-63.0,-8.8],[-63.0,-9.0]]]}. |
Brazil | unknown | no | |
limit | number | no | Row cap appended when your SQL has no LIMIT (1-1000, default 100). |
_apiKey | string | yes | Your own Global Forest Watch API key (BYO). ${KEY_HELP} |
Example call
Arguments
{
"dataset": "umd_tree_cover_loss",
"sql": "SELECT umd_tree_cover_loss__year, SUM(area__ha) AS loss_ha FROM data WHERE umd_tree_cover_loss__year = 2023 GROUP BY umd_tree_cover_loss__year",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-63,
-9
],
[
-62.8,
-9
],
[
-62.8,
-8.8
],
[
-63,
-8.8
],
[
-63,
-9
]
]
]
}
}
curl
curl -X POST https://gateway.pipeworx.io/global-forest-watch/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gfw_query","arguments":{"dataset":"umd_tree_cover_loss","sql":"SELECT umd_tree_cover_loss__year, SUM(area__ha) AS loss_ha FROM data WHERE umd_tree_cover_loss__year = 2023 GROUP BY umd_tree_cover_loss__year","geometry":{"type":"Polygon","coordinates":[[[-63,-9],[-62.8,-9],[-62.8,-8.8],[-63,-8.8],[-63,-9]]]}}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('gfw_query', {
"dataset": "umd_tree_cover_loss",
"sql": "SELECT umd_tree_cover_loss__year, SUM(area__ha) AS loss_ha FROM data WHERE umd_tree_cover_loss__year = 2023 GROUP BY umd_tree_cover_loss__year",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-63,
-9
],
[
-62.8,
-9
],
[
-62.8,
-8.8
],
[
-63,
-8.8
],
[
-63,
-9
]
]
]
}
});
Connect
Add this to your MCP client config — every tool in the catalog, including this one — or use one-click install buttons:
{
"mcpServers": {
"pipeworx": {
"url": "https://pipeworx.io/mcp"
}
}
}
Connect to just the global-forest-watch pack
{
"mcpServers": {
"global-forest-watch": {
"url": "https://gateway.pipeworx.io/global-forest-watch/mcp"
}
}
}
See Getting Started for client-specific install steps.