yuque_get_docs
Retrieve document lists from Yuque knowledge base repositories using repository ID, with options for pagination and result limits to organize content access.
Instructions
获取文档列表 (List documents in a repository)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repoId | Yes | 知识库ID (Repository ID) | |
| limit | No | 返回数量限制,默认20 (Result limit, default 20) | |
| offset | No | 偏移量,默认0 (Offset for pagination, default 0) |
Implementation Reference
- src/tools/handlers.ts:127-143 (handler)Executes the yuque_get_docs tool by fetching documents from the specified Yuque repository using the client and formatting the response as JSON text.async function handleGetDocs( client: YuqueClient, args: { repoId: number; limit?: number; offset?: number } ) { const docs = await client.getDocs(args.repoId, { limit: args.limit, offset: args.offset, }); return { content: [ { type: 'text', text: JSON.stringify(docs, null, 2), }, ], }; }
- src/tools/definitions.ts:33-57 (schema)Tool definition including name, description, and input schema validation for yuque_get_docs.{ name: 'yuque_get_docs', description: '获取文档列表 (List documents in a repository)', inputSchema: { type: 'object', properties: { repoId: { type: 'number', description: '知识库ID (Repository ID)', }, limit: { type: 'number', description: '返回数量限制,默认20 (Result limit, default 20)', minimum: 1, maximum: 100, }, offset: { type: 'number', description: '偏移量,默认0 (Offset for pagination, default 0)', minimum: 0, }, }, required: ['repoId'], }, },
- src/tools/handlers.ts:30-34 (registration)Registration of yuque_get_docs in the main tool dispatcher switch statement, routing calls to the handler function.case 'yuque_get_docs': return await handleGetDocs( client, args as { repoId: number; limit?: number; offset?: number } );
- src/yuque-client.ts:171-178 (helper)Supporting utility in YuqueClient that makes the HTTP API request to retrieve documents list from Yuque.async getDocs(repoId: number, options?: { limit?: number; offset?: number }): Promise<YuqueDoc[]> { const params = new URLSearchParams(); if (options?.limit) params.append('limit', options.limit.toString()); if (options?.offset) params.append('offset', options.offset.toString()); const endpoint = `/repos/${repoId}/docs${params.toString() ? '?' + params.toString() : ''}`; return this.request<YuqueDoc[]>(endpoint); }
- src/server.ts:46-50 (registration)MCP server registration for listing tools, which includes the yuque_get_docs schema via YUQUE_TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_TOOLS, }; });