Skip to main content
Glama

sns_query_dataset

Run ODSQL queries on SNS Transparency portal datasets to filter, aggregate and sort health statistics that curated tools don't cover. Use it after searching datasets to get official figures.

Instructions

Run an ODSQL query on any SNS Transparency portal dataset (Opendatasoft Explore API v2.1).

Use after sns_search_datasets for anything the curated tools don't cover. Clauses are ODSQL:

  • where: instituicao like "santa maria" and tempo >= date'2026-01-01' (like is a case- and accent-insensitive "contains"; dates use date'YYYY-MM-DD')

  • select: tempo, instituicao, total_urgencias or aggregates sum(total_urgencias) as total

  • group_by: regiao or tempo (combine with aggregates in select)

  • order_by: tempo desc Most hospital-activity datasets (field tempo, monthly) store YEAR-TO-DATE CUMULATIVE values: December is the annual total; a single month = this month minus the previous one. Many datasets have a regiao and an instituicao (or entidade) field. Official statistics, not live data.

Args: dataset_id: e.g. "ocupacao-do-internamento" (from sns_search_datasets). where, select, group_by, order_by: ODSQL clauses (optional). limit: Rows to return (default 20, max 100). offset: Skip rows, for paging.

Input Schema

NameRequiredDescriptionDefault
limitNo
whereNo
offsetNo
selectNo
group_byNo
order_byNo
dataset_idYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.6/5.0
Behavior4/5

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

With zero annotations the description carries the full burden, and it delivers real behavioral context the agent could not otherwise know: results are "official statistics, not live data", and hospital-activity datasets store year-to-date cumulative values so a single month must be differenced. It also discloses the limit ceiling (max 100) and paging via offset. It stops short of stating read-only semantics or failure behavior for a bad dataset_id, which keeps it off a 5.

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?

The opening sentence front-loads purpose and API version, then bullets keep the clause reference scannable. The cumulative-values warning is the longest block, but it is high-value domain context rather than filler. Slightly dense, yet no sentence is expendable.

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

Completeness4/5

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

An output schema exists, so return shape needs no explanation, and the description covers the query dialect, field conventions (tempo, regiao, instituicao/entidade), and result-size controls. The main remaining gap is error/empty-result behavior and whether the call requires any auth, which for a 7-parameter free-form query tool would help.

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?

Schema description coverage is 0%, so the description must compensate entirely, and it does: every parameter is explained with concrete ODSQL syntax (where with `like` and date'YYYY-MM-DD', select with aggregates, group_by, order_by), dataset_id gets a real example, and limit is given a default and max. This is meaningfully more than the schema's bare titles and defaults.

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?

States a specific verb and resource: "Run an ODSQL query on any SNS Transparency portal dataset (Opendatasoft Explore API v2.1)". It immediately distinguishes itself from the curated siblings (sns_emergency_stats, sns_surgery_wait_stats) by framing itself as the general-purpose escape hatch, and even names the upstream API so the query dialect is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Use after sns_search_datasets for anything the curated tools don't cover" gives both the prerequisite tool and the exclusion condition that routes the agent here. The dependency on sns_search_datasets for dataset_id is reinforced in the Args section, so an agent knows the entry path.

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