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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions statistics retrieval but doesn't disclose behavioral traits like pagination behavior (implied by page/limit parameters), authentication requirements (accessToken parameter), rate limits, error conditions, or what happens when no data matches. For a read operation with 8 parameters, this is insufficient disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient Chinese sentence that clearly states the tool's purpose with relevant examples. It's front-loaded with the main function and wastes no words. Every element earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the return format, pagination behavior, authentication requirements, or error handling. While the schema covers parameter definitions, the description fails to provide necessary context for proper tool invocation and result interpretation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 8 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema. It mentions general statistics types but doesn't explain how parameters like 'range' or 'sortField' affect which statistics are returned. Baseline 3 is appropriate when schema does all the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取团队知识库的统计数据' (get team knowledge base statistics) with specific examples of metrics like document count, word count, and read count. It distinguishes from siblings like get_group_doc_statistics (doc-specific) and get_group_statistics (general group stats) by focusing on knowledge base-level metrics. However, it doesn't explicitly name the sibling tools for comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like get_group_doc_statistics or get_group_statistics. It doesn't mention prerequisites, exclusions, or typical use cases. The agent must infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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