Skip to main content
Glama

Count characters, words and lines

text_stats
Read-onlyIdempotent

Counts exactly what language models are bad at counting: characters (as humans see them), words, lines, sentences, paragraphs, UTF-8 bytes, and occurrences of a letter or substring (e.g. how many "r" in "strawberry"). Use it to check length limits (tweets, SMS, meta descriptions, form fields) before submitting text.

Input Schema

NameRequiredDescriptionDefault
textYesThe text to analyze
countNoOptional letter, word or substring to count occurrences of
overlappingNoFor `count`: count overlapping matches ("aa" in "aaa" = 2). Default false.
case_sensitiveNoFor `count`. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), so the bar is lower. The description still adds real value by clarifying that character counting is grapheme-level ('as humans see them') rather than code units, and by framing the tool as compensating for LLM counting weakness. It does not mention the 200k input limit, which the schema does carry.

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?

Two sentences, both earning their place: the first enumerates capabilities, the second gives the motivating use case. Front-loaded with the core verb and resource, no filler.

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 four-parameter read-only utility with full schema coverage and annotations, the definition is nearly complete. The one real gap is the absence of an output schema combined with no description of the return shape (e.g. a keyed object of counts), which the agent must discover by calling.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description earns a bump by supplying a concrete motivating example for the `count` parameter ('how many "r" in "strawberry"'), which clarifies intent beyond the schema's terse 'Optional letter, word or substring to count occurrences of'. The boolean flags are left entirely to 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?

Names a specific verb (counts) and enumerates the exact resources measured: characters as humans see them, words, lines, sentences, paragraphs, UTF-8 bytes, and substring occurrences. No sibling in this utility set (hash_text, regex_test, validate_*) does this, so the tool is unambiguously distinguishable.

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

Usage Guidelines4/5

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

Gives a clear trigger: check length limits for tweets, SMS, meta descriptions, form fields before submitting text. It states the 'when' concretely but offers no explicit exclusions or alternative tools, which is acceptable since no sibling overlaps in function.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources