Skip to main content
Glama

get_user_docs

Retrieve a complete list of your Yuque knowledge base documents, including both private and collaborative workspaces, to manage and access your content efficiently.

Instructions

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

Input Schema

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

Implementation Reference

  • The MCP tool handler function for 'get_user_docs'. It creates a YuqueService instance and calls getUserDocs() to fetch the user's documents, then returns them as a JSON string in the MCP content format. Handles errors appropriately.
      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}` },
            ],
          };
        }
      }
    );
  • Input schema for the get_user_docs tool, defined using Zod. The only parameter is an optional accessToken for authentication.
    {
      accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
    },
  • src/server.ts:162-187 (registration)
    Registration of the 'get_user_docs' tool on the McpServer using server.tool(name, description, inputSchema, handler). This is where the tool is made available in the MCP protocol.
    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}` },
            ],
          };
        }
      }
    );
  • Helper method in YuqueService that performs the actual API call to Yuque's /user/docs endpoint to retrieve the list of user documents.
    async getUserDocs(): Promise<YuqueDoc[]> {
      const response = await this.client.get('/user/docs');
      return response.data.data;
    }
  • TypeScript interface definition for YuqueDoc, which defines the structure of documents returned by getUserDocs.
    export interface YuqueDoc {
      id: number;
      slug: string;
      title: string;
      description: string;
      user_id: number;
      book_id: number;
      format: string;
      public: number;
      status: number;
      likes_count: number;
      read_count?: number;
      comments_count: number;
      content_updated_at: string;
      created_at: string;
      updated_at: string;
      published_at?: string;
      first_published_at?: string;
      word_count: number;
      body?: string;
      body_html?: string;
      body_lake?: string;
      body_draft?: string;
      book?: YuqueRepo;
      user?: YuqueUser;
      last_editor?: YuqueUser;
      creator?: YuqueUser;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states what the tool does but lacks behavioral details: it doesn't mention pagination, rate limits, sorting, what fields are returned, error conditions, or whether this is a read-only operation. The description is functional but misses important operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence in Chinese that efficiently conveys the core functionality. No wasted words, appropriately front-loaded with the main purpose. Every word earns its place in this compact description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a list retrieval tool with 1 parameter (100% schema coverage) but no annotations and no output schema, the description is minimally adequate. It covers what the tool does but lacks important context about return format, pagination, and operational constraints. The absence of output schema means the description should ideally mention something about the response structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with one parameter (accessToken) fully documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema. With high schema coverage, the baseline is 3 even without additional param details in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('获取' - get/retrieve) and resource ('所有知识库文档列表' - all knowledge base document list) with scope ('当前用户' - current user, '包括私人和协作文档' - including private and collaborative documents). It distinguishes from siblings like get_doc (single document) and get_repo_docs (repository-specific), but doesn't explicitly mention these distinctions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('当前用户' - current user) but doesn't explicitly state when to use this tool versus alternatives like get_repo_docs (repository-focused) or search (filtered search). No exclusions or prerequisites are mentioned, though the accessToken parameter suggests authentication is required.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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