Skip to main content
Glama
tonderflash

Movie Search MCP Server

by tonderflash

recommend_movies

Discover personalized movie recommendations based on your preferred genre. Input a genre like action, comedy, or drama to receive curated film suggestions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genreNoMovie genre (optional). Examples: action, comedy, drama, horror, sci-fi, romance

Implementation Reference

  • Full tool definition including registration, input schema (zod), and handler logic for 'recommend_movies'. The handler fetches recommendations via helper and formats markdown response.
    server.tool(
      "recommend_movies",
      {
        genre: z
          .string()
          .optional()
          .describe(
            "Movie genre (optional). Examples: action, comedy, drama, horror, sci-fi, romance"
          ),
      },
      async ({ genre }) => {
        try {
          const recommendations = await getMovieRecommendations(genre);
    
          if (recommendations.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `āŒ No recommendations found${
                    genre ? ` for genre "${genre}"` : ""
                  }.`,
                },
              ],
            };
          }
    
          let response = `šŸŽÆ **Movie recommendations${
            genre ? ` for ${genre}` : " (popular)"
          }:**\n\n`;
    
          recommendations.forEach((movie, index) => {
            response += `${index + 1}. **${movie.title}** (${movie.year})\n`;
            response += `   - TMDb ID: ${movie.id}\n`;
            if (movie.poster !== "N/A") {
              response += `   - Poster: ${movie.poster}\n`;
            }
            response += "\n";
          });
    
          response +=
            '\nšŸ’” *Use "get_movie_details" with the ID and source "tmdb" for more information.*';
    
          return {
            content: [
              {
                type: "text",
                text: response,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `āŒ Error getting recommendations: ${
                  error instanceof Error ? error.message : "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Core helper function implementing the movie recommendation logic using TMDb API. Supports genre filtering via discover endpoint or falls back to popular movies. Maps results to standardized SearchResult format.
    export async function getMovieRecommendations(
      genre?: string
    ): Promise<SearchResult[]> {
      if (!TMDB_API_KEY) {
        return [];
      }
    
      try {
        let endpoint = `${TMDB_BASE_URL}/movie/popular`;
        const params = new URLSearchParams({
          api_key: TMDB_API_KEY,
          language: "en-US",
          page: "1",
        });
    
        if (genre) {
          // Basic genre mapping
          const genreMap: { [key: string]: string } = {
            action: "28",
            adventure: "12",
            animation: "16",
            comedy: "35",
            crime: "80",
            documentary: "99",
            drama: "18",
            family: "10751",
            fantasy: "14",
            history: "36",
            horror: "27",
            music: "10402",
            mystery: "9648",
            romance: "10749",
            "science fiction": "878",
            "sci-fi": "878",
            thriller: "53",
            war: "10752",
            western: "37",
          };
    
          const genreId = genreMap[genre.toLowerCase()];
          if (genreId) {
            endpoint = `${TMDB_BASE_URL}/discover/movie`;
            params.append("with_genres", genreId);
          }
        }
    
        const response = await fetch(`${endpoint}?${params}`);
        const data = (await response.json()) as TMDbSearchResult;
    
        return data.results.slice(0, 10).map((movie) => ({
          title: movie.title,
          year: movie.release_date ? movie.release_date.split("-")[0] : "",
          id: movie.id.toString(),
          type: "movie",
          poster: movie.poster_path
            ? `https://image.tmdb.org/t/p/w500${movie.poster_path}`
            : "N/A",
          source: "tmdb" as const,
        }));
      } catch (error) {
        console.error("Error getting movie recommendations:", error);
        return [];
      }
    }
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

Related 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/tonderflash/movie-mcp'

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