movie_credits
Fetch cast and crew credits for any movie using its TMDB ID to support movie analysis and AI-powered recommendations.
Instructions
Fetches cast and crew credits for a movie. Input: movie_id (required TMDB ID), language (optional ISO 639-1 code). Output: JSON with cast and crew details. Purpose: Retrieve detailed personnel information for movie analysis and recommendations by AI agents.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | ISO 639-1 code (e.g., en-US) | |
| movie_id | Yes | TMDB Movie ID |
Implementation Reference
- mcp-tmdb-server.js:197-200 (handler)The handler function executes the core logic of the movie_credits tool by calling the TMDB API endpoint for movie credits and returning the JSON-formatted response.handler: async ({movie_id, language}) => { const data = await tmdbFetch(`/movie/${movie_id}/credits`, {language}); return {content: [{type: "text", text: JSON.stringify(data, null, 2)}]}; }
- mcp-tmdb-server.js:188-196 (schema)The inputSchema defines the expected parameters for the movie_credits tool: required movie_id (number) and optional language (string).inputSchema: { type: "object", properties: { movie_id: {type: "number", description: "TMDB Movie ID"}, language: {type: "string", description: "ISO 639-1 code (e.g., en-US)"} }, required: ["movie_id"], additionalProperties: false },
- mcp-tmdb-server.js:185-201 (registration)The complete tool registration object for movie_credits in the tools array, binding name, description, schema, and handler for MCP server registration.{ name: "movie_credits", description: "Fetches cast and crew credits for a movie. Input: movie_id (required TMDB ID), language (optional ISO 639-1 code). Output: JSON with cast and crew details. Purpose: Retrieve detailed personnel information for movie analysis and recommendations by AI agents.", inputSchema: { type: "object", properties: { movie_id: {type: "number", description: "TMDB Movie ID"}, language: {type: "string", description: "ISO 639-1 code (e.g., en-US)"} }, required: ["movie_id"], additionalProperties: false }, handler: async ({movie_id, language}) => { const data = await tmdbFetch(`/movie/${movie_id}/credits`, {language}); return {content: [{type: "text", text: JSON.stringify(data, null, 2)}]}; } },
- mcp-tmdb-server.js:18-38 (helper)The tmdbFetch helper function used by the movie_credits handler to make authenticated API requests to TMDB.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(); }