Skip to main content
Glama

get_genres

Retrieve all available movie and TV show genres from IMDb data to categorize content and filter search results.

Instructions

Get all genres. Returns: JSON object containing all genres.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

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

Implementation Reference

  • The handler function for the 'get_genres' tool. It makes an API request to fetch all genres from IMDb and returns them as a formatted JSON string. No input parameters required besides the context.
    @mcp.tool() async def get_genres(ctx: Context) -> str: """Get all genres. Returns: JSON object containing all genres. """ genres_url = f"{BASE_URL}/genres" genres_data = await make_imdb_request(genres_url, {}, ctx) if not genres_data: return "Unable to fetch genres data." return json.dumps(genres_data, indent=4)
  • The tool is registered using the @mcp.tool() decorator within the register_tools function, which is called from main.py.
    @mcp.tool() async def get_genres(ctx: Context) -> str: """Get all genres. Returns: JSON object containing all genres. """ genres_url = f"{BASE_URL}/genres" genres_data = await make_imdb_request(genres_url, {}, ctx) if not genres_data: return "Unable to fetch genres data." return json.dumps(genres_data, indent=4)
  • Call to register_tools(server) in create_server() function, which registers all tools including get_genres.
    # Register all tools with the server register_tools(server)
  • Call to register_tools(server) in stdio mode, registering all tools including get_genres.
    register_tools(server)

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