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; }

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