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).
rationaleYesShort 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.
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.

TDQS

A4.7/5.0
Behavior5/5

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

The description goes far beyond annotations, disclosing that results replace input layers (undoable), that failures are typed and refunded, that credits are consumed, that unmatched values are never zero-filled, and that all reported numbers are computed rather than generated. This is exemplary behavioral disclosure for a write operation.

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?

The description is long, but the complexity of seven analysis modes justifies the length. It is front-loaded with the core behavior and organized by mode. Some phrases like 'honestly-legended' and 'grounded memo' add flavor but are slightly vague.

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?

Given 24 parameters, nested objects, no output schema, and seven distinct behaviors, the description is remarkably complete: it covers per-mode data handling, failure modes, credit costs, replacements, defaults, and return payload nature. An agent has enough context to invoke and interpret the tool correctly.

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

Parameters5/5

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

Even though schema coverage is 96%, the description adds meaningful parameter semantics: defaults (e.g., hotspot nearest neighbors default 8), mode-specific omission behavior (e.g., hotspot density mode when valueField is omitted), collision handling, and cap/refund behavior. It clarifies far more than the schema alone.

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

Purpose5/5

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

The description opens with a specific verb and resource ('Compute a spatial analysis server-side and append the finished... result as a new layer + camera') and then enumerates all seven analysis modes with distinct definitions. This clearly distinguishes the tool from sibling operations like add_layer, filter_layer, and correlate_layers.

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?

Each analysis mode ('hotspot', 'zonal', 'enrich', etc.) is paired with a precise when-to-use definition, including key exclusions like 'enrich... unmatched features stay null, never zero-filled' and 'join... not zonal'. It does not explicitly compare against sibling tools or state general conditions when run_analysis should not be used, so it falls just short of a perfect 5.

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.

TDQS

A3.9/5.0
Disambiguation4/5

Most tools have clearly distinct purposes, but a few pairs such as select_within/focus_area and correlate_layers/add_fusion_layer overlap in function, differing mainly by input type or output (read vs. write). The descriptions adequately explain these differences, so agents can distinguish them with careful reading.

Naming Consistency5/5

Tool names consistently follow a verb_noun snake_case pattern (add_layer, filter_layer, export_image, remove_annotation). Minor exceptions like undo/redo/tag are conventional single verbs and do not detract from the overall predictability.

Tool Count4/5

At 25 tools, the server is on the heavy side, but each tool serves a distinct operation in a comprehensive mapping workspace—covering creation, editing, analysis, export, and history. The number feels justified by the broad feature set rather than excessive.

Completeness4/5

The toolset covers the full lifecycle of layers and workspace state, including add/remove/rename/restyle/filter, build/get/mutate/undo/redo, export, and tagging. Minor gaps such as annotation editing, layer reordering, or direct data updates exist, but they are not critical blockers for typical workflows.

Resources