Skip to main content
Glama

get_group_book_statistics

Retrieve statistical data for team knowledge bases, including document counts, word counts, and readership metrics, to analyze content performance and usage patterns.

Instructions

获取团队知识库的统计数据,包括各知识库的文档数、字数、阅读量等

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loginYes团队的登录名或唯一标识
nameNo知识库名称,用于过滤特定知识库
rangeNo时间范围(0: 全部, 30: 近30天, 365: 近一年)
pageNo页码,默认为1
limitNo每页数量,默认为10,最大为20
sortFieldNo排序字段,可选值:content_updated_at_ms、word_count、post_count、read_count、like_count、watch_count、comment_count
sortOrderNo排序方向,可选值:desc(降序)、asc(升序),默认为desc
accessTokenNo用于认证 API 请求的令牌

Implementation Reference

  • The handler function for the 'get_group_book_statistics' MCP tool. It destructures input params, instantiates YuqueService with optional accessToken, calls the service's getGroupBookStatistics method, logs progress, and returns the statistics as JSON text block or an error message.
    async (params) => { try { const { login, accessToken, ...queryParams } = params; Logger.log(`Fetching book statistics for group: ${login}`); const yuqueService = this.createYuqueService(accessToken); const stats = await yuqueService.getGroupBookStatistics( login, queryParams ); Logger.log( `Successfully fetched book statistics for group: ${login}` ); return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }], }; } catch (error) { Logger.error( `Error fetching book statistics for group ${params.login}:`, error ); return { content: [ { type: "text", text: `Error fetching group book statistics: ${error}`, }, ], }; }
  • Zod schema defining the input parameters for the get_group_book_statistics tool, including required 'login', optional filters like 'name', 'range', pagination, sorting, and optional 'accessToken'.
    { login: z.string().describe("团队的登录名或唯一标识"), name: z.string().optional().describe("知识库名称,用于过滤特定知识库"), range: z .number() .optional() .describe("时间范围(0: 全部, 30: 近30天, 365: 近一年)"), page: z.number().optional().describe("页码,默认为1"), limit: z.number().optional().describe("每页数量,默认为10,最大为20"), sortField: z .string() .optional() .describe( "排序字段,可选值:content_updated_at_ms、word_count、post_count、read_count、like_count、watch_count、comment_count" ), sortOrder: z .enum(["desc", "asc"]) .optional() .describe("排序方向,可选值:desc(降序)、asc(升序),默认为desc"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), },
  • src/server.ts:624-679 (registration)
    Registration of the 'get_group_book_statistics' tool on the MCP server using this.server.tool(), including name, description, input schema, and handler function.
    this.server.tool( "get_group_book_statistics", "获取团队知识库的统计数据,包括各知识库的文档数、字数、阅读量等", { login: z.string().describe("团队的登录名或唯一标识"), name: z.string().optional().describe("知识库名称,用于过滤特定知识库"), range: z .number() .optional() .describe("时间范围(0: 全部, 30: 近30天, 365: 近一年)"), page: z.number().optional().describe("页码,默认为1"), limit: z.number().optional().describe("每页数量,默认为10,最大为20"), sortField: z .string() .optional() .describe( "排序字段,可选值:content_updated_at_ms、word_count、post_count、read_count、like_count、watch_count、comment_count" ), sortOrder: z .enum(["desc", "asc"]) .optional() .describe("排序方向,可选值:desc(降序)、asc(升序),默认为desc"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), }, async (params) => { try { const { login, accessToken, ...queryParams } = params; Logger.log(`Fetching book statistics for group: ${login}`); const yuqueService = this.createYuqueService(accessToken); const stats = await yuqueService.getGroupBookStatistics( login, queryParams ); Logger.log( `Successfully fetched book statistics for group: ${login}` ); return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }], }; } catch (error) { Logger.error( `Error fetching book statistics for group ${params.login}:`, error ); return { content: [ { type: "text", text: `Error fetching group book statistics: ${error}`, }, ], }; } } );
  • YuqueService helper method that makes the HTTP GET request to the Yuque API endpoint `/groups/${login}/statistics/books` with optional query params and returns the parsed data.
    async getGroupBookStatistics(login: string, params?: { name?: string; range?: number; page?: number; limit?: number; sortField?: string; sortOrder?: 'desc' | 'asc'; }): Promise<any> { const response = await this.client.get(`/groups/${login}/statistics/books`, { 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