Skip to main content
Glama

search

Search documents or knowledge bases in Yuque platform using keywords, with filters for content type, scope, and author.

Instructions

在语雀平台中搜索文档或知识库内容,支持范围和作者筛选

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词
typeYes要搜索的内容类型:doc(文档) 或 repo(知识库)
scopeNo搜索范围,不填默认搜索当前用户/团队
pageNo页码,默认为1
creatorNo仅搜索指定作者的内容
accessTokenNo用于认证 API 请求的令牌

Implementation Reference

  • The main handler function for the 'search' MCP tool. It logs the search parameters, creates a YuqueService instance, calls the search method, formats the results as JSON text content, or returns an error message.
    async ({ query, type, scope, page, creator, accessToken }) => {
      try {
        Logger.log(`Searching for: ${query} with type: ${type}`);
        const yuqueService = this.createYuqueService(accessToken);
        const results = await yuqueService.search(
          query,
          type,
          scope,
          page,
          creator
        );
    
        Logger.log(`Successfully found ${results.length} results`);
        return {
          content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
        };
      } catch (error) {
        Logger.error(`Error searching for ${query}:`, error);
        return {
          content: [{ type: "text", text: `Error searching: ${error}` }],
        };
      }
    }
  • Zod input schema defining parameters for the 'search' tool: query (required string), type (enum doc/repo), optional scope, page, creator, accessToken.
    {
      query: z.string().describe("搜索关键词"),
      type: z
        .enum(["doc", "repo"])
        .describe("要搜索的内容类型:doc(文档) 或 repo(知识库)"),
      scope: z
        .string()
        .optional()
        .describe("搜索范围,不填默认搜索当前用户/团队"),
      page: z.number().optional().describe("页码,默认为1"),
      creator: z.string().optional().describe("仅搜索指定作者的内容"),
      accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
    },
  • src/server.ts:492-531 (registration)
    Registration of the 'search' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    this.server.tool(
      "search",
      "在语雀平台中搜索文档或知识库内容,支持范围和作者筛选",
      {
        query: z.string().describe("搜索关键词"),
        type: z
          .enum(["doc", "repo"])
          .describe("要搜索的内容类型:doc(文档) 或 repo(知识库)"),
        scope: z
          .string()
          .optional()
          .describe("搜索范围,不填默认搜索当前用户/团队"),
        page: z.number().optional().describe("页码,默认为1"),
        creator: z.string().optional().describe("仅搜索指定作者的内容"),
        accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
      },
      async ({ query, type, scope, page, creator, accessToken }) => {
        try {
          Logger.log(`Searching for: ${query} with type: ${type}`);
          const yuqueService = this.createYuqueService(accessToken);
          const results = await yuqueService.search(
            query,
            type,
            scope,
            page,
            creator
          );
    
          Logger.log(`Successfully found ${results.length} results`);
          return {
            content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
          };
        } catch (error) {
          Logger.error(`Error searching for ${query}:`, error);
          return {
            content: [{ type: "text", text: `Error searching: ${error}` }],
          };
        }
      }
    );
  • YuqueService helper method that performs the actual HTTP GET request to Yuque API /search endpoint with query parameters.
    async search(q: string, type: 'doc' | 'repo', scope?: string, page?: number, creator?: string): Promise<YuqueSearchResult[]> {
      const params: any = { q, type };
      if (scope) params.scope = scope;
      if (page) params.page = page;
      if (creator) params.creator = creator;
    
      const response = await this.client.get('/search', { params });
      return response.data.data;
    }
  • TypeScript interface defining the structure of search results returned by Yuque API.
    export interface YuqueSearchResult {
      id: number;
      type: 'doc' | 'repo';
      title: string;
      summary: string;
      url: string;
      info: string;
      target: YuqueDoc | YuqueRepo;
    }
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 of behavioral disclosure. The description mentions filtering capabilities but doesn't disclose important behavioral traits like whether this is a read-only operation (implied but not stated), whether it requires authentication (implied by the accessToken parameter but not explicitly stated), pagination behavior (implied by the page parameter but not explained), rate limits, or what the response format looks like. For a search tool with 6 parameters and no annotations, this is a significant gap.

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, efficient Chinese sentence that states the core purpose and key capabilities. It's appropriately sized and front-loaded with the main function. However, it could be slightly more structured by separating purpose from features for better readability.

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 tool's complexity (6 parameters, search functionality) and the absence of both annotations and an output schema, the description is incomplete. It doesn't explain what the tool returns (search results format), authentication requirements, pagination behavior, or error conditions. For a search tool with no structured output documentation, the description should provide more context about the expected response.

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%, so the schema already documents all 6 parameters thoroughly. The description adds minimal value beyond the schema by mentioning '范围和作者筛选' (scope and author filtering), which corresponds to the 'scope' and 'creator' parameters, but doesn't provide additional semantic context beyond what's in the schema descriptions. With high schema coverage, the baseline is 3 even without parameter details in the description.

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 tool's purpose: '在语雀平台中搜索文档或知识库内容' (search for documents or knowledge base content in the Yuque platform). It specifies the verb '搜索' (search) and resources '文档或知识库内容' (documents or knowledge base content). However, it doesn't explicitly distinguish this from sibling tools like 'get_doc' or 'get_repo_docs', which appear to be retrieval tools rather than search tools.

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

Usage Guidelines3/5

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

The description provides some implied usage context by mentioning '支持范围和作者筛选' (supports scope and author filtering), suggesting this tool is for filtered searches. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_doc' (which likely retrieves specific documents) or 'get_user_docs' (which likely lists user documents without search). No explicit when-not-to-use guidance or named alternatives are provided.

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/HenryHaoson/Yuque-MCP-Server'

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