Skip to main content
Glama

query_spatial_sql

Run spatial SQL queries on GeoJSON and geospatial metadata to filter, aggregate, and compute spatial metrics like area and intersections, returning JSON results.

Instructions

Execute spatial SQL queries on GeoJSON FeatureCollections or tabular geospatial metadata. Modeled after GeoLibre's DuckDB Spatial query panel.

Supports:

  • Standard SQL: SELECT, WHERE, GROUP BY, ORDER BY, LIMIT

  • Spatial Predicates: ST_Area, ST_Centroid, ST_Length, ST_Intersects

Args: sql: SQL query string (e.g. "SELECT id, severity, ST_Area(geom) as area_ha FROM features WHERE severity = 'HIGH'") geojson: GeoJSON FeatureCollection string (from any eo-mcp tool). table_name: Virtual table name (default 'features').

Returns: JSON string containing result columns, rows, and matched feature count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
geojsonYes
table_nameNofeatures

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden. It discloses the supported SQL subset, spatial predicates, and the JSON return shape, which is substantial. It does not explicitly state whether execution is read-only/in-memory or describe error behavior, but the query semantics are clearly scoped.

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

Conciseness5/5

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

The description is compact, front-loaded with purpose, and organized into Supports, Args, and Returns sections. The example SQL query is illustrative rather than padding, and every sentence earns its place.

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?

All three parameters are explained, the input data source is specified, supported operations are enumerated, and the return format is defined. For a self-contained query tool with no annotation coverage, an agent has everything needed to select and invoke it 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?

Schema description coverage is 0%, but the Args section fully compensates. The sql parameter includes a concrete example, geojson specifies a GeoJSON FeatureCollection sourced from eo-mcp tools, and table_name explains the virtual table concept and its default value. Every parameter's meaning is clear.

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: 'Execute spatial SQL queries on GeoJSON FeatureCollections or tabular geospatial metadata.' It then enumerates the supported SQL and spatial predicates, making the tool's function unambiguous and distinguishing it from the many geospatial analysis siblings.

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?

It gives clear context: use this tool when you need SQL-style filtering, grouping, ordering, or spatial calculations over GeoJSON produced by any eo-mcp tool. It does not explicitly name alternative tools to avoid or state when-not-to-use conditions, so it stops short of the strongest guidance.

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