Skip to main content
Glama
drakonkat

wizzy-mcp-tmdb

search_tmdb

Search The Movie Database for films, TV series, and actors to find detailed information and content discovery for AI-driven queries.

Instructions

Performs a multi-type search across TMDB for movies, TV shows, and people. Input: query (required search string), page (optional 1-1000), language (optional ISO 639-1), include_adult (optional boolean), region (optional ISO 3166-1). Output: JSON with paginated normalized results (id, media_type, title, date, etc.). Purpose: Enable comprehensive content discovery for AI-driven queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_adultNoInclude adult results
languageNoISO 639-1 code (e.g., en-US)
pageNoPage number (1-1000)
queryYesSearch text query
regionNoISO 3166-1 code (e.g., US)

Implementation Reference

  • The core handler function for the 'search_tmdb' tool. It validates the query input, fetches multi-search results from TMDB's /search/multi endpoint, normalizes the results using mapSearchResult, and returns a formatted JSON response wrapped in MCP content.
    handler: async ({query, page, language, include_adult, region}) => {
        if (!query || typeof query !== "string") {
            throw new Error("query must be a non-empty string");
        }
        const data = await tmdbFetch("/search/multi", {query, page, language, include_adult, region});
        const results = Array.isArray(data.results) ? data.results.map(mapSearchResult) : [];
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify({
                        page: data.page,
                        total_pages: data.total_pages,
                        total_results: data.total_results,
                        results
                    }, null, 2),
                },
            ],
        };
    },
  • The input schema for the 'search_tmdb' tool, defining the expected parameters, types, descriptions, and validation rules.
    inputSchema: {
        type: "object",
        properties: {
            query: {type: "string", description: "Search text query"},
            page: {type: "number", minimum: 1, description: "Page number (1-1000)"},
            language: {type: "string", description: "ISO 639-1 code (e.g., en-US)"},
            include_adult: {type: "boolean", description: "Include adult results"},
            region: {type: "string", description: "ISO 3166-1 code (e.g., US)"},
        },
        required: ["query"],
        additionalProperties: false,
    },
  • Helper function used by the search_tmdb handler (and similar tools) to normalize TMDB search results into a compact format with id, media_type, title, date, etc., for easier AI consumption.
    function mapSearchResult(item) {
        const media_type = item.media_type || (item.title ? "movie" : item.name ? "tv" : "unknown");
        const title = item.title || item.name || "";
        const date = item.release_date || item.first_air_date || "";
        return {
            id: item.id,
            media_type,
            title,
            date,
            original_language: item.original_language,
            popularity: item.popularity,
            vote_average: item.vote_average,
            overview: item.overview,
        };
    }
  • The MCP server request handler for tool calls. It looks up the tool by name from the 'tools' array (which includes search_tmdb), executes its handler, handles logging and errors, and returns the result. This registers all tools including search_tmdb for invocation.
    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;
        }
    });
  • Core helper function for making authenticated API requests to TMDB, used by the search_tmdb handler to fetch data from /search/multi.
    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();
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the output format ('JSON with paginated normalized results') and that it's for 'AI-driven queries,' but doesn't cover important behavioral aspects like rate limits, authentication requirements, error handling, or what 'normalized results' specifically means. The description adds some value but leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with three sentences: what it does, input/output details, and purpose. It's appropriately sized and front-loaded with the core functionality. The parameter listing could be slightly more concise, but overall it avoids unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and parameters but lacks details about the response structure (beyond 'JSON with paginated normalized results'), error conditions, rate limits, or authentication requirements that would help an agent use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all 5 parameters. The description lists the parameters but adds minimal semantic value beyond what's in the schema (e.g., 'optional 1-1000' for page is already in schema with minimum constraint). It doesn't explain relationships between parameters or provide usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs a 'multi-type search across TMDB for movies, TV shows, and people' with the purpose of 'enabling comprehensive content discovery.' It specifically distinguishes itself from sibling tools like search_tmdb_movies, search_tmdb_tv, and search_tmdb_person by covering all three media types in one operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool: for 'comprehensive content discovery' across multiple media types. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the many sibling tools (e.g., when you only need movies, use search_tmdb_movies instead).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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