Skip to main content
Glama

compare_countries

Compare health indicators across countries, regions, or income groups for a specified year range. Returns tidy data or CSV with auto-resolved codes and names.

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 per sex when disaggregated). 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. With the default top=1000 and chunk_size=10 this gives ~100 rows per spatial unit, enough headroom that $orderby=SpatialDim,TimeDim desc will not starve later codes in a chunk before latest_only filtering. 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
indicator_codeYes
countriesNo
country_groupNo
year_startNo
year_endNo
sexNo
dim_filtersNo
latest_onlyNo
topNo
formatNorows

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description fully covers behavioral details: auto-resolution of codes, automatic chunking for large country sets (with rationale and performance notes), parameter constraints (e.g., dim_filters vs sex), and output format options. It even explains internal mechanics like chunk_count and parallel asyncio.

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 a concise summary, followed by structured details and an 'Args:' section. While somewhat lengthy (justified by 10 parameters), every sentence adds value and there is no redundant information.

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?

Given the tool's complexity (10 parameters, auto-resolution, chunking), the description covers all essential aspects: purpose, parameters, behavior, output format, and limitations (HTTP 400). The presence of an output schema means return values do not need to be detailed, making the description complete.

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. It does so excellently with a detailed 'Args:' section providing examples (e.g., indicator_code 'WHOSIS_000001'), valid values for countries (ISO3, region codes, income groups), and constraints like dim_filters cannot include Dim1 if sex is passed. This adds substantial meaning beyond the 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 description clearly states the tool retrieves data for 'One indicator × N spatial units × year range' and returns tidy rows or CSV. It positions itself as 'workhorse for comparative analysis', distinguishing it from simpler siblings like get_indicator_data by highlighting auto-resolution and chunking.

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?

The description implies use for comparative analysis but lacks explicit guidance on when not to use it or alternatives. It does not mention sibling tools or scenarios where a simpler tool like get_indicator_data would suffice.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Decilion/gho-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server