Skip to main content
Glama

yuque_search_docs

Search documents in Yuque knowledge bases using keywords to find relevant information across repositories or within specific ones.

Instructions

搜索文档 (Search documents)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词 (Search keywords)
repoIdNo知识库ID,可选,不提供则全局搜索 (Repository ID, optional, global search if not provided)

Implementation Reference

  • The main handler function for the 'yuque_search_docs' MCP tool. It receives arguments, calls YuqueClient.searchDocs, and returns the results formatted as MCP content (JSON string).
    async function handleSearchDocs( client: YuqueClient, args: { query: string; repoId?: number } ) { const docs = await client.searchDocs(args.query, args.repoId); return { content: [ { type: 'text', text: JSON.stringify(docs, null, 2), }, ], };
  • The tool definition including name, description, and input schema validation for 'yuque_search_docs'.
    { name: 'yuque_search_docs', description: '搜索文档 (Search documents)', inputSchema: { type: 'object', properties: { query: { type: 'string', description: '搜索关键词 (Search keywords)', minLength: 1, maxLength: 100, }, repoId: { type: 'number', description: '知识库ID,可选,不提供则全局搜索 (Repository ID, optional, global search if not provided)', }, }, required: ['query'], }, },
  • The core helper method in YuqueClient that performs the actual API search request to Yuque's /search endpoint with query parameters.
    /** * Search documents */ async searchDocs(query: string, repoId?: number): Promise<YuqueDoc[]> { const params = new URLSearchParams({ q: query, type: 'doc', // Required parameter }); if (repoId) params.append('repo_id', repoId.toString()); return this.request<YuqueDoc[]>(`/search?${params.toString()}`); }
  • The dispatch case in the main handleTool switch statement that registers and routes 'yuque_search_docs' calls to the specific handler function.
    case 'yuque_search_docs': return await handleSearchDocs( client, args as { query: string; repoId?: number } );
  • src/server.ts:46-50 (registration)
    Registration of the tool list handler, which returns YUQUE_TOOLS array including the schema for 'yuque_search_docs'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_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/tanis2010/yuque-mcp-server'

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