Skip to main content
Glama
resource-templates.ts1.18 kB
import { getMovieDetails } from './tmdb-api.js'; export const resourceTemplates = [ { uriTemplate: "tmdb://movie/{id}", name: "Movie Details", description: "Get details about a specific movie by ID", mimeType: "application/json", }, ]; const movieDetailsExp = /^tmdb:\/\/movie\/(\d+)$/; export const getResourceTemplate = async (uri: string) => { const movieMatch = uri.match(movieDetailsExp); if (movieMatch) { const movieId = movieMatch[1]; return async () => { try { // Get the raw movie details from your API const movieDetails = await getMovieDetails(movieId); // Return in the correct format expected by the MCP SDK return { contents: [ { uri, text: JSON.stringify(movieDetails, null, 2), // This should be the raw movie data }, ], }; } catch (error: unknown) { if (error instanceof Error) { throw new Error(`Failed to fetch movie details: ${error.message}`); } throw new Error('Failed to fetch movie details: Unknown error'); } }; } return null; };

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/ShubhanshuSondhiya/MCP-TMDB'

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