Skip to main content
Glama

Imf Query Dataset

imf_query_dataset
Read-onlyIdempotent

Query an IMF SDMX dataflow by dimension key over a time range. Returns observations with time_period, value, and status, plus the unit, scale, and decimals of each series — a key resolving to several series carries one entry per series in series_metadata, since unit and scale differ between them. Requires imf_get_database first to obtain the correct key_format and valid dimension codes. Country codes are ISO 3-letter (USA, GBR, DEU — not US, GB, DE). Key format: dot-separated codes in DSD keyPosition order (e.g. USA.NGDP_RPCH.A for WEO). Every position must carry a code: use + to combine codes (e.g. USA+GBR.NGDP_RPCH.A) and * to match every code at a position (e.g. *.NGDP_RPCH.A for all countries). Codelists from imf_get_database enumerate the code universe, not actual coverage — valid codes can still return no_data if the combination has no series. start_period and end_period must be valid period strings (YYYY, YYYY-SN, YYYY-QN, YYYY-MM, or a calendar-valid YYYY-MM-DD) with start_period no later than end_period; malformed or reversed ranges are rejected. A bound covers the whole period it names, so end_period 2023 includes 2023-M12 and 2023-Q4. Large analytical result sets (multi-country, long time range) spill to DataCanvas; call imf_dataframe_describe first to inspect staged tables and columns, then imf_dataframe_query for SQL analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesDot-separated dimension codes in DSD keyPosition order. Call imf_get_database to get key_format and valid codes first. Use + to combine codes at one position (e.g. USA+GBR.NGDP_RPCH.A). Use * to match every code at a position — *.NGDP_RPCH.A returns the indicator for all countries, and CAN.*.A every indicator for Canada. Every position needs a code or a *; an empty segment (USA..A) is rejected. Country codes are ISO 3-letter: USA not US, GBR not GB, DEU not DE.
versionNoDataflow version. Auto-detected from dataflow list when omitted.
agency_idNoAgency ID, e.g. IMF.RES or IMF.STA. Auto-detected from dataflow list when omitted.
canvas_idNoExisting canvas ID to accumulate results into across multiple queries. This selects the destination only; it does not force staging. Use output_mode="canvas" to stage an under-budget result.
end_periodNoEnd of time range (inclusive). Same formats as start_period, and must not be earlier than it. The bound covers the whole period it names, so end_period 2023 admits 2023-M12 and 2023-Q4. Observations after this period are excluded from the result.
dataflow_idYesDataflow identifier from imf_list_databases, e.g. WEO, BOP, CPI.
output_modeNoResult placement. auto returns an under-budget result inline and spills only when needed. canvas explicitly stages the full result, using canvas_id when supplied or allocating a fresh canvas.auto
start_periodNoStart of time range (inclusive). Accepts any of YYYY (annual), YYYY-SN (semi-annual, e.g. 2023-S1), YYYY-QN (quarterly, e.g. 2023-Q1), YYYY-MM (monthly), or a calendar-valid YYYY-MM-DD (daily), whatever the dataflow's frequency. The bound covers the whole period it names, so start_period 2023 admits 2023-M01 and 2023-Q1. Observations before this period are excluded from the result.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoDimension key used in the query, e.g. USA.NGDP_RPCH.A.
errorNoPresent when the call failed. Absent on success.
noticeNoPopulated when a period bound was set but some observations carry a time_period label the range filter does not recognize. Composes with staged retrieval_guidance when both apply.
sourceNoAttribution string required by IMF data terms: "Source: International Monetary Fund, <dataflow name>, <link>".
stagedNoTrue when the complete observation set is stored on DataCanvas. canvas_id and table_name are present whenever true.
canvas_idNoDataCanvas session ID — present when staged=true. Pass first to imf_dataframe_describe, then to imf_dataframe_query.
truncatedNoTrue only when observations is an incomplete preview of observation_count. A result can be staged=true and truncated=false when every observation also fits inline.
end_periodNoLatest period covered; absent when the full available range was used.
table_nameNoDuckDB table name on the canvas — present when staged=true; reference in SQL via FROM <table_name>.
dataflow_idNoDataflow identifier that was queried, e.g. WEO.
observationsNoInline observation preview. For staged results this may contain the full set or a budget-limited prefix; observation_count remains the full count.
start_periodNoEarliest period covered; absent when the full available range was used.
series_metadataNoPer-series attributes, one entry per distinct series_key in the result. Present only when the query resolved to more than one series; a single-series query carries its values in series_attributes instead. Unit and scale differ across series in one query — WEO NGDPD is USD at scale 9 while NGDP_RPCH is PT unscaled — so interpret each series against its own entry.
observation_countNoTotal observations in the result.
series_attributesNoAttributes of the first series in the result — the same series as series_metadata[0]. A key with + or * resolves to several series whose scale and unit differ, and this field describes only the first of them: read series_metadata for the rest, and never apply these values to another series_key.
retrieval_guidanceNoPresent on every staged result. Identifies the imf_dataframe_describe-before-imf_dataframe_query retrieval workflow.

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already mark readOnly/openWorld/idempotent; the description adds substantial non-obvious behavior: a key resolving to several series produces one series_metadata entry per series, valid codes can return no_data, malformed or reversed period ranges are rejected, and large results spill to DataCanvas. No contradiction with annotations.

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 description is front-loaded with the core purpose and return shape, then progresses through prerequisites, key syntax, period rules, and spill behavior in a logical order. It is dense and useful, though several sentences restate material already present in the rich input-schema descriptions.

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

Completeness5/5

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

Covers prerequisites, key construction rules, period validation and inclusivity, no_data outcomes, output routing, and the downstream DataCanvas analysis path. With an output schema present for return values, nothing essential for calling the tool correctly is missing.

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% with detailed parameter descriptions, so baseline is 3. The description adds meaningful extras: the imf_get_database dependency, the code-universe-versus-actual-coverage caveat, and inclusive-bound period semantics. Some key-format and period details duplicate the schema, limiting the additional value.

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?

Opens with a specific verb and object — 'Query an IMF SDMX dataflow by dimension key over a time range' — and specifies the return contents (observations with time_period, value, status, unit, scale, decimals). This clearly distinguishes it from sibling metadata and dataframe tools.

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?

Explicitly states the prerequisite: 'Requires imf_get_database first to obtain the correct key_format and valid dimension codes.' It also routes large analytical results to imf_dataframe_describe and imf_dataframe_query, giving the agent a clear decision path versus siblings.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.6/5.0
Disambiguation5/5

Each tool has a clearly distinct role: discovering dataflows, inspecting dimensions/codelists, querying SDMX data, and analyzing staged DataCanvas tables. The two query-like tools are separated by their data source (live SDMX vs. staged results), and the descriptions reinforce the required sequencing.

Naming Consistency4/5

The imf_ prefix and snake_case convention are consistent, and most tools follow verb_noun naming (list_databases, get_database, query_dataset). However, imf_dataframe_describe and imf_dataframe_query place the object before the verb, deviating slightly from the otherwise predictable pattern.

Tool Count5/5

Five tools is well-scoped for a read-only IMF data access server. Each tool covers a necessary stage in the workflow without redundancy or bloat.

Completeness5/5

The tool set covers the full read-only lifecycle: discover dataflows, inspect required dimension codes, query series, and analyze large result sets via SQL. No obvious gaps exist for the stated purpose, and write operations are not relevant to this domain.