Skip to main content
Glama

get_group_book_statistics

Analyze team knowledge base statistics such as document count, word count, and readership metrics. Filter by name, time range, and sort by various fields to retrieve insights systematically.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function registered for the 'get_group_book_statistics' tool. It extracts parameters, creates a Yuque service instance, calls getGroupBookStatistics on it, and returns the statistics as JSON 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 login, filters, pagination, sorting, and optional access token.
    { 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:625-679 (registration)
    The registration of the 'get_group_book_statistics' tool using this.server.tool(), including name, description, input schema, and handler function.
    "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}`, }, ], }; } } );
  • Helper method in YuqueService that performs the actual API call to retrieve group book statistics from the Yuque API endpoint `/groups/${login}/statistics/books`.
    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