get_group_statistics
Retrieve comprehensive team statistics from Yuque, including member count, document numbers, read counts, and interaction data for analysis.
Instructions
获取团队的汇总统计数据,包括成员人数、文档数量、阅读量和互动数据等
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| login | Yes | 团队的登录名或唯一标识 | |
| accessToken | No | 用于认证 API 请求的令牌 |
Implementation Reference
- src/server.ts:541-562 (handler)The main MCP tool handler function that receives parameters, creates a YuqueService instance, calls getGroupStatistics on it, and returns formatted JSON response or error message.async ({ login, accessToken }) => { try { Logger.log(`Fetching statistics for group: ${login}`); const yuqueService = this.createYuqueService(accessToken); const stats = await yuqueService.getGroupStatistics(login); Logger.log(`Successfully fetched statistics for group: ${login}`); return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }], }; } catch (error) { Logger.error(`Error fetching statistics for group ${login}:`, error); return { content: [ { type: "text", text: `Error fetching group statistics: ${error}`, }, ], }; } }
- src/server.ts:537-540 (schema)Zod schema defining the input parameters for the tool: login (required string) and accessToken (optional string).{ login: z.string().describe("团队的登录名或唯一标识"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), },
- src/server.ts:534-563 (registration)Registration of the 'get_group_statistics' tool with the MCP server, including name, description, schema, and handler function.this.server.tool( "get_group_statistics", "获取团队的汇总统计数据,包括成员人数、文档数量、阅读量和互动数据等", { login: z.string().describe("团队的登录名或唯一标识"), accessToken: z.string().optional().describe("用于认证 API 请求的令牌"), }, async ({ login, accessToken }) => { try { Logger.log(`Fetching statistics for group: ${login}`); const yuqueService = this.createYuqueService(accessToken); const stats = await yuqueService.getGroupStatistics(login); Logger.log(`Successfully fetched statistics for group: ${login}`); return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }], }; } catch (error) { Logger.error(`Error fetching statistics for group ${login}:`, error); return { content: [ { type: "text", text: `Error fetching group statistics: ${error}`, }, ], }; } } );
- src/services/yuque.ts:432-435 (helper)Helper service method in YuqueService class that makes the API request to retrieve group statistics from Yuque.async getGroupStatistics(login: string): Promise<any> { const response = await this.client.get(`/groups/${login}/statistics`); return response.data.data; }