get_countries
Retrieve a complete list of all countries available in the IMDb database for filtering or reference purposes.
Instructions
Get all countries. Returns: JSON object containing all countries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/imdb_mcp_server/tools.py:173-183 (handler)The handler function implementing the get_countries tool. It makes an API request to fetch countries data from the IMDb API endpoint and returns it as a formatted JSON string.@mcp.tool() async def get_countries(ctx: Context) -> str: """Get all countries. Returns: JSON object containing all countries. """ countries_url = f"{BASE_URL}/countries" countries_data = await make_imdb_request(countries_url, {}, ctx) if not countries_data: return "Unable to fetch countries data." return json.dumps(countries_data, indent=4)
- src/imdb_mcp_server/main.py:23-23 (registration)The call to register_tools which defines and registers the get_countries tool (along with others) on the MCP server instance.register_tools(server)
- src/imdb_mcp_server/tools.py:51-51 (schema)Schema parameter in search_imdb tool referencing get_countries for possible country codes (ISO 3166-1 alpha-2).countries_of_origin: The countries of origin of the movie to search for. In ISO 3166-1 alpha-2 format list of strings. Get all possible countries with get_countries().
- src/imdb_mcp_server/api.py:14-14 (helper)Helper function used by get_countries to make authenticated requests to the IMDb API, with caching support.async def make_imdb_request(url: str, querystring: dict[str, Any], ctx: Optional[Context] = None) -> Optional[Dict[str, Any]]: