Skip to main content
Glama

Query data from a BFS STAT-TAB table

query_bfs_table
Read-only

Fetch labelled figures from STAT-TAB tables by mapping variables to values; omitted variables default to totals or latest periods, and selections can use ranges or all values.

Instructions

Fetch labelled figures from any STAT-TAB table. 'selection' maps variables (code or label, case/accents ignored) to values (codes or labels); '' = all values, 'latest' / 'latest:5' = last period(s), '2015-2020' = year range. Unspecified variables default to their total (e.g. 'Schweiz', 'Total') or the latest period, and the response lists every default applied. Max 5000 cells per query. Returns rows like {Kanton:'Zürich', value:1605508} plus 'fixed' for single-valued dimensions. Example: {table_id:'px-x-0102010000_101', selection:{Jahr:['latest'], Kanton:['Zürich','Bern'], Geschlecht:['']}}.

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": {
      "table_id": "<table_id>"
    },
    "name": "query_bfs_table"
  }
}

Input Schema

NameRequiredDescriptionDefault
langNoLanguage of titles/labels: de, fr, it or en (default en)en
limitNoMax rows returned
table_idYesTable id like 'px-x-0102010000_101'
selectionNoMap variable → values, e.g. {"Jahr": ["latest"], "Kanton": ["*"]}
include_codesNoAlso return value codes next to labels

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.3

TDQS

A3.7/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 genuinely new behavioral context beyond that: a 5000-cell query cap, automatic defaults for unspecified variables with those defaults echoed in the response, and a 'fixed' field for single-valued dimensions. It does not cover error behavior for invalid variable names or how the row 'limit' interacts with the cell cap, which keeps it at 4 rather than 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?

Front-loaded with purpose, then the selection grammar, then caps and return shape, ending with a concrete example — a logical order with no filler prose. The closing example partially repeats the selection syntax already explained, a minor redundancy that is still useful for a nested-object parameter, so it falls just short of maximally tight.

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?

With no output schema, the description must carry return-value information, and it does: row shape {Kanton:'Zürich', value:1605508}, the 'fixed' field, and disclosure of applied defaults. For a nested-object, open-world query tool this is close to complete; the remaining gaps are error handling for unknown tables/variables and how 'limit' relates to the 5000-cell ceiling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all five parameters and the baseline is 3. The description does add real semantics for the nested 'selection' object — wildcard, latest, latest:N, year-range syntax, case/accent-insensitive matching, and default-to-total behavior — but it says nothing about lang, limit, or include_codes beyond what the schema states, so the added value is concentrated in one parameter.

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?

The description opens with a specific verb and resource: 'Fetch labelled figures from any STAT-TAB table.' That is concrete enough to distinguish it from metadata/search siblings such as get_bfs_table_metadata and search_bfs_tables. It stops short of explicitly naming which sibling to use when the goal is metadata or table discovery, so it is clear but not sharply differentiated.

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

Usage Guidelines3/5

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

Usage is implied through a dense grammar for the 'selection' argument ('*', 'latest', 'latest:5', '2015-2020', defaults) and an example call, which tells the agent how to invoke it. However, there is no explicit statement of when to use this tool versus query_data_cube or when to first call get_bfs_table_metadata, and no when-not guidance or prerequisite note.

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