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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/imdb_mcp_server/tools.py:160-170 (handler)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)
- src/imdb_mcp_server/tools.py:160-170 (registration)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)
- src/imdb_mcp_server/main.py:22-23 (registration)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)
- src/imdb_mcp_server/main.py:61-61 (registration)Call to register_tools(server) in stdio mode, registering all tools including get_genres.register_tools(server)