Skip to main content
Glama

query_layer

Read-onlyIdempotent

Query a layer's data with filters and grouping. Reads the parquet file at runtime. Supports: select specific columns, filter by column values, group by a column to get counts, and sum numeric columns per group (e.g. roll block areas up to district totals). Use get_layer_schema first to discover column names. Examples: 'airports in Karnataka' -> where: {state: 'Karnataka'}, 'forest types' -> group_by: 'type', 'health facilities in Bihar' -> where: {state: 'BIHAR'}, select: ['name', 'type'].

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": {
      "layer_id": "<layer_id>"
    },
    "name": "query_layer"
  }
}

Input Schema

NameRequiredDescriptionDefault
sumNoNumeric columns to total per group (requires group_by). Adds {sums: {group: {col: total}}}. Use this to roll finer units up, e.g. block-level areas to district totals. Shares/percentages are not additive: sum the area columns and recompute shares.
limitNoMax rows (default 100, max 1000)
whereNoFilter conditions as {column: value} pairs. Exact, case-insensitive match on flat columns (not partial). Values may contain commas.
selectNoColumn names to return. Omit for all non-geometry columns.
group_byNoColumn to group by. Returns {value: count} instead of rows.
layer_idYesLayer ID to query
include_centroidNoInclude _lat/_lng centroid coordinates (defaults to true). Set false to exclude.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, so the safety profile is covered. The description adds real behavior beyond that: it reads the parquet file at runtime, defaults to 100 rows capped at 1000, group_by returns {value: count} instead of rows, sums emit a nested {sums: {group: {col: total}}} structure, and non-additive share columns must be recomputed.

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?

Front-loaded with purpose, then capabilities, then prerequisite, then examples – a sensible order. There is mild redundancy: the block-areas-to-district-totals example appears both in the description and in the sum parameter schema, costing a little space.

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

Completeness4/5

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

With no output schema, the description carries the return-shape burden and does so for the grouped and summed cases and for the default all-non-geometry-columns behavior. For a 7-parameter read tool this is adequate, though the flat row-return shape is only implied.

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 100%, so baseline is 3; the description earns above that by showing concrete column filters, illustrating select with ['name','type'], and noting the sum/group_by dependency and the additive-measure caveat that the schema also states. The examples make the filter and grouping semantics immediately actionable.

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?

States a specific verb and resource ('Query a layer's data') plus scope ('with filters and grouping') and enumerates the four supported operations. It is clearly distinguishable from get_layer_schema (schema discovery, which it explicitly defers to) and from geometry siblings like nearby/locate.

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?

Gives an explicit prerequisite ('Use get_layer_schema first to discover column names') and three worked examples mapping natural-language questions to parameter shapes. It does not say when to prefer a sibling query path or when not to use it, so it falls short of a full routing rule.

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.