yuque_get_doc
Retrieve document details from Yuque knowledge base using document ID and repository ID to access content and metadata.
Instructions
获取文档详情 (Get document details)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | Yes | 文档ID (Document ID) | |
| repoId | Yes | 知识库ID (Repository ID) |
Implementation Reference
- src/tools/handlers.ts:145-158 (handler)The handler function that executes the yuque_get_doc tool by fetching the document from YuqueClient and returning it as formatted JSON text content.async function handleGetDoc( client: YuqueClient, args: { docId: number; repoId: number } ) { const doc = await client.getDoc(args.docId, args.repoId); return { content: [ { type: 'text', text: JSON.stringify(doc, null, 2), }, ], }; }
- src/tools/definitions.ts:58-75 (schema)The tool schema definition specifying the input parameters docId and repoId as required numbers.{ name: 'yuque_get_doc', description: '获取文档详情 (Get document details)', inputSchema: { type: 'object', properties: { docId: { type: 'number', description: '文档ID (Document ID)', }, repoId: { type: 'number', description: '知识库ID (Repository ID)', }, }, required: ['docId', 'repoId'], }, },
- src/server.ts:46-50 (registration)Registers the tool list handler which exposes the yuque_get_doc tool schema via YUQUE_TOOLS.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_TOOLS, }; });
- src/server.ts:53-67 (registration)Registers the general tool execution handler which dispatches yuque_get_doc calls to the specific handler.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await handleTool(request, { client: yuqueClient }); } catch (error) { if (error instanceof McpError) { throw error; } const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError( ErrorCode.InternalError, `Error executing tool: ${errorMessage}` ); } });
- src/tools/handlers.ts:36-40 (registration)Switch case in handleTool that routes yuque_get_doc requests to the handleGetDoc function.case 'yuque_get_doc': return await handleGetDoc( client, args as { docId: number; repoId: number } );