Skip to main content
Glama

get_user_docs

Retrieve a comprehensive list of all knowledge base documents, including private and collaborative files, associated with the current user on the Yuque platform.

Instructions

获取当前用户的所有知识库文档列表,包括私人和协作文档

Input Schema

NameRequiredDescriptionDefault
accessTokenNo用于认证 API 请求的令牌

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "accessToken": { "description": "用于认证 API 请求的令牌", "type": "string" } }, "type": "object" }

Implementation Reference

  • MCP tool handler for 'get_user_docs'. Creates YuqueService with optional accessToken, fetches user docs via service method, logs, and returns JSON stringified docs or error message in MCP content format.
    }, async ({ accessToken }) => { try { Logger.log("Fetching user's documents"); const yuqueService = this.createYuqueService(accessToken); const docs = await yuqueService.getUserDocs(); Logger.log(`Successfully fetched ${docs.length} documents`); return { content: [{ type: "text", text: JSON.stringify(docs) }], }; } catch (error) { Logger.error("Error fetching user docs:", error); return { content: [ { type: "text", text: `Error fetching user docs: ${error}` }, ], }; }
  • src/server.ts:162-186 (registration)
    Registration of the 'get_user_docs' tool on the MCP server, including name, Chinese description, Zod input schema, and inline handler function.
    this.server.tool( "get_user_docs", "获取当前用户的所有知识库文档列表,包括私人和协作文档", { accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), }, async ({ accessToken }) => { try { Logger.log("Fetching user's documents"); const yuqueService = this.createYuqueService(accessToken); const docs = await yuqueService.getUserDocs(); Logger.log(`Successfully fetched ${docs.length} documents`); return { content: [{ type: "text", text: JSON.stringify(docs) }], }; } catch (error) { Logger.error("Error fetching user docs:", error); return { content: [ { type: "text", text: `Error fetching user docs: ${error}` }, ], }; } }
  • Zod input schema for the tool, defining optional accessToken parameter.
    { accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
  • YuqueService helper method implementing the core API call to fetch current user's docs from Yuque API endpoint '/user/docs'.
    async getUserDocs(): Promise<YuqueDoc[]> { const response = await this.client.get('/user/docs'); return response.data.data; }

Other Tools

Related 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