Skip to main content
Glama

get_repo_docs

Retrieve all documents from a Yuque knowledge repository, including titles and update timestamps, to access and organize content efficiently.

Instructions

获取特定知识库中的所有文档列表,包括文档标题、更新时间等信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYes知识库的命名空间,格式为 user/repo
accessTokenNo用于认证 API 请求的令牌

Implementation Reference

  • MCP tool registration and inline handler function that creates YuqueService, calls getRepoDocs, and returns the documents as JSON text content.
    this.server.tool( "get_repo_docs", "获取特定知识库中的所有文档列表,包括文档标题、更新时间等信息", { namespace: z.string().describe("知识库的命名空间,格式为 user/repo"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), }, async ({ namespace, accessToken }) => { try { Logger.log(`Fetching documents for repository: ${namespace}`); const yuqueService = this.createYuqueService(accessToken); const docs = await yuqueService.getRepoDocs(namespace); Logger.log(`Successfully fetched ${docs.length} documents`); return { content: [{ type: "text", text: JSON.stringify(docs, null, 2) }], }; } catch (error) { Logger.error(`Error fetching docs for repo ${namespace}:`, error); return { content: [{ type: "text", text: `Error fetching docs: ${error}` }], }; } } );
  • Zod input schema defining parameters for the get_repo_docs tool: required namespace (user/repo format) and optional accessToken.
    { namespace: z.string().describe("知识库的命名空间,格式为 user/repo"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), },
  • YuqueService helper method that performs the actual API request to retrieve documents from a repository.
    async getRepoDocs(namespace: string, offset?: number, limit?: number, optional_properties?: string): Promise<YuqueDoc[]> { const params: any = {}; if (offset !== undefined) params.offset = offset; if (limit !== undefined) params.limit = limit; if (optional_properties !== undefined) params.optional_properties = optional_properties; const response = await this.client.get(`/repos/${namespace}/docs`, { params }); return response.data.data; }

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