Skip to main content
Glama

Count words

count_words
Read-onlyIdempotent

Use this when the user wants word counts or a word frequency table for a text, for example "which words come up most in these reviews" or "count word frequency". Takes text up to 100,000 characters, a stop-word language (en, es, fr, de, it, pt or none), extra words to leave out, a case rule, a minimum word length and whether to count numbers. Returns totals, what was skipped and why, the top words with counts and percents, and a CSV of all counted words. Uses the same word rules as make_word_cloud. Does not draw a picture, read files, stem words or split Chinese, Japanese or Thai text into words.

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_words"
  }
}

Input Schema

NameRequiredDescriptionDefault
caseNofold (default for text): Apple and apple count as one word, shown in lower case; as_written (default for a word list): case is kept and counted apart.
textYesThe text to count, up to 100,000 characters, e.g. an article, survey answers or meeting notes pasted by the user.
min_lengthNoShortest word to count, in characters, 1 to 20 (default 2), e.g. 3.
stop_wordsNoStop-word list to remove common function words: en (default, English), es, fr, de, it, pt, or none to keep all words. Other languages keep all words, e.g. "es".
exclude_wordsNoExtra words to leave out, up to 100, matched without case, e.g. ["project", "team"].
include_numbersNoCount number-only words such as 2026 (default false).

Output Schema

NameRequiredDescriptionDefault
rulesYes
countsYes
warningsYes
downloadsYes
top_wordsYes
rows_totalYes
preview_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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 readOnly, idempotent, non-destructive and closed-world, so safety is covered; the description adds the 100,000-character input ceiling, the supported stop-word languages, and that returns include skipped items with reasons plus a CSV dump. It stops short of describing truncation behavior or error conditions, which is the main remaining gap.

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?

Front-loaded with the usage trigger and examples, then limits, then returns, then explicit exclusions — a sensible order with no filler. It is a dense single paragraph, so the returns and exclusions sections are harder to scan than they could be with light formatting.

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

Completeness5/5

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

For a single-read tool with a fully documented schema and an output schema, the description covers triggers, input caps, supported languages, output shape and scope boundaries. Nothing an agent needs in order to call this correctly is missing.

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 still earns credit for compressing all six knobs into one scannable sentence and for the cross-tool note that word-splitting rules match make_word_cloud, which the schema cannot express. Minor mismatch: description says 'up to 100' exclude words while the schema allows maxItems 1000.

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?

Opens with a specific trigger and verb+resource ("word counts or a word frequency table for a text") and gives two realistic user phrasings. It also explicitly separates itself from the only sibling by noting it "Does not draw a picture" and that make_word_cloud shares its word rules but produces a visual.

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?

States when to use it (user wants counts or a frequency table, with example utterances) and when not to (no picture, no file reading, no stemming, no CJK segmentation), which routes the agent away from make_word_cloud and from out-of-scope inputs. Nothing about selection is left to inference.

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