Skip to main content
Glama

get_user_repos

Retrieve a user's knowledge base list from Yuque to organize document collections. Provide the user login name and access token to fetch repositories.

Instructions

获取指定用户的知识库列表,知识库是语雀中组织文档的集合

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loginYes用户的登录名或唯一标识
accessTokenNo用于认证 API 请求的令牌

Implementation Reference

  • MCP tool handler for 'get_user_repos'. Registers the tool with input schema (login required, accessToken optional), creates YuqueService, calls getUserRepos(login), and returns JSON-formatted list of repositories or error.
    this.server.tool(
      "get_user_repos",
      "获取指定用户的知识库列表,知识库是语雀中组织文档的集合",
      {
        login: z.string().describe("用户的登录名或唯一标识"),
        accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
      },
      async ({ login, accessToken }) => {
        try {
          Logger.log(`Fetching repositories for user: ${login}`);
          const yuqueService = this.createYuqueService(accessToken);
          const repos = await yuqueService.getUserRepos(login);
    
          Logger.log(`Successfully fetched ${repos.length} repositories`);
          return {
            content: [{ type: "text", text: JSON.stringify(repos, null, 2) }],
          };
        } catch (error) {
          Logger.error(`Error fetching repos for user ${login}:`, error);
          return {
            content: [{ type: "text", text: `Error fetching repos: ${error}` }],
          };
        }
      }
    );
  • YuqueService method implementing the core logic for fetching user's repositories via Yuque API. Supports optional pagination and filtering parameters.
    async getUserRepos(login: string, offset?: number, limit?: number, type?: string): Promise<YuqueRepo[]> {
      const params: any = {};
      if (offset !== undefined) params.offset = offset;
      if (limit !== undefined) params.limit = limit;
      if (type !== undefined) params.type = type;
      
      const response = await this.client.get(`/users/${login}/repos`, { params });
      return response.data.data;
    }
  • Zod input schema validation for the get_user_repos tool: requires 'login' string, optional 'accessToken' string.
    {
      login: z.string().describe("用户的登录名或唯一标识"),
      accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
    },
  • TypeScript interface defining the structure of a YuqueRepo object returned by the API.
    export interface YuqueRepo {
      id: number;
      type: string;
      slug: string;
      name: string;
      user_id: number;
      description: string;
      public: number;
      items_count: number;
      likes_count: number;
      watches_count: number;
      content_updated_at: string;
      created_at: string;
      updated_at: string;
      namespace: string;
      user?: YuqueUser;
      toc_yml?: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool retrieves a list but doesn't disclose behavioral traits like pagination, rate limits, error handling, or whether it requires authentication (though the accessToken parameter hints at this). For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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?

The description is a single, efficient sentence that front-loads the core purpose. It wastes no words and is appropriately sized for a simple list-retrieval tool, making it easy for an AI agent to parse quickly.

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?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on behavior, output format, or usage context. Without annotations or an output schema, more completeness would be helpful, but it meets the bare minimum for a read operation.

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?

The schema description coverage is 100%, with both parameters (login and accessToken) fully described in the schema. The description adds no additional meaning beyond what the schema provides, such as explaining the format of login or when accessToken is required. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 tool's purpose: '获取指定用户的知识库列表' (get a specified user's repository list), specifying the verb '获取' (get) and resource '知识库列表' (repository list). It distinguishes from siblings like get_user_docs (which gets documents) by focusing on repositories. However, it doesn't explicitly differentiate from get_repo_docs (which gets docs within a repo), so it's not a perfect 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use get_user_repos instead of get_user_docs or get_repo_docs, nor does it specify prerequisites like authentication requirements. The context is implied but not explicit.

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