Skip to main content
Glama
moria97
by moria97

search-movie

Search for movies and TV shows on Douban using keywords to find titles, details, and related content.

Instructions

search movies or tvs from douban by query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesquery string, e.g. "python"

Implementation Reference

  • The MCP tool handler function for 'search-movie'. It validates the query parameter, fetches movies using the searchMovies helper, formats the results into a markdown table using json2md, and returns the content as text.
    async (args) => {
      if (!args.q) {
        throw new McpError(ErrorCode.InvalidParams, "q must be provided")
      }
    
      const movies = await searchMovies(args)
      const text = json2md({
        table: {
          headers: ['title', 'subtitle', 'publish_date', 'rating', 'id'],
          rows: movies.map(_ => ({
            id: _.id,
            title: _.title,
            subtitle: _.card_subtitle,
            publish_date: _.year,
            rating: `${_.rating?.value || '0'} (${_.rating?.count || 0}人)`,
          }))
        }
      })
    
      return {
        content: [{ type: 'text', text }]
      }
    }
  • Zod schema defining the input parameters for the 'search-movie' tool: a required query string 'q'.
    {
      q: z.string().describe('query string, e.g. "python"')
    },
  • src/index.ts:89-118 (registration)
    Registration of the 'search-movie' tool on the MCP server using server.tool(), specifying the tool name via TOOL.SEARCH_MOVIE, description, input schema, and handler.
    server.tool(
      TOOL.SEARCH_MOVIE,
      'search movies or tvs from douban by query',
      {
        q: z.string().describe('query string, e.g. "python"')
      },
      async (args) => {
        if (!args.q) {
          throw new McpError(ErrorCode.InvalidParams, "q must be provided")
        }
    
        const movies = await searchMovies(args)
        const text = json2md({
          table: {
            headers: ['title', 'subtitle', 'publish_date', 'rating', 'id'],
            rows: movies.map(_ => ({
              id: _.id,
              title: _.title,
              subtitle: _.card_subtitle,
              publish_date: _.year,
              rating: `${_.rating?.value || '0'} (${_.rating?.count || 0}人)`,
            }))
          }
        })
    
        return {
          content: [{ type: 'text', text }]
        }
      }
    );
  • Core API helper function searchMovies that performs the actual API request to Frodo Douban API endpoint for searching movies by query and maps the response items to their target objects.
    export async function searchMovies(params: {
      q: string
    }) {
      const res = await requestFrodoApi(`/search/movie?q=${params.q}`)
      return res?.items ? res.items.map(_ => _.target) : [];
    }
  • TypeScript type definition for Douban.Movie, describing the structure of movie data used in the tool's output.
    interface Movie {
      /** 条目 id */
      id: string;
      /** 中文名 */
      title: string;
      /** 原名 */
      original_title: string;
      /** 条目 URL */
      alt: string;
      /** 
       * 电影海报图,分别提供 288px x 465px(大),96px x 155px(中) 64px x 103px(小)尺寸 
       */
      images: {
        small: string;
        medium: string;
        large: string;
      };
      /** 评分信息 */
      rating: {
        /** 平均评分 */
        average: number;
        /** 评分人数 */
        numRaters?: number;
        /** 评分人数(别名) */
        ratings_count?: number;
      };
      /** 如果条目类型是电影则为上映日期,如果是电视剧则为首播日期 */
      pubdates: string[];
      /** 年代 */
      year: string;
      /** 条目分类, movie 或者 tv */
      subtype: 'movie' | 'tv';
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool searches movies/TV shows from Douban, but doesn't disclose behavioral traits such as rate limits, authentication needs, pagination, error handling, or what the search results include. This leaves significant gaps for an agent to understand how to use it effectively.

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, efficient sentence with no wasted words. It's front-loaded with the core purpose and resource, making it easy to parse quickly. Every word earns its place by conveying essential information without redundancy.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns (e.g., list of results, details, pagination), error conditions, or usage constraints. For a search tool with one parameter, this leaves the agent without enough context to use it reliably.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'q' documented as a query string with an example. The description adds minimal value beyond the schema, mentioning 'by query' which aligns with the parameter but doesn't provide additional syntax, format details, or constraints. Baseline 3 is appropriate as the schema does the heavy lifting.

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 the action ('search') and resource ('movies or tvs from douban'), making the purpose evident. It specifies the data source (Douban) and scope (movies/TV shows), though it doesn't explicitly differentiate from the sibling 'search-book' tool beyond the resource type mentioned.

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 'browse' or other list tools. The description implies usage for searching movies/TV shows by query, but lacks context on prerequisites, exclusions, or comparisons with sibling tools.

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/moria97/douban-mcp'

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