Skip to main content
Glama
GIS MCP Server
by mahdin75

zonal_statistics

Summarize raster values within each polygon to calculate mean, minimum, maximum, standard deviation, and count for spatial analysis.

Instructions

Summarize raster values inside each polygon. stats can include mean, min, max, std, and count.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "raster_path": "<raster_path>",
      "vector_path": "<vector_path>"
    },
    "name": "zonal_statistics"
  }
}

Input Schema

NameRequiredDescriptionDefault
statsNo
offsetNo
raster_pathYes
vector_pathYes
max_featuresNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.16.0
    • addedInput schema / properties / max_features
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. Changed8 schema fields changedv1.0.0
    • removedInput schema / properties / raster_path / title
      Removed value: -"Raster Path"
    • addedInput schema / properties / stats / anyOf
      Added value: +[
      +  {
      +    "items": {},
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / stats / items
      Removed value: -{}
    • removedInput schema / properties / stats / title
      Removed value: -"Stats"
    • removedInput schema / properties / stats / type
      Removed value: -"array"
    • removedInput schema / properties / vector_path / title
      Removed value: -"Vector Path"
    • removedInput schema / title
      Removed value: -"zonal_statisticsArguments"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  3. First observed

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the whole burden and it only describes the computation. It never says that the raster and vector must share a CRS, how NoData cells are handled, whether the per-polygon count excludes nulls, or what the response looks like (attribute table, GeoDataFrame, one row per feature). For a geoprocessing tool that routinely fails on CRS mismatch, that is a real gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, action first, with zero filler or restated title. It is lean to the point of under-specification, but nothing written is wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no annotations, no output schema, and full parameter opacity, the description should cover prerequisites, return shape, and the non-obvious offset/max_features parameters. It covers only the operation and the allowed statistic names, so an agent could call it but not predict its behavior or results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 5 parameters, so the description must compensate and mostly does not. Naming mean, min, max, std, and count is genuinely helpful because `stats` is an untyped array with no enum, but raster_path, vector_path, offset, and max_features get no explanation at all, leaving half the interface opaque.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Summarize raster values inside each polygon" states a specific verb and resource, which is exactly the zonal-statistics operation and is distinguishable in principle from focal or band statistics. It stops short of naming or contrasting those siblings, so the differentiation is left implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The first sentence implies the use case (per-polygon summaries of a raster) well enough for an agent to pick it over a global statistic. There is no explicit when-to-use versus focal_statistics/raster_band_statistics, no prerequisite about raster/vector CRS alignment, and no note about what happens when polygons are larger or smaller than the raster.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.