Skip to main content
Glama

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

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • 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)
  • The call to register_tools which defines and registers the get_countries tool (along with others) on the MCP server instance.
    register_tools(server)
  • 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().
  • 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]]:

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/uzaysozen/imdb-mcp-server'

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