Skip to main content
Glama

Run a spatial analysis on a layer

run_analysis

Compute a spatial analysis server-side and append the finished, honestly-legended result as a new layer + camera; the result REPLACES its input layer(s) (undoable). hotspot = Getis-Ord Gi*: hot/cold significance classes (99/95/90%, Benjamini-Hochberg FDR-corrected) on a numeric field, or on hex-binned point density when valueField is omitted. zonal = aggregate points into polygon zones (an existing zone layer OR a generated h3 fishnet): count/sum/mean/min/max per zone as a quantile choropleth where zero and no-data are distinct classes. enrich = join a US Census ACS indicator (median income, home value, rent, …) onto each feature by tract/county/state containment — unmatched features stay null, never zero-filled. join = spatial join (attribute transfer): each point in layerId takes properties from the joinLayerId polygon containing it (collisions prefixed, unmatched points carry NO joined fields, zero overlap is a typed rejection). merge = append two same-geometry-class layers into one dataset with a per-row source column (schemas never null-filled; class mismatch is a typed failure). near = nearest-neighbor distance columns (great-circle meters, stated — never presented as road distance). dissolve = true polygon union per attribute group (missing values form their own group; partial sums reported). Returns a grounded memo + stats payload — every number is computed, never generated; findings keep the map. Costs 1 credit when the result lands; typed failures (unknown layer, too few features, >10,000-feature cap) are refunded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNohotspot only: nearest neighbors per feature (default 8).
statsNozonal only: which statistics to attach per zone (default: count, plus sum/mean/min/max when valueField is set).
storyNoOpt-in: persist the shared map with a 2-step story rail (grounded overview + analysis memo isolating the result layer) — the /m/ link opens with it.
zonesNozonal only: generate an h3 hex fishnet over the source extent instead of using a zone layer (resolution 3-10, default auto). Provide EXACTLY ONE of zoneLayerId or zones.
fieldsNojoin only: which join-layer properties to transfer (default: auto-select up to 12 non-internal properties, overflow reported).
map_idYes
prefixNojoin only: prefix for a joined field whose name collides with an existing target property (default "join_").
layerIdYesThe workspace layer to analyze (geojson-backed; the point source for zonal; the point TARGET for join; the styling donor for merge).
analysisYesWhich analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'. 'merge' = append layerId + mergeLayerId (same geometry class) into ONE dataset, each row stamped with its source layer. 'near' = each POINT in layerId gains the great-circle distance to (and identity of) its nearest feature in nearLayerId. 'dissolve' = union POLYGONS sharing a dissolveField value into single features (omit the field to dissolve all into one).
annotateNoOpt-in: place ONE callout annotation at the headline feature (hottest cluster / top zone / highest value). Label text comes only from computed values.
geoLevelNoenrich only: containment geography (default tract). Tract/county fetch only the states the data touches, capped at 3 — filter first or use state for wider layers.
hexMetersNohotspot density mode only: hex cell spacing in meters (default auto from the data extent).
indicatorNoenrich only (required there): a US Census ACS preset id (e.g. 'median_household_income', 'median_home_value', 'median_rent') or a raw ACS variable code (e.g. 'B19013_001E').
nearFieldNonear only: property of the nearest feature to copy as its identity (default: first name-like property).
rationaleNoOptional short label (≤300 chars) for the map edit history, e.g. "add wildfire layer". Omit it to send nothing beyond the tool arguments.
sumFieldsNodissolve only: numeric properties to SUM per group — skipped values reported, a group with none present carries NO sum.
valueFieldNoNumeric property to analyze. hotspot: omit on point layers for incident-DENSITY mode (hex-binned counts). zonal: omit for count-only aggregation.
joinLayerIdNojoin only (required there): the POLYGON layer providing the attributes.
nearLayerIdNonear only (required there): the POINT layer to search for each target point's nearest neighbor.
sourceFieldNomerge only: name of the per-row provenance column naming each row's source layer (default "merge_source"; renamed on collision, reported).
zoneLayerIdNozonal only: an existing polygon layer to aggregate into. Provide EXACTLY ONE of zoneLayerId or zones.
maxDistanceMNonear only: search radius in meters — a point whose nearest neighbor is farther carries NO near fields (reported).
mergeLayerIdNomerge only (required there): the second layer — same geometry class (point/line/polygon) as layerId.
dissolveFieldNodissolve only: group-by property (omit = dissolve ALL into one footprint); missing values form their own "(no value)" group.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / rationale / description
      Previous value: -"Short audit-log label (≤300 chars) stating the user-facing goal this call serves, e.g. \"add wildfire layer for the user's California query\". Required on every call. Stored in the operations log so map edits stay traceable — we never see your chat history."New value: +"Optional short label (≤300 chars) for the map edit history, e.g. \"add wildfire layer\". Omit it to send nothing beyond the tool arguments."
    • changedInput schema / required
      Previous value: -[
      -  "map_id",
      -  "analysis",
      -  "layerId",
      -  "rationale"
      -]New value: +[
      +  "map_id",
      +  "analysis",
      +  "layerId"
      +]
  2. Changed4 schema fields changed
    • changedInput schema / properties / analysis / description
      Previous value: -"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'. 'merge' = append layerId + mergeLayerId (same geometry class) into ONE dataset, each row stamped with its source layer. 'near' = each POINT in layerId gains the great-circle distance to (and identity of) its nearest feature in nearLayerId."New value: +"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'. 'merge' = append layerId + mergeLayerId (same geometry class) into ONE dataset, each row stamped with its source layer. 'near' = each POINT in layerId gains the great-circle distance to (and identity of) its nearest feature in nearLayerId. 'dissolve' = union POLYGONS sharing a dissolveField value into single features (omit the field to dissolve all into one)."
    • changedInput schema / properties / analysis / enum
      Previous value: -[
      -  "hotspot",
      -  "zonal",
      -  "enrich",
      -  "join",
      -  "merge",
      -  "near"
      -]New value: +[
      +  "hotspot",
      +  "zonal",
      +  "enrich",
      +  "join",
      +  "merge",
      +  "near",
      +  "dissolve"
      +]
    • addedInput schema / properties / dissolveField
      Added value: +{
      +  "description": "dissolve only: group-by property (omit = dissolve ALL into one footprint); missing values form their own \"(no value)\" group.",
      +  "maxLength": 80,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / sumFields
      Added value: +{
      +  "description": "dissolve only: numeric properties to SUM per group — skipped values reported, a group with none present carries NO sum.",
      +  "items": {
      +    "maxLength": 80,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 5,
      +  "minItems": 1,
      +  "type": "array"
      +}
  3. Changed8 schema fields changed
    • changedInput schema / properties / analysis / description
      Previous value: -"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'."New value: +"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'. 'merge' = append layerId + mergeLayerId (same geometry class) into ONE dataset, each row stamped with its source layer. 'near' = each POINT in layerId gains the great-circle distance to (and identity of) its nearest feature in nearLayerId."
    • changedInput schema / properties / analysis / enum
      Previous value: -[
      -  "hotspot",
      -  "zonal",
      -  "enrich",
      -  "join"
      -]New value: +[
      +  "hotspot",
      +  "zonal",
      +  "enrich",
      +  "join",
      +  "merge",
      +  "near"
      +]
    • changedInput schema / properties / layerId / description
      Previous value: -"The workspace layer to analyze (geojson-backed; the point source for zonal; the point TARGET for join)."New value: +"The workspace layer to analyze (geojson-backed; the point source for zonal; the point TARGET for join; the styling donor for merge)."
    • addedInput schema / properties / maxDistanceM
      Added value: +{
      +  "description": "near only: search radius in meters — a point whose nearest neighbor is farther carries NO near fields (reported).",
      +  "maximum": 20000000,
      +  "minimum": 1,
      +  "type": "number"
      +}
    • addedInput schema / properties / mergeLayerId
      Added value: +{
      +  "description": "merge only (required there): the second layer — same geometry class (point/line/polygon) as layerId.",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / nearField
      Added value: +{
      +  "description": "near only: property of the nearest feature to copy as its identity (default: first name-like property).",
      +  "maxLength": 80,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / nearLayerId
      Added value: +{
      +  "description": "near only (required there): the POINT layer to search for each target point's nearest neighbor.",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / sourceField
      Added value: +{
      +  "description": "merge only: name of the per-row provenance column naming each row's source layer (default \"merge_source\"; renamed on collision, reported).",
      +  "maxLength": 40,
      +  "minLength": 1,
      +  "type": "string"
      +}
  4. Changed6 schema fields changed
    • changedInput schema / properties / analysis / description
      Previous value: -"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state)."New value: +"Which analysis to run. 'hotspot' = Getis-Ord Gi* with FDR-corrected significance classes. 'zonal' = aggregate a point layer into polygon zones (count/sum/mean/min/max choropleth). 'enrich' = join a US Census indicator onto each feature by containment (tract/county/state). 'join' = spatial join (attribute transfer): each POINT in layerId takes the listed properties from the polygon in joinLayerId that contains it — the aggregate direction (points INTO polygons) is 'zonal'."
    • changedInput schema / properties / analysis / enum
      Previous value: -[
      -  "hotspot",
      -  "zonal",
      -  "enrich"
      -]New value: +[
      +  "hotspot",
      +  "zonal",
      +  "enrich",
      +  "join"
      +]
    • addedInput schema / properties / fields
      Added value: +{
      +  "description": "join only: which join-layer properties to transfer (default: auto-select up to 12 non-internal properties, overflow reported).",
      +  "items": {
      +    "maxLength": 80,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 12,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • addedInput schema / properties / joinLayerId
      Added value: +{
      +  "description": "join only (required there): the POLYGON layer providing the attributes.",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / layerId / description
      Previous value: -"The workspace layer to analyze (geojson-backed; the point source for zonal)."New value: +"The workspace layer to analyze (geojson-backed; the point source for zonal; the point TARGET for join)."
    • addedInput schema / properties / prefix
      Added value: +{
      +  "description": "join only: prefix for a joined field whose name collides with an existing target property (default \"join_\").",
      +  "maxLength": 20,
      +  "minLength": 1,
      +  "type": "string"
      +}
  5. Added

TDQS

A4.2/5.0
Behavior5/5

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

With annotations only declaring readOnly=false/idempotent=false/destructive=false, the description carries the real behavioral load: the result REPLACES its input layer(s) (undoable), 1 credit charged only when the result lands, typed failures (unknown layer, too few features, >10,000-feature cap) refunded, null-vs-zero guarantees, and a grounded memo whose numbers are 'computed, never generated.' The replacement semantics sit in mild tension with destructiveHint=false, but the explicit '(undoable)' qualifier resolves it rather than contradicting the annotation.

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

Conciseness3/5

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

The core action and its replacement semantics are front-loaded well, but the bulk of the text is a semicolon-chained enumeration of the seven modes that closely duplicates the schema's own `analysis` enum description, so a meaningful share of the length is redundant with structured data.

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

Completeness5/5

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

For a 24-parameter tool with no output schema, the description covers everything an agent needs: return shape ('grounded memo + stats payload'), credit and refund behavior, failure modes, input-replacement semantics, and per-mode data-handling guarantees.

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

Parameters4/5

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

Schema coverage is 96%, so per-parameter syntax is already documented and the baseline is 3; the description still adds meaning the schema does not, e.g. that omitting valueField on a point layer switches hotspot into hex density mode, that unmatched enrich/join features stay null rather than zero-filled, and that merge/dissolve never null-fill schemas.

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?

The opening clause gives a precise verb+resource+effect: 'Compute a spatial analysis server-side and append the finished... result as a new layer + camera,' and the per-mode breakdown (hotspot/zonal/enrich/join/merge/near/dissolve) makes the scope unambiguous. It never differentiates itself from related siblings such as correlate_layers or select_within, which also operate on layers, so it falls short of the 5 bar for sibling differentiation.

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

Usage Guidelines4/5

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

Offers strong mode-selection routing, most notably 'the aggregate direction (points INTO polygons) is zonal' to disambiguate join vs zonal, plus concrete tips like 'filter first or use state for wider layers' and cost/refund conditions. It gives no guidance on when to reach for a sibling tool instead of this one, so context is clear but exclusions are absent.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources