get_population_data
Retrieve UNHCR data on forcibly displaced populations including refugees, asylum seekers, and stateless persons by country of origin, asylum, and year.
Instructions
Get forcibly displaced populations like refugees, asylum seekers, stateless persons data from UNHCR.
Args:
coo: Country of origin (ISO3 code) - Use for questions about refugees FROM a specific country
coa: Country of asylum (ISO3 code) - Use for questions about refugees IN a specific country
year: Year to filter by (defaults to 2025)
coo_all: Set to True when breaking down results by ORIGIN country
coa_all: Set to True when breaking down results by ASYLUM country
Returns:
Population data from UNHCR API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coo | No | ||
| coa | No | ||
| year | No | ||
| coo_all | No | ||
| coa_all | No |
Implementation Reference
- src/unhcr_mcp/server.py:124-147 (handler)The primary handler function for the get_population_data MCP tool. It is registered via the @server.tool() decorator and delegates to the UNHCRAPIClient.get_population helper method to fetch data from the UNHCR API.def get_population_data( coo: str | None = None, coa: str | None = None, year: str | int | None = None, coo_all: bool = False, coa_all: bool = False, ) -> dict[str, Any]: """ Get forcibly displaced populations like refugees, asylum seekers, stateless persons data from UNHCR. Args: coo: Country of origin (ISO3 code) - Use for questions about refugees FROM a specific country coa: Country of asylum (ISO3 code) - Use for questions about refugees IN a specific country year: Year to filter by (defaults to 2025) coo_all: Set to True when breaking down results by ORIGIN country coa_all: Set to True when breaking down results by ASYLUM country Returns: Population data from UNHCR API """ return api_client.get_population( coo=coo, coa=coa, year=year, coo_all=coo_all, coa_all=coa_all )
- src/unhcr_mcp/server.py:80-83 (helper)Supporting helper method in the UNHCRAPIClient class that performs the actual API fetch for population data by calling the generic _fetch method with the 'population' endpoint.def get_population(self, coo: Optional[str] = None, coa: Optional[str] = None, year: Optional[Union[str, int]] = None, coo_all: bool = False, coa_all: bool = False) -> dict[str, Any]: return self._fetch("population", coo=coo, coa=coa, year=year, coo_all=coo_all, coa_all=coa_all)