Skip to main content
Glama

compare_countries

Compare health indicators across countries, regions, or income groups for a given period, with filtering by sex and other dimensions, output as rows or CSV.

Instructions

One indicator × N spatial units × year range, returned as tidy rows or CSV.

Workhorse for comparative analysis. Country names, ISO3 codes, region codes, and income-group codes all auto-resolve. Row labels resolve human titles for regions and income groups, not just countries.

For large country sets (e.g. country_group="LAC" with 33 sovereign states), the request is automatically chunked into multiple parallel HTTP calls of up to 10 spatial units each, then merged. This avoids the HTTP 400 the GHO API returns when an $filter carries too many SpatialDim eq '...' or ... clauses. The number of underlying requests is returned as chunk_count and chunks run in parallel via asyncio.

Args: indicator_code: e.g. "WHOSIS_000001". countries: List of ISO3 codes, country names, region codes (AFR/AMR/SEAR/EUR/EMR/WPR/GLOBAL), or income-group codes (WB_HI/WB_UMI/WB_LMI/WB_LI). country_group: Curated grouping code (e.g. "LAC", "OECD", "LDC", "SSA"). Resolves to ISO3 members and merges with countries if both are passed. See list_curated_country_groups for available groups. year_start: Inclusive lower bound on year. year_end: Inclusive upper bound on year. sex: "BTSX"/"both", "MLE"/"male", "FMLE"/"female", or raw SEX_* codes. dim_filters: Extra dimension filters as {field: value}, e.g. {"Dim2": "WEALTHQUINTILE_QUINTILE5"}. Use describe_indicator_dimensions first to discover available types and values. Cannot include "Dim1" if sex is also passed. latest_only: If true, keep only the most recent year per spatial unit and full dimension combination, preserving every population. top: Per-request row cap, default 1000, max 5000. Applied to each chunk of ≤10 spatial units, so the merged total may reach top × chunk_count. This is not a per-country allowance: an earlier country can consume a chunk and omit later countries. Check missing_requested_codes and truncation flags. format: "rows" (default) returns a list of dicts under the "rows" key; "csv" returns a CSV string under the "csv" key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sexNo
topNo
formatNorows
year_endNo
countriesNo
year_startNo
dim_filtersNo
latest_onlyNo
country_groupNo
indicator_codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: automatic chunking into parallel HTTP calls, the chunk_count return value, top being applied per chunk rather than per country, truncation and missing_requested_codes flags, and exact format behavior. It also warns about the HTTP 400 limitation and clarifies latest_only semantics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but densely informative; every section adds operational value. The core one-line summary is front-loaded, followed by chunking caveats and then a clean Args block with no filler.

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?

For a 10-parameter tool with 0% schema coverage and no annotations, the description covers parameter meanings, prerequisites, edge cases, and output formats. Since an output schema exists, not listing return fields is acceptable; nothing needed to invoke it correctly is missing.

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?

Although schema description coverage is 0%, the Args section documents all 10 parameters with concrete examples, accepted value families, cross-parameter constraints (e.g., Dim1 cannot be used with sex), and per-chunk semantics for top. This fully compensates for the bare schema.

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?

The opening line 'One indicator × N spatial units × year range, returned as tidy rows or CSV' precisely defines the tool's resource and output, and 'Workhorse for comparative analysis' states its role. The multi-spatial-unit scope and auto-resolution of country/region/income codes distinguish it from single-country sibling tools.

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?

The description gives clear usage context: it is the workhorse for comparative analysis, recommends calling describe_indicator_dimensions before using dim_filters, and points to list_curated_country_groups for available groups. It also explains when chunking kicks in for large country sets, but it does not explicitly name alternative tools for single-country or raw data needs.

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