sf_query

Pack: data-sf · Connect: https://pipeworx.io/mcp (see Connect below for a single-pack URL)

No MCP client? Call it directly: GET https://gateway.pipeworx.io/v1/tools/sf_query for the schema, then POST the same URL with its arguments for the data.

Run a raw SoQL query against any San Francisco open-data resource (data.sfgov.org, also written data.sf.gov) by its Socrata id (8-char like “wg3w-h783” or “ebsh-uavg”). Covers SF city purchasing/procurement records (resource id “ebsh-uavg”) — real column names fiscal_year, po_dt, purchase_order, purchase_order_line, purchasing_department, purchasing_department_title, commodity_code, commodity_title (the item name/description column — there is no “commodity_description”), vendor_name, vendor_street, vendor_city, vendor_state, vendor_zip_code, vendor_contact, vendor_email, vendor_phone, encumbered_quantity, encumbered_amount — as well as every other SF Socrata dataset by resource id; if you do not already know a dataset’s exact column names, omit select (every column comes back) rather than guessing one, since Socrata 400s on an unknown column instead of ignoring it. Full SoQL: where/select/group/order/limit/offset. Use sf_datasets to find a resource id, or sf_recent for the common ones (including “purchasing”).

Parameters

NameTypeRequiredDescription
resource_idstringyesSocrata resource id, e.g. “wg3w-h783” (police incidents).
wherestringnoSoQL $where filter (e.g. “incident_year=2025”).
selectstringnoSoQL $select (e.g. “incident_category, count(*)”).
groupstringnoSoQL $group (e.g. “incident_category”).
orderstringnoSoQL $order (e.g. “incident_datetime DESC”).
limitnumbernoMax rows (default 100, max 5000).
offsetnumbernoRow offset for paging.

Example call

Arguments

{
  "resource_id": "wg3w-h783",
  "where": "incident_year=2025",
  "limit": 100,
  "_apiKey": "your-data-sf-api-key"
}

curl

curl -X POST https://gateway.pipeworx.io/data-sf/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"sf_query","arguments":{"resource_id":"wg3w-h783","where":"incident_year=2025","limit":100,"_apiKey":"your-data-sf-api-key"}}}'

TypeScript (@pipeworx/sdk)

import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();

const result = await pipeworx.call('sf_query', {
  "resource_id": "wg3w-h783",
  "where": "incident_year=2025",
  "limit": 100,
  "_apiKey": "your-data-sf-api-key"
});

More examples

{
  "resource_id": "wg3w-h783",
  "select": "incident_category, count(*)",
  "group": "incident_category",
  "order": "count(*) DESC",
  "_apiKey": "your-data-sf-api-key"
}

Connect

Add this to your MCP client config — every tool in the catalog, including this one — or use one-click install buttons:

{
  "mcpServers": {
    "pipeworx": {
      "url": "https://pipeworx.io/mcp"
    }
  }
}
Connect to just the data-sf pack
{
  "mcpServers": {
    "data-sf": {
      "url": "https://gateway.pipeworx.io/data-sf/mcp"
    }
  }
}

See Getting Started for client-specific install steps.

Regenerated from source · build October 30, 2026