Skip to main content
Glama
cliwant

mcp-sam-gov

socrata_query

Read-only

Retrieve rows from state and local government Socrata/SODA open-data portals, applying filters, pagination, and SoQL aggregates to get exact totals or top-N vendor rankings without manual summing.

Instructions

Query rows from an allowlisted Socrata/SODA open-data portal (keyless; ~a dozen US state portals + USAC E-rate on one identical API — state spend/checkbook/contract/vendor-payment datasets). State procurement mirrors: NY ehig-g5x3, NJ ubnu-tqu7, WA s8d5-pj78, MA cthru.data.socrata.com pegc-naaa (~49M payment rows). Full map: read resource samgov://data-map/state-local. Input domain (curated allowlist enum — the SSRF host guard), datasetId (4x4, from socrata_discover_datasets), optional SoQL select/where/order/q, limit (≤1000, def 100), offset, withTotal (def true). AGGREGATES: for a grand total pass select='sum(amount)' with a where filter; for top-N vendors pass select='vendor_name, sum(amount) as total' with order='total DESC' — these return the final answer directly, NOT a page to manually sum. HONESTY: SODA's row response has no total, so a count(*) companion supplies an exact totalAvailable; if it fails the rows still return with totalAvailable:null + a note (hasMore is then inferred from page-fill, never a false complete). Genuine-empty ⇒ complete:true/total:0; an outage/400/404 THROWS (never a fake empty). Value fields are strings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNoOptional SoQL $q full-text search across the row.
limitNoRows per page ($limit), 1..1000, default 100.
orderNoOptional SoQL $order, e.g. 'amount DESC'.
whereNoOptional SoQL $where filter, e.g. "fiscal_year='2024' AND amount>1000". A bad column ⇒ upstream HTTP 400 ⇒ invalid_input (surfaced, never silent).
domainYesWhich allowlisted Socrata portal to query (the SSRF host allowlist — no free host). Jurisdiction of non-obvious hosts: cthru.data.socrata.com=MASSACHUSETTS statewide (CTHRU); atlanta.data.socrata.com=Atlanta GA; controllerdata.lacity.org+data.lacity.org=Los Angeles; www.dallasopendata.com=Dallas TX; data.brla.gov=Baton Rouge LA; data.kcmo.org=Kansas City MO; data.cstx.gov=College Station TX; data.weho.org=West Hollywood CA; opendata.usac.org+datahub.usac.org=federal USAC E-rate. data.colorado.gov's procurement data is CITY OF DENVER, not CO state.
offsetNo0-based row offset ($offset) for pagination, default 0.
selectNoOptional SoQL $select (column projection or aggregate). For a TOTAL: 'sum(amount)' (add a where for vendor/fiscal-year filter). For a TOP-N ranking: 'vendor_name, sum(amount) as total' — pair with order='total DESC'. Any SoQL function call (sum/count/avg/min/max) or 'distinct' activates aggregate mode: totalAvailable becomes null (no raw-row total for aggregates) and the count(*) companion is skipped. NEVER sum rows from one page to get a total — always use an aggregate select.
datasetIdYesThe dataset's Socrata 4x4 id, e.g. 'kwxv-fwze' (from socrata_discover_datasets). Exactly [a-z0-9]{4}-[a-z0-9]{4} (9 chars; no surrounding whitespace).
withTotalNotrue (default) ⇒ issue a count(*) companion query so totalAvailable is exact. false ⇒ skip it (one fewer request); totalAvailable is null and a note discloses results may be truncated at $limit.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.16.0
    • changedInput schema / properties / domain / description
      Previous value: -"Which allowlisted Socrata portal to query (curated .gov hosts + USAC E-rate .org; the SSRF host allowlist — no free host). e.g. data.ny.gov, data.texas.gov, data.wa.gov, opendata.usac.org."New value: +"Which allowlisted Socrata portal to query (the SSRF host allowlist — no free host). Jurisdiction of non-obvious hosts: cthru.data.socrata.com=MASSACHUSETTS statewide (CTHRU); atlanta.data.socrata.com=Atlanta GA; controllerdata.lacity.org+data.lacity.org=Los Angeles; www.dallasopendata.com=Dallas TX; data.brla.gov=Baton Rouge LA; data.kcmo.org=Kansas City MO; data.cstx.gov=College Station TX; data.weho.org=West Hollywood CA; opendata.usac.org+datahub.usac.org=federal USAC E-rate. data.colorado.gov's procurement data is CITY OF DENVER, not CO state."
    • changedInput schema / properties / domain / enum
      Previous value: -[
      -  "data.ny.gov",
      -  "data.colorado.gov",
      -  "data.ct.gov",
      -  "data.texas.gov",
      -  "data.wa.gov",
      -  "opendata.maryland.gov",
      -  "data.vermont.gov",
      -  "data.nj.gov",
      -  "data.oregon.gov",
      -  "data.pa.gov",
      -  "data.mo.gov",
      -  "data.delaware.gov",
      -  "data.austintexas.gov",
      -  "data.kingcounty.gov",
      -  "data.montgomerycountymd.gov",
      -  "data.mesaaz.gov",
      -  "data.cambridgema.gov",
      -  "data.transportation.gov",
      -  "data.cdc.gov",
      -  "data.bts.gov",
      -  "datacatalog.cookcountyil.gov",
      -  "data.illinois.gov",
      -  "data.cincinnati-oh.gov",
      -  "data.cityofnewyork.us",
      -  "data.cityofchicago.org",
      -  "data.sfgov.org",
      -  "controllerdata.lacity.org",
      -  "opendata.usac.org",
      -  "data.kcmo.org",
      -  "data.brla.gov",
      -  "www.dallasopendata.com",
      -  "data.lacity.org",
      -  "data.ramseycountymn.gov",
      -  "data.richmondgov.com",
      -  "opendata.howardcountymd.gov",
      -  "data.providenceri.gov",
      -  "fiscalfocus.pittsburghpa.gov",
      -  "data.coloradosprings.gov",
      -  "data.framinghamma.gov",
      -  "data.fultoncountyga.gov",
      -  "atlanta.data.socrata.com",
      -  "opendata.cityofmesquite.com",
      -  "datahub.usac.org",
      -  "performance.ci.janesville.wi.us",
      -  "datahub.austintexas.gov",
      -  "cthru.data.socrata.com",
      -  "data.macoupincountyil.gov",
      -  "data.oaklandca.gov",
      -  "data.princegeorgescountymd.gov",
      -  "data.cstx.gov",
      -  "datahub.transportation.gov",
      -  "citydata.mesaaz.gov",
      -  "data.weho.org"
      -]New value: +[
      +  "data.ny.gov",
      +  "data.colorado.gov",
      +  "data.ct.gov",
      +  "data.texas.gov",
      +  "data.wa.gov",
      +  "opendata.maryland.gov",
      +  "data.vermont.gov",
      +  "data.nj.gov",
      +  "data.oregon.gov",
      +  "data.pa.gov",
      +  "data.mo.gov",
      +  "data.delaware.gov",
      +  "data.austintexas.gov",
      +  "data.kingcounty.gov",
      +  "data.montgomerycountymd.gov",
      +  "data.mesaaz.gov",
      +  "data.cambridgema.gov",
      +  "data.transportation.gov",
      +  "data.cdc.gov",
      +  "data.bts.gov",
      +  "datacatalog.cookcountyil.gov",
      +  "data.illinois.gov",
      +  "data.cincinnati-oh.gov",
      +  "data.cityofnewyork.us",
      +  "data.cityofchicago.org",
      +  "data.sfgov.org",
      +  "data.sf.gov",
      +  "controllerdata.lacity.org",
      +  "opendata.usac.org",
      +  "data.kcmo.org",
      +  "data.brla.gov",
      +  "www.dallasopendata.com",
      +  "data.lacity.org",
      +  "data.ramseycountymn.gov",
      +  "data.richmondgov.com",
      +  "opendata.howardcountymd.gov",
      +  "data.providenceri.gov",
      +  "fiscalfocus.pittsburghpa.gov",
      +  "data.coloradosprings.gov",
      +  "data.framinghamma.gov",
      +  "data.fultoncountyga.gov",
      +  "sharefulton.fultoncountyga.gov",
      +  "atlanta.data.socrata.com",
      +  "opendata.cityofmesquite.com",
      +  "datahub.usac.org",
      +  "performance.ci.janesville.wi.us",
      +  "datahub.austintexas.gov",
      +  "cthru.data.socrata.com",
      +  "data.macoupincountyil.gov",
      +  "data.oaklandca.gov",
      +  "data.princegeorgescountymd.gov",
      +  "data.cstx.gov",
      +  "datahub.transportation.gov",
      +  "citydata.mesaaz.gov",
      +  "data.weho.org"
      +]
    • changedInput schema / properties / select / description
      Previous value: -"Optional SoQL $select (column projection / aggregate), e.g. 'agency,SUM(amount)'."New value: +"Optional SoQL $select (column projection or aggregate). For a TOTAL: 'sum(amount)' (add a where for vendor/fiscal-year filter). For a TOP-N ranking: 'vendor_name, sum(amount) as total' — pair with order='total DESC'. Any SoQL function call (sum/count/avg/min/max) or 'distinct' activates aggregate mode: totalAvailable becomes null (no raw-row total for aggregates) and the count(*) companion is skipped. NEVER sum rows from one page to get a total — always use an aggregate select."
  2. Addedv1.12.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnlyHint/openWorldHint annotations, it discloses keyless access, the SSRF host allowlist, the count(*) companion for exact totalAvailable, aggregate-mode behavior, and explicit failure semantics (outage/400/404 throws, never a fake empty, genuine-empty returns complete:true/total:0). This is substantial operational transparency.

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 long but dense and well-structured with labeled sections (AGGREGATES, HONESTY) and front-loaded scope. Every sentence adds operational value, from the domain map to the never-false-complete guarantee, without filler.

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 9-parameter tool with no output schema, it covers input validation, aggregation patterns, pagination, totalAvailable behavior, error semantics, and the discovery workflow. The explicit note that value fields are strings and the detailed honesty section make the tool safe to invoke 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 with 100% schema coverage, the description adds meaning: SoQL aggregate examples, domain jurisdiction disambiguation, datasetId format rules, withTotal tradeoffs, and error behavior for invalid where columns. This goes well beyond the schema's parameter descriptions.

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: 'Query rows from an allowlisted Socrata/SODA open-data portal,' and enumerates the kind of data (state spend/checkbook/contract/vendor-payment). It also points to socrata_discover_datasets as the source of datasetId, distinguishing it from the discovery sibling.

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 concrete usage patterns for aggregates ('for a grand total pass select='sum(amount)'...'), top-N rankings, pagination controls, and a clear 'NEVER sum rows from one page' directive. It does not explicitly contrast with non-Socrata query siblings like ckan_query, but the domain allowlist and datasetId workflow make the intended use unambiguous.

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

Deploy Server

Other Tools