yuque_get_repos
Retrieve knowledge repository lists from Yuque platform for document management and organization. Specify user ID to get repositories or use current user by default.
Instructions
获取知识库列表 (List knowledge repositories)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | No | 用户ID,不提供则获取当前用户的知识库 (User ID, defaults to current user) |
Implementation Reference
- src/tools/handlers.ts:115-125 (handler)The main handler function that executes the yuque_get_repos tool: calls YuqueClient.getRepos with optional userId and returns JSON-formatted list of repositories.async function handleGetRepos(client: YuqueClient, args: { userId?: string }) { const repos = await client.getRepos(args.userId); return { content: [ { type: 'text', text: JSON.stringify(repos, null, 2), }, ], }; }
- src/tools/definitions.ts:20-32 (schema)Tool schema definition specifying the name, description, and inputSchema with optional userId parameter.{ name: 'yuque_get_repos', description: '获取知识库列表 (List knowledge repositories)', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: '用户ID,不提供则获取当前用户的知识库 (User ID, defaults to current user)', }, }, }, },
- src/server.ts:46-50 (registration)Tool registration via listTools handler that returns all YUQUE_TOOLS, including yuque_get_repos.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_TOOLS, }; });
- src/tools/handlers.ts:27-28 (registration)Dispatch case in handleTool function that routes yuque_get_repos calls to the specific handler.case 'yuque_get_repos': return await handleGetRepos(client, args as { userId?: string });
- src/yuque-client.ts:159-166 (helper)YuqueClient helper method that fetches repositories from Yuque API (/users/{userId}/repos), defaulting to current user.async getRepos(userId?: string): Promise<YuqueRepo[]> { // Use /users/{userId}/repos as confirmed working endpoint if (!userId) { const user = await this.getUser(); userId = user.id.toString(); } return this.request<YuqueRepo[]>(`/users/${userId}/repos`); }