Sf Query
sf_queryRun 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").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group | No | SoQL $group (e.g. "incident_category"). | |
| limit | No | Max rows (default 100, max 5000). | |
| order | No | SoQL $order (e.g. "incident_datetime DESC"). | |
| where | No | SoQL $where filter (e.g. "incident_year=2025"). | |
| offset | No | Row offset for paging. | |
| select | No | SoQL $select (e.g. "incident_category, count(*)"). | |
| _apiKey | No | Optional — your own Socrata app token for higher rate limits. Omit to use the keyless endpoint. | |
| resource_id | Yes | Socrata resource id, e.g. "wg3w-h783" (police incidents). |