Skip to main content
Glama
paladini

devutils-mcp-server

text_stats

Analyze text to calculate character, word, line, sentence, paragraph counts and reading time for content assessment.

Instructions

Analyze text and return detailed statistics: character count, word count, line count, sentence count, paragraph count, and reading time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe text to analyze

Implementation Reference

  • The handler function for the text_stats tool that calculates various text metrics and returns them as a JSON string.
    async ({ input }) => {
      const chars = input.length;
      const charsNoSpaces = input.replace(/\s/g, "").length;
      const words = input.trim() === "" ? 0 : input.trim().split(/\s+/).length;
      const lines = input === "" ? 0 : input.split(/\r?\n/).length;
      const sentences = input.trim() === ""
        ? 0
        : input.split(/[.!?]+/).filter((s) => s.trim().length > 0).length;
      const paragraphs = input.trim() === ""
        ? 0
        : input.split(/\n\s*\n/).filter((p) => p.trim().length > 0).length;
      const readingTimeMinutes = Math.ceil(words / 200);
    
      const result = {
        characters: chars,
        characters_no_spaces: charsNoSpaces,
        words,
        lines,
        sentences,
        paragraphs,
        reading_time_minutes: readingTimeMinutes,
        avg_word_length:
          words > 0
            ? +(charsNoSpaces / words).toFixed(1)
            : 0,
      };
    
      return {
        content: [
          { type: "text" as const, text: JSON.stringify(result, null, 2) },
        ],
      };
    }
  • src/tools/text.ts:6-9 (registration)
    Registration of the text_stats tool using the MCP server instance.
    server.tool(
      "text_stats",
      "Analyze text and return detailed statistics: character count, word count, line count, sentence count, paragraph count, and reading time.",
      { input: z.string().describe("The text to analyze") },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully discloses the specific metrics calculated, but omits behavioral traits like read-only safety, idempotency, error handling for empty inputs, or the reading speed assumption for time calculation.

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?

Single sentence structure with zero waste. Front-loaded with the action verb 'Analyze' and immediately specifies the return values. Every word earns its place.

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?

For a single-parameter analytical tool without output schema, the description is reasonably complete by enumerating the six specific metrics returned. Minor gap: lacks behavioral details and reading time calculation methodology.

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 coverage is 100% with the 'input' parameter fully described as 'The text to analyze'. The description aligns with this by referencing 'text' but adds no additional semantic details (format constraints, max length, encoding) beyond the schema baseline.

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 clearly states the specific action ('Analyze text') and enumerates the exact statistics returned (character, word, line, sentence, paragraph counts, and reading time), effectively distinguishing it from sibling tools like text_diff (comparison) and encoding tools.

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?

No explicit guidance provided on when to use this tool versus alternatives (e.g., when to prefer text_diff for analysis), no prerequisites mentioned, and no conditions or exclusions stated.

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/paladini/devutils-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server