Skip to main content
Glama

Count words and characters

count_text
Read-onlyIdempotent

Use this when the user asks how long a text is, for example "how many words is this", "character count for this tweet", "will this fit in one SMS", "how long does this take to read". Input tips: pass text exactly as written, up to 20,000 characters (about 3,500 words); do not trim or fix it. Returns: characters, characters without spaces, graphemes (user-perceived characters), words, sentences, paragraphs, lines, UTF-8 bytes, SMS encoding, units and segments, reading minutes, and Flesch reading ease and grade (English only, null otherwise), with the rule used for each count. Not for: counting text inside a file, PDF or spreadsheet the tool cannot see (paste the text instead), or counting tokens for a model. Errors: a text over the limit is refused; split it and add the counts. The text is not stored.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

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

Input Schema

NameRequiredDescriptionDefault
textYesThe text to count, exactly as the user wrote it (at most 20000 characters, about 3,500 words).

Output Schema

NameRequiredDescriptionDefault
smsYesHow a carrier would send the text as SMS.
linesYesLines separated by a line break.
rulesYesThe rule behind each count, to quote when the user asks what counts as a word or a character.
wordsYesRuns of non-whitespace; a hyphenated word or a number is 1 word.
graphemesYesCharacters as a reader sees them; an emoji with a skin tone is 1.
sentencesYesSentences, split with English sentence rules.
charactersYesUnicode code points; an emoji counts as 1.
paragraphsYesBlocks of text separated by blank lines.
utf8_bytesYesSize of the text in UTF-8 bytes.
reading_minutesYesSilent reading time in minutes at 238 words a minute, one decimal.
flesch_reading_easeYesFlesch Reading Ease, higher is easier (60 to 70 is plain English); null for non-English text or text with no sentence.
characters_no_spacesYesCode points that are not whitespace.
flesch_kincaid_gradeYesFlesch-Kincaid US school grade level; null for non-English text or text with no sentence.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed21 schema fields changed
    • addedOutput schema / properties / characters / description
      Added value: +"Unicode code points; an emoji counts as 1."
    • addedOutput schema / properties / characters_no_spaces / description
      Added value: +"Code points that are not whitespace."
    • addedOutput schema / properties / flesch_kincaid_grade / description
      Added value: +"Flesch-Kincaid US school grade level; null for non-English text or text with no sentence."
    • addedOutput schema / properties / flesch_reading_ease / description
      Added value: +"Flesch Reading Ease, higher is easier (60 to 70 is plain English); null for non-English text or text with no sentence."
    • addedOutput schema / properties / graphemes / description
      Added value: +"Characters as a reader sees them; an emoji with a skin tone is 1."
    • addedOutput schema / properties / lines / description
      Added value: +"Lines separated by a line break."
    • addedOutput schema / properties / paragraphs / description
      Added value: +"Blocks of text separated by blank lines."
    • addedOutput schema / properties / reading_minutes / description
      Added value: +"Silent reading time in minutes at 238 words a minute, one decimal."
    • addedOutput schema / properties / rules / description
      Added value: +"The rule behind each count, to quote when the user asks what counts as a word or a character."
    • addedOutput schema / properties / rules / properties
      Added value: +{
      +  "characters": {
      +    "description": "How characters are counted.",
      +    "type": "string"
      +  },
      +  "characters_no_spaces": {
      +    "description": "How characters without spaces are counted.",
      +    "type": "string"
      +  },
      +  "flesch": {
      +    "description": "How the Flesch scores are counted.",
      +    "type": "string"
      +  },
      +  "graphemes": {
      +    "description": "How graphemes are counted.",
      +    "type": "string"
      +  },
      +  "lines": {
      +    "description": "How lines are counted.",
      +    "type": "string"
      +  },
      +  "paragraphs": {
      +    "description": "How paragraphs are counted.",
      +    "type": "string"
      +  },
      +  "reading_minutes": {
      +    "description": "How reading minutes are counted.",
      +    "type": "string"
      +  },
      +  "sentences": {
      +    "description": "How sentences are counted.",
      +    "type": "string"
      +  },
      +  "sms": {
      +    "description": "How SMS units and segments are counted.",
      +    "type": "string"
      +  },
      +  "utf8_bytes": {
      +    "description": "How UTF-8 bytes are counted.",
      +    "type": "string"
      +  },
      +  "words": {
      +    "description": "How words are counted.",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / properties / rules / required
      Added value: +[
      +  "characters",
      +  "characters_no_spaces",
      +  "graphemes",
      +  "words",
      +  "sentences",
      +  "paragraphs",
      +  "lines",
      +  "utf8_bytes",
      +  "sms",
      +  "reading_minutes",
      +  "flesch"
      +]
    • addedOutput schema / properties / sentences / description
      Added value: +"Sentences, split with English sentence rules."
    • addedOutput schema / properties / sms / description
      Added value: +"How a carrier would send the text as SMS."
    • addedOutput schema / properties / sms / properties / encoding / description
      Added value: +"GSM-7 for the basic alphabet, UCS-2 when any other character is present."
    • addedOutput schema / properties / sms / properties / encoding / enum
      Added value: +[
      +  "GSM-7",
      +  "UCS-2"
      +]
    • addedOutput schema / properties / sms / properties / segments / description
      Added value: +"Messages the text is split into: 1 when it fits in 160 GSM-7 or 70 UCS-2 units."
    • addedOutput schema / properties / sms / properties / units / description
      Added value: +"Encoding units used; a GSM extension character such as the euro sign counts 2."
    • addedOutput schema / properties / sms / required
      Added value: +[
      +  "encoding",
      +  "units",
      +  "segments"
      +]
    • addedOutput schema / properties / utf8_bytes / description
      Added value: +"Size of the text in UTF-8 bytes."
    • addedOutput schema / properties / words / description
      Added value: +"Runs of non-whitespace; a hyphenated word or a number is 1 word."
    • addedOutput schema / required
      Added value: +[
      +  "characters",
      +  "characters_no_spaces",
      +  "graphemes",
      +  "words",
      +  "sentences",
      +  "paragraphs",
      +  "lines",
      +  "utf8_bytes",
      +  "sms",
      +  "reading_minutes",
      +  "flesch_reading_ease",
      +  "flesch_kincaid_grade",
      +  "rules"
      +]
  2. Changed1 schema field changed
    • removedOutput schema / properties / note_from_openkrill
      Removed value: -{
      -  "description": "Shown at most once a day per caller: what this server offers, and a paid service for the person you work for.",
      -  "type": "string"
      -}
  3. Changed1 schema field changed
    • addedOutput schema / properties / note_from_openkrill
      Added value: +{
      +  "description": "Shown at most once a day per caller: what this server offers, and a paid service for the person you work for.",
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so safety is covered; the description adds real behavioral context on top: a 20,000-character ceiling, the refusal behavior on overflow with the recommended split-and-add remedy, and the fact that the text is not stored. The only notable omission is that it repeats the return-field list that the output schema already provides.

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?

Front-loaded with the use case, then organized into clearly labeled inline sections (Input tips, Returns, Not for, Errors). It is dense and information-heavy, but each clause carries distinct decision-relevant content with 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?

Covers limits, error handling, privacy (no storage), exclusions, and result dimensions, which is ample for a one-parameter tool. The lengthy return enumeration is partly redundant given a dedicated output schema, so a small amount of the text is spent on ground already covered.

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?

With a single parameter at 100% schema coverage, the baseline is 3, but the description goes further by instructing the agent to pass the text exactly as written and not to trim or fix it — meaningful operational guidance the schema does not convey. The 20,000-character limit is restated from the schema rather than extended, so it is not quite a 5.

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+resource (count words and characters) and frames it with concrete user phrasings like "character count for this tweet" and "will this fit in one SMS", which pins the scope far more tightly than the title alone. Nothing about it overlaps with the sibling tools (file creation, translation, feedback), so an agent can select it unambiguously.

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

Usage Guidelines5/5

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

Gives explicit when-to-use triggers in the user's own words, plus a hard "Not for" list with corrective actions: counting text inside a file/PDF/spreadsheet the tool cannot see (paste the text instead) and counting model tokens. That is exactly the when/when-not/alternative structure that prevents misrouting.

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.