Skip to main content
Glama
drakonkat

wizzy-mcp-tmdb

movie_reviews

Retrieve user reviews and ratings for movies to analyze public opinions and critiques for sentiment analysis.

Instructions

Retrieves user reviews and ratings for a movie. Input: movie_id (required TMDB ID), language (optional ISO 639-1 code), page (optional), region (optional ISO 3166-1 code). Output: JSON with paginated review results. Purpose: Access public opinions and critiques for sentiment analysis by AI agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoISO 639-1 code (e.g., en-US)
movie_idYesTMDB Movie ID
pageNoPage number
regionNoISO 3166-1 region code (e.g., US)

Implementation Reference

  • The handler function that implements the core logic of the movie_reviews tool by fetching user reviews from the TMDB API endpoint `/movie/{movie_id}/reviews` and returning the paginated JSON results as MCP-formatted text content.
    handler: async ({movie_id, language, page, region}) => {
        const data = await tmdbFetch(`/movie/${movie_id}/reviews`, {language, page, region});
        return {content: [{type: "text", text: JSON.stringify(data, null, 2)}]};
    }
  • The inputSchema defining the expected parameters and validation rules for the movie_reviews tool, including required movie_id and optional language, page, and region.
    inputSchema: {
        type: "object",
        properties: {
            movie_id: {type: "number", description: "TMDB Movie ID"},
            language: {type: "string", description: "ISO 639-1 code (e.g., en-US)"},
            page: {type: "number", minimum: 1, description: "Page number"},
            region: {type: "string", description: "ISO 3166-1 region code (e.g., US)"}
        },
        required: ["movie_id"],
        additionalProperties: false
    },
  • The tmdbFetch helper utility function used by the movie_reviews handler (and other tools) to make authenticated API requests to the TMDB proxy service.
    async function tmdbFetch(path, params = {}) {
        if (!TMDB_AUTH_TOKEN) {
            throw new Error("TMDB authorization token is not configured");
        }
        const url = new URL(TMDB_BASE + path);
        Object.entries(params).forEach(([k, v]) => {
            if (v !== undefined && v !== null && v !== "") url.searchParams.set(k, String(v));
        });
    
        const res = await fetch(url, {
            headers: {
                Accept: "application/json",
                Authorization: TMDB_AUTH_TOKEN,
            },
        });
        if (!res.ok) {
            const text = await res.text().catch(() => "");
            throw new Error(`TMDB request failed ${res.status}: ${text}`);
        }
        return res.json();
    }
  • Registration of the ListToolsRequestHandler which exposes the movie_reviews tool (along with others) via the tools.map, providing name, description, and inputSchema to MCP clients.
    server.setRequestHandler(ListToolsRequestSchema, async (_req) => ({
        tools: tools.map(({name, description, inputSchema}) => ({name, description, inputSchema})),
    }));
  • Registration of the CallToolRequestHandler which dispatches calls to the movie_reviews tool's handler by finding it in the tools array by name and executing it with the provided arguments.
    server.setRequestHandler(CallToolRequestSchema, async (req) => {
        const {name, arguments: args} = req.params || {};
        const tool = tools.find(t => t.name === name);
        if (!tool) {
            await sendLog("error", `Unknown tool called: ${name || "<missing>"} with args: ${JSON.stringify(args || {})}`);
            throw new Error(`Unknown tool: ${name}`);
        }
        await sendLog("info", `Calling tool: ${name} with args: ${JSON.stringify(args || {})}`);
        try {
            const start = Date.now();
            const res = await tool.handler(args || {});
            const ms = Date.now() - start;
            await sendLog("info", `Tool success: ${name} in ${ms}ms`);
            return res;
        } catch (err) {
            await sendLog("error", `Tool error: ${name} -> ${err && err.message ? err.message : String(err)}`);
            throw err;
        }
    });

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/drakonkat/wizzy-mcp-tmdb'

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