Skip to main content
Glama
AmeliaMiddleton

moviefinder-mcp

search_tv

Search for TV shows by title using The Movie Database API.

Instructions

Search TMDB for TV shows by title.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • src/index.ts:58-73 (registration)
    Registration of the 'search_tv' tool using server.tool() with name, description, schema, and handler. It calls tmdbFetch to /search/tv and returns summarized results via summarizeList.
    server.tool(
      "search_tv",
      "Search TMDB for TV shows by title.",
      { query: z.string().min(1, "query is required") },
      async ({ query }) => {
        try {
          const data = await tmdbFetch<{ results: any[] }>("/search/tv", {
            query,
            include_adult: "false",
          });
          return jsonResult({ results: summarizeList(data.results) });
        } catch (err) {
          return errorResult(err);
        }
      }
    );
  • Handler for 'search_tv': async function that takes { query }, calls tmdbFetch to /search/tv endpoint, formats results with summarizeList, and returns JSON content or an error.
    async ({ query }) => {
      try {
        const data = await tmdbFetch<{ results: any[] }>("/search/tv", {
          query,
          include_adult: "false",
        });
        return jsonResult({ results: summarizeList(data.results) });
      } catch (err) {
        return errorResult(err);
      }
    }
  • Input schema for 'search_tv': expects a required string 'query' validated via Zod (z.string().min(1)).
    { query: z.string().min(1, "query is required") },
  • The tmdbFetch helper that makes authenticated HTTP requests to TMDB API. Used by the search_tv handler to call /search/tv.
    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;
    }
  • The summarizeList helper used to format and limit search results returned by search_tv.
    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?

No annotations are present, so the description carries full responsibility for behavioral disclosure. It merely states the action without mentioning pagination, language constraints, result limits, or any other behavioral traits beyond the basic search function.

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

Conciseness5/5

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

The description is a single sentence that is front-loaded with the essential purpose. Every word earns its place, and there is no extraneous information.

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?

For a simple search tool with one parameter and no output schema, the description is minimally adequate. However, it lacks context on result format, sorting, or any filtering parameters, which would enhance completeness given the lack of annotations.

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

Parameters2/5

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

The single parameter 'query' is only specified in the schema with a minLength constraint. The description does not add any semantics (e.g., case sensitivity, fuzzy matching, language) beyond what the schema provides, and schema description coverage is 0%.

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 action ('Search'), the resource ('TMDB for TV shows'), and the method ('by title'). It directly differentiates from the sibling 'search_movies' tool, which searches movies instead of TV shows.

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 such as 'discover_movies' or 'get_trending'. There is no mention of when not to use it or any prerequisites.

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