Skip to main content
Glama
rvibek

UNHCR Population Data MCP Server

get_rsd_decisions

Retrieve UNHCR Refugee Status Determination decisions data filtered by country of origin, country of asylum, and year for analysis.

Instructions

Get Refugee Status Determination (RSD) decision data from UNHCR. Args: coo: Country of origin filter (ISO3 code, comma-separated for multiple) coa: Country of asylum filter (ISO3 code, comma-separated for multiple) year: Year filter (comma-separated for multiple years) - defaults to 2025 coo_all: Set to True when analyzing decisions breakdown BY NATIONALITY coa_all: Set to True when analyzing decisions breakdown BY COUNTRY Returns: RSD decision data from UNHCR API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cooNo
coaNo
yearNo
coo_allNo
coa_allNo

Implementation Reference

  • The main handler function for the 'get_rsd_decisions' tool, registered with @server.tool(). It delegates to the UNHCRAPIClient's get_asylum_decisions method to fetch RSD decision data from the UNHCR API.
    @server.tool() def get_rsd_decisions( 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 Refugee Status Determination (RSD) decision data from UNHCR. Args: coo: Country of origin filter (ISO3 code, comma-separated for multiple) coa: Country of asylum filter (ISO3 code, comma-separated for multiple) year: Year filter (comma-separated for multiple years) - defaults to 2025 coo_all: Set to True when analyzing decisions breakdown BY NATIONALITY coa_all: Set to True when analyzing decisions breakdown BY COUNTRY Returns: RSD decision data from UNHCR API """ return api_client.get_asylum_decisions( coo=coo, coa=coa, year=year, coo_all=coo_all, coa_all=coa_all )
  • Helper method in the UNHCRAPIClient class that performs the API fetch specifically for asylum decisions (RSD decisions) using the generic _fetch method with endpoint 'asylum-decisions'.
    def get_asylum_decisions(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("asylum-decisions", coo=coo, coa=coa, year=year, coo_all=coo_all, coa_all=coa_all)
  • The core generic fetch method used by all API client methods, including get_asylum_decisions, to make HTTP requests to the UNHCR API with appropriate parameters.
    def _fetch(self, endpoint: str, coo: Optional[str] = None, coa: Optional[str] = None, year: Optional[Union[str, int]] = None, coo_all: bool = False, coa_all: bool = False, pop_type: Optional[bool] = None) -> dict[str, Any]: """ Generic function to fetch data from various UNHCR API endpoints. """ params = {"cf_type": "ISO"} if coo: params["coo"] = coo if coa: params["coa"] = coa if coo_all: params["coo_all"] = "true" if coa_all: params["coa_all"] = "true" if pop_type is True: params["pop_type"] = "true" if year is None: # Default to 2025 as per previous implementation logic params["year[]"] = "2025" else: year_str = str(year) if "," in year_str: years = [y.strip() for y in year_str.split(",")] params["year[]"] = years else: params["year[]"] = year_str url = f"{self.BASE_URL}/{endpoint}/" try: logger.info(f"Fetching UNHCR {endpoint} data with params: {params}") response = requests.get(url, params=params) response.raise_for_status() return response.json() except requests.RequestException as e: logger.error(f"Error fetching UNHCR {endpoint} data: {e}") return {"error": str(e), "status": "error"}

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/rvibek/mcp_unhcr'

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