Skip to main content
Glama
mcp-text-stats

mcp-text-stats

by Fastunbeaten

文本统计

count_text

Counts characters, graphemes, code points, lines, paragraphs, sentences, words, and Unicode scripts in inline text or files/directories; returns only numbers and paths, never content.

Instructions

统计文件或文本的字素/码点/UTF-16 单元数、字素簇、行、段落、句子、词数以及按 Unicode 脚本分类的字符计数。返回纯数字与路径,绝不返回正文片段。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "count_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
textNo直接统计一段文本;与 paths 二选一。
unitNo字符计量单位(结果中所有字符级指标都会给出,rules.unit 反映该选择)。grapheme
pathsNo要统计的文件路径数组(可含目录);与 text 二选一。目录会按 include/exclude 递归过滤。
excludeNo目录递归时的排除模式(支持 ** 与 *)。
includeNo目录递归时的包含模式(支持 ** 与 *)。
languageNo分词/断句所用 locale;auto 时文本含 CJK 用 zh,否则 und。auto
maxBytesNo单文件字节数上限,超过则不读取(warning: file_too_large)。服务端硬上限 200MB,超过会被自动钳制(warning: max_bytes_clamped)。
wordsForCjkNo中文/日文/韩文是否也返回分词数(近似)。默认 false,即 CJK 文本 words=0。
maxBytesForWordCountNo单文件字节数上限,超过则跳过 words 与 sentences(warning: skipped_word_segmentation)。服务端硬上限 64MB,超过会被自动钳制(warning: max_bytes_clamped)。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It does add one genuinely valuable disclosure — '返回纯数字与路径,绝不返回正文片段' — which tells the agent output is aggregate-only with no content leakage, useful for privacy-sensitive workflows. However, it is silent on the threshold/warning mechanism (file_too_large, skipped_word_segmentation), directory recursion behavior, error handling, and the read-only nature of the operation.

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?

Two sentences, front-loaded with the action, and every clause maps to either the produced metrics or the return-shape guarantee. Minor deduction for the dense slash-delimited enumeration in which 字素 and 字素簇 appear back to back, which reads as slightly redundant terminology rather than a crisp list.

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

Completeness4/5

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

With nine parameters, no annotations, and no output schema, the description usefully compensates by naming the returned metrics and stating output is numbers plus paths — effectively serving as a lightweight return-value contract. What is missing is secondary for correct invocation: performance expectations, warning semantics, and recursive directory handling, all of which the schema already documents.

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 baseline is 3 and the schema already explains text vs paths exclusivity, unit enumeration, include/exclude globs, language selection, and both byte caps with their warning codes. The description's metric enumeration is loosely related to the unit parameter but adds no syntax, format, or default information beyond the schema.

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

Purpose5/5

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

The description opens with a concrete verb (统计/count) and an explicit resource (文件或文本) and enumerates the exact metrics produced: grapheme/codepoint/UTF-16 units, lines, paragraphs, sentences, words, and per-Unicode-script character counts. An agent reading only this line knows precisely what the tool returns, with no siblings to disambiguate against.

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

Usage Guidelines3/5

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

Usage is only implied by the phrase '文件或文本', which signals the two input modes, while the mutually-exclusive text/paths selection is documented in the schema rather than here. The description offers no explicit when-to-use guidance, no exclusions, and no note on when CJK word counting is relevant (that lives in the wordsForCjk parameter description).

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

Deploy Server

Other Tools