Skip to main content
Glama
AmeliaMiddleton

moviefinder-mcp

get_recommendations

Retrieve movie recommendations based on a specific movie's ID.

Instructions

Get TMDB recommendations for a given movie.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
movie_idYes

Implementation Reference

  • src/index.ts:91-105 (registration)
    The 'get_recommendations' tool is registered via server.tool() with a Zod schema for movie_id (positive integer). The handler calls TMDB /movie/{movie_id}/recommendations and returns summarized results.
    server.tool(
      "get_recommendations",
      "Get TMDB recommendations for a given movie.",
      { movie_id: z.number().int().positive() },
      async ({ movie_id }) => {
        try {
          const data = await tmdbFetch<{ results: any[] }>(
            `/movie/${movie_id}/recommendations`
          );
          return jsonResult({ results: summarizeList(data.results) });
        } catch (err) {
          return errorResult(err);
        }
      }
    );
  • The handler function that executes the tool logic: fetches recommendations from TMDB API and summarizes the list.
      "get_recommendations",
      "Get TMDB recommendations for a given movie.",
      { movie_id: z.number().int().positive() },
      async ({ movie_id }) => {
        try {
          const data = await tmdbFetch<{ results: any[] }>(
            `/movie/${movie_id}/recommendations`
          );
          return jsonResult({ results: summarizeList(data.results) });
        } catch (err) {
          return errorResult(err);
        }
      }
    );
  • tmdbFetch is the helper used by the handler to make the API call to TMDB.
    export async function tmdbFetch<T = unknown>(
      path: string,
      query: Record<string, string | number | undefined> = {}
    ): Promise<T> {
      const url = new URL(BASE_URL + path);
      for (const [k, v] of Object.entries(query)) {
        if (v !== undefined && v !== null && v !== "") {
          url.searchParams.set(k, String(v));
        }
      }
    
      const res = await fetch(url, {
        headers: {
          Authorization: `Bearer ${getToken()}`,
          Accept: "application/json",
        },
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => "");
        if (res.status === 401) {
          throw new TmdbError(
            "TMDB rejected the request (401). Check that TMDB_API_KEY is your v4 read access token, not a v3 API key.",
            401
          );
        }
        if (res.status === 404) {
          throw new TmdbError(
            `TMDB resource not found (404) for ${path}. Verify the ID exists.`,
            404
          );
        }
        if (res.status === 429) {
          const retry = res.headers.get("retry-after");
          throw new TmdbError(
            `TMDB rate limit exceeded (429).${retry ? ` Retry after ${retry}s.` : " Slow down requests and retry."}`,
            429
          );
        }
        throw new TmdbError(
          `TMDB request failed (${res.status}) for ${path}: ${text || res.statusText}`,
          res.status
        );
      }
    
      return (await res.json()) as T;
    }
  • summarizeList transforms raw API results into a summarized format (used by the handler to format output).
    export function summarizeList(items: RawMovie[] | undefined, limit = 20) {
      return (items ?? []).slice(0, limit).map(summarizeMovie);
    }
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It only states it 'gets recommendations', but does not mention whether this is a read-only operation, any required permissions, or what the recommendations are based on (e.g., TMDB algorithm). The agent gains little insight into side effects or constraints.

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 a single, short sentence with no wasted words. However, it is so terse that it omits essential context, which reduces its value for concise communication.

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

Completeness2/5

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

Given the absence of an output schema and the single parameter, the description should at least outline what the recommendations consist of or how they are generated. It fails to provide enough context for an agent to understand the tool's capabilities fully.

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?

The input schema has 0% coverage (no descriptions). The description does not explain the 'movie_id' parameter beyond what the schema provides (integer, >0). It does not clarify where to obtain the ID or what it represents (e.g., TMDB movie ID).

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

Purpose4/5

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

The description clearly states it gets recommendations for a given movie, using a specific verb and resource. However, it does not explicitly distinguish from the sibling tool 'get_similar', which could cause confusion about the difference between recommendations and similar movies.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'get_similar' or 'discover_movies'. The description lacks any context about typical use cases or exclusion criteria.

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/AmeliaMiddleton/Php1mcp'

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