Skip to main content
Glama

socrata-mcp-server

Query Dataset

socrata_query_dataset
Read-onlyIdempotent

Execute a SoQL query against any dataset on any Socrata portal. Use the search parameter for quick full-text lookup, or combine select/where/group/having/order for full analytical control. Returns rows plus the assembled SoQL string so you can learn the pattern. All SODA 2.1 row values are strings even for numeric columns — check dataType from socrata_get_dataset to determine correct WHERE quoting: Number columns use bare literals (year=2023), Text columns use single-quoted strings (year='2023'). To enumerate distinct values, use select="col, count(*) as n" with group="col" and order="n DESC". When CANVAS_PROVIDER_TYPE=duckdb and rows fill the limit, results spill to a DataCanvas table for SQL-based analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupNoSoQL GROUP BY clause. Requires an aggregate function in select.
limitNoMax rows to return (1–5000). Default 100. Use with offset for pagination.
orderNoSoQL ORDER BY clause, e.g. "total_deaths DESC" or "date ASC".
whereNoSoQL WHERE clause. Check column dataType from socrata_get_dataset first — Number columns: year=2023, Text columns: year='2023'. Operators: =, !=, >, <, LIKE, IN(...), BETWEEN, IS NULL, starts_with(), contains(), AND, OR, NOT.
domainNoPortal domain (e.g. data.seattle.gov). Defaults to SOCRATA_DEFAULT_DOMAIN or data.seattle.gov.
havingNoSoQL HAVING clause. Filters on aggregated results, e.g. count > 100.
offsetNoRow offset for pagination. Default 0.
searchNoFull-text search across all text columns ($q). For field-specific filtering, use where instead.
selectNoSoQL SELECT clause — column names, aliases, aggregates: "state, sum(deaths) as total_deaths". Omit for all columns.
canvas_idNoOptional 10-char DataCanvas token from a prior call. Omit on first call when CANVAS_PROVIDER_TYPE=duckdb to mint a fresh canvas. Large result sets spill here automatically.
dataset_idYesFour-by-four dataset ID (e.g. kzjm-xkqj). Obtain from socrata_find_datasets.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
capNoThe row limit that was applied when capped.
rowsNoResult rows. Scalar values are strings (SODA 2.1); geo/location columns return nested objects. Use column schema from socrata_get_dataset for type context.
errorNoPresent when the call failed. Absent on success.
shownNoRows returned in this response when capped.
domainNoPortal domain queried.
noticeNoGuidance when the query returned zero rows — suggests narrowing or reviewing the SoQL. Absent on non-empty result sets.
canvas_idNoDataCanvas token when results spilled (requires CANVAS_PROVIDER_TYPE=duckdb). Pass to socrata_dataframe_query to run SQL over the staged rows — a bounded copy of the matching set (up to 50,000 rows, reported in canvas_row_count), not the full set when total_count exceeds that cap. Page with offset to reach rows beyond it.
row_countNoRows returned in this response.
truncatedNoTrue when rows filled the limit — more rows may match (see total_count when present). Spills to canvas when enabled.
dataset_idNoDataset ID queried.
total_countNoTotal matching source rows when a plain row query is truncated (row_count < total_count). Absent when the full result fits and for grouped/aggregate queries (group set), where a source-row count would not describe the returned groups.
assembled_queryNoSoQL clauses assembled for this request — useful for learning the syntax.
canvas_row_countNoRows staged onto the DataCanvas — a bounded copy of the matching result set (capped at 50,000). Fewer than total_count when the match exceeds the cap. Present only when canvas_id is.

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, so the safety profile is covered. The description adds important behavior beyond annotations: returned rows include the assembled SoQL string, all SODA 2.1 row values are strings regardless of column type, and results spill to a DataCanvas table under duckdb conditions. These are critical, non-obvious behaviors that materially affect how an agent interprets and uses results.

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 dense but efficient—about six sentences, each with a distinct job: core purpose, usage mode, return format, data-type caveat, distinct-value example, spill behavior. Information is front-loaded with the most important action and purpose first. No filler or repetition that would dilute the message.

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 complex 11-parameter tool, the description covers the main execution modes, a critical data-type gotcha, an advanced aggregation pattern, and the spill-to-DataCanvas behavior. The output schema already covers return values, so the description does not need to restate them. The only minor omission is error handling or authentication, but annotations and schema make this a non-issue for a read-only query tool.

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 description coverage is 100%, so the baseline is 3. The description adds value by demonstrating how parameters combine into a coherent query strategy, especially the distinct-value example and the quoting rules tied to dataType. Some of this content also appears in the schema, but the description reinforces it in a usage-oriented way that helps an agent compose valid SoQL.

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?

Description opens with a specific verb+resource: 'Execute a SoQL query against any dataset on any Socrata portal.' It clearly distinguishes itself from siblings like socrata_get_dataset (metadata) and socrata_dataframe_query (dataframe-based) by focusing on raw SoQL execution. The distinction between full-text search and analytical querying further sharpens purpose.

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?

Provides clear conditions: use `search` for quick full-text lookup, or combine `select/where/group/having/order` for analytical control. References socrata_get_dataset as a prerequisite for checking data types, and gives a concrete pattern for distinct-value enumeration. It does not explicitly state when to prefer sibling alternatives, but the within-tool guidance is strong and actionable.

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

A4.7/5.0
Disambiguation5/5

Each tool has a distinct role: discovery (list_portals), search (find_datasets), metadata (get_dataset), query (query_dataset), and post-query analysis (dataframe_describe and dataframe_query). The only potential overlap is between find_datasets and get_dataset, but they are clearly separated by preview vs full schema.

Naming Consistency5/5

All tools follow a consistent 'socrata_<verb>_<noun>' pattern (e.g., socrata_find_datasets, socrata_get_dataset). The dataframe tools extend with a clear prefix (socrata_dataframe_describe/query), maintaining the pattern and clarity.

Tool Count5/5

With 6 tools, the server covers the full discovery-to-query workflow without excess. Each tool serves a necessary step in the pipeline, from portal selection to result analysis, and the count feels well-scoped for a data access tool.

Completeness5/5

The surface covers the entire lifecycle: discover portals, search datasets, fetch metadata, execute queries, and handle large results via DataCanvas spill. There are no obvious gaps for the stated purpose of querying Socrata open-data portals.