Skip to main content
Glama

get_user_repos

Retrieve a user's knowledge base list on Yuque by specifying their login ID and access token, enabling organized document collection management.

Instructions

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

Input Schema

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "accessToken": { "description": "用于认证 API 请求的令牌", "type": "string" }, "login": { "description": "用户的登录名或唯一标识", "type": "string" } }, "required": [ "login" ], "type": "object" }

Implementation Reference

  • MCP tool handler and registration for 'get_user_repos'. Creates a YuqueService instance and calls getUserRepos(login) to fetch repositories, then returns them as JSON text content or error message.
    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}` }], }; } } );
  • Input schema validation using Zod for the get_user_repos tool: required 'login' string and optional 'accessToken'.
    { login: z.string().describe("用户的登录名或唯一标识"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), },
  • Helper method in YuqueService that performs the actual API request to fetch user's repositories from Yuque API endpoint /users/{login}/repos, supporting pagination and type filtering.
    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; }
  • TypeScript interface defining the structure of YuqueRepo objects, which are returned by the getUserRepos method and serialized in the tool response.
    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; }

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