Skip to main content
Glama

Query records of an Opendatasoft dataset

query_portal_records
Read-only

Fetch and filter records from Swiss Opendatasoft portals using ODSQL, including field selection, grouping, sorting, paging, and radius searches around coordinates.

Instructions

Fetch records from a dataset on a Swiss Opendatasoft portal with ODSQL: where (e.g. "kanton = 'BS'", "jahr >= 2020", "search(name, 'Bahnhof')"), select (e.g. 'bahnhof_haltestelle, dtv, jahr'), order_by (e.g. 'dtv desc'), group_by with aggregates (select 'kanton, count(*) as n, sum(dtv) as total', group_by 'kanton'), limit/offset. Convenience near {lat, lon, radius_m} finds the dataset's geo_point_2d field and returns only records within the radius, sorted by distance (e.g. parking garages within 800 m of Basel SBB: portal 'basel-stadt', near {lat:47.5476, lon:7.5896, radius_m:800}). Real-time datasets (parking occupancy, SBB data) are cached only 10 min. Get field names first with get_portal_dataset.

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": {
      "portal": "<portal>",
      "dataset_id": "<dataset_id>"
    },
    "name": "query_portal_records"
  }
}

Input Schema

NameRequiredDescriptionDefault
langNoLanguage for localized values where the portal supports it
nearNoRadius search around a WGS84 point, e.g. {lat: 47.5476, lon: 7.5896, radius_m: 500}
limitNoRecords to return (max 100)
whereNoODSQL filter, e.g. "jahr = 2023 AND dtv > 10000" (string literals in single or double quotes)
offsetNoPaging offset (offset + limit ≤ 10000)
portalYesPortal id, alias or domain: 'sbb' (data.sbb.ch), 'basel-stadt' (data.bs.ch), 'basel-landschaft' (data.bl.ch), 'st-gallen' (daten.sg.ch), 'stadt-st-gallen' (daten.stadt.sg.ch), 'graubuenden' (data.gr.ch), 'thurgau' (data.tg.ch); any other '<tenant>.opendatasoft.com' host also works
selectNoFields/expressions to return, e.g. 'name, belegung, geo_point_2d' or 'kanton, count(*) as n'
group_byNoe.g. 'kanton' or 'year(datum)'; combine with aggregates in select
order_byNoe.g. 'dtv desc' or 'n desc'
geo_fieldNogeo_point_2d field to use for `near` (auto-detected if omitted)
dataset_idYesDataset id from search_portal_datasets

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.3

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds real behavior beyond that: real-time datasets are cached only 10 minutes, `near` auto-detects the geo_point_2d field and returns records sorted by distance, and offset+limit must stay ≤ 10000. No auth or rate-limit information, which is the remaining gap.

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 the core purpose, followed by clause-by-clause examples and one concrete end-to-end scenario. The single dense paragraph is information-rich with no filler, though the run-on example chain makes it slower to scan than it could be.

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

Completeness3/5

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

With 11 parameters (including a nested object) and no output schema, the description is thorough on input semantics but silent on what a response looks like — record shape, whether a total count or pagination metadata is returned. An agent can call it correctly but cannot anticipate the result structure.

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 the baseline is 3; the description earns above that by supplying worked ODSQL examples for where/select/order_by/group_by and by clarifying that group_by must be combined with aggregates in select, plus the distance-sorted semantics of `near`. It adds usage meaning rather than repeating schema text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Fetch records from a dataset on a Swiss Opendatasoft portal') plus the query dialect (ODSQL), which pins the scope well. It names get_portal_dataset as a prerequisite but never contrasts itself with the similarly named query_dataset or aggregate_dataset siblings, so an agent must infer which one applies to ODS portals.

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 concrete when-to-use context: use ODSQL clauses for filtering/aggregation, use `near` for radius searches, and call get_portal_dataset first for field names. It stops short of stating exclusions (e.g., when to prefer query_dataset or when `near` is inappropriate versus a plain `where`).

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