Skip to main content
Glama

get_group_doc_statistics

Retrieve document statistics for a Yuque team, including word count, views, and comments, with filtering and sorting options for analysis.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler in YuqueService that performs the API request to fetch group document statistics from Yuque.
    async getGroupDocStatistics(login: string, params?: {
      bookId?: number;
      name?: string;
      range?: number;
      page?: number;
      limit?: number;
      sortField?: string;
      sortOrder?: 'desc' | 'asc';
    }): Promise<any> {
      const response = await this.client.get(`/groups/${login}/statistics/docs`, { params });
      return response.data.data;
    }
  • src/server.ts:682-739 (registration)
    MCP tool registration for 'get_group_doc_statistics', including description, Zod input schema, and the wrapper handler function that invokes the YuqueService method.
    this.server.tool(
      "get_group_doc_statistics",
      "获取团队文档的统计数据,包括各文档的字数、阅读量、评论量等",
      {
        login: z.string().describe("团队的登录名或唯一标识"),
        bookId: z
          .number()
          .optional()
          .describe("知识库ID,用于过滤特定知识库的文档"),
        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、word_count、read_count、like_count、comment_count、created_at"
          ),
        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 doc statistics for group: ${login}`);
          const yuqueService = this.createYuqueService(accessToken);
          const stats = await yuqueService.getGroupDocStatistics(
            login,
            queryParams
          );
    
          Logger.log(`Successfully fetched doc statistics for group: ${login}`);
          return {
            content: [{ type: "text", text: JSON.stringify(stats, null, 2) }],
          };
        } catch (error) {
          Logger.error(
            `Error fetching doc statistics for group ${params.login}:`,
            error
          );
          return {
            content: [
              {
                type: "text",
                text: `Error fetching group doc statistics: ${error}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions the types of statistics returned but doesn't disclose critical traits like whether this is a read-only operation (implied by 'get'), authentication requirements (only hinted via accessToken parameter), rate limits, pagination behavior (implied by page/limit parameters), or what happens with invalid inputs. For a tool with 9 parameters and no annotation coverage, this is inadequate.

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

Conciseness4/5

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

The description is a single, efficient sentence in Chinese that front-loads the core purpose. It wastes no words but could be slightly more structured (e.g., separating purpose from data details). Every part earns its place, though it might benefit from brevity in English contexts.

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?

Given high complexity (9 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the return format (e.g., list of documents with stats?), error conditions, authentication needs beyond the accessToken parameter, or how to interpret results. For a statistical query tool with multiple filters and sorting options, more context is needed to guide effective use.

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%, providing detailed documentation for all 9 parameters including enums and defaults. The description adds no parameter-specific semantics beyond implying statistics include 'word count, read count, comment count' which loosely relates to sortField options. It doesn't explain parameter interactions (e.g., how bookId, name, and range combine) or provide examples. Baseline 3 is appropriate since the schema does heavy lifting.

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 verb ('获取' meaning 'get') and resource ('团队文档的统计数据' meaning 'team document statistics'), specifying what data is included (word count, read count, comment count, etc.). It distinguishes from siblings like get_doc (single document) or get_group_statistics (general group stats) by focusing on document-level metrics. However, it doesn't explicitly differentiate from get_group_book_statistics or get_repo_docs, which might overlap in scope.

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_book_statistics (for book-level stats), get_doc (for single document details), or get_repo_docs (for document listings). It lacks context about prerequisites (e.g., needing team access) or exclusions (e.g., not for user-specific docs). Usage is implied only by the name and parameters, with no explicit instructions.

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