Skip to main content
Glama

Dispersion of words

dispersion
Read-onlyIdempotent

Measures how evenly words are distributed across parts of a text to distinguish words spread throughout from those concentrated in one place, since frequency alone cannot.

Instructions

Measure how evenly words are spread over a text (Gries's dispersion).

Use it to tell a word that runs through the whole text from a word gathered in one place: frequency does not tell them apart. The text is divided into the given number of parts of about equal size, and the texts of a query link ests://datasets/...? are the parts themselves, so the measure shows whether a word runs through the texts of the corpus.

The result has "n_words" - the number of words of the text, "n_parts" - the number of parts, and "words" - the words in the order of the query or by decreasing frequency, with the frequency "freq" and the measures of dispersion:

  • dp: Gries's deviation of proportions DP, the main measure; 0 - the word is spread in proportion to the sizes of the parts, the largest value of about 1 - 1/n_parts - every occurrence in one part.

  • dp_norm: DP divided by its largest possible value; 1 - every occurrence in the smallest part.

  • juilland_d: Juilland's D; 1 - even, 0 - in one part.

  • carroll_d2: Carroll's D2 by the entropy of the distribution; 1 - even, 0 - in one part.

  • rosengren_s: Rosengren's S; 1 - proportional, about 1/n_parts - in one part.

  • kl_divergence: Kullback-Leibler divergence in bits; 0 - proportional, grows with concentration. A word absent from the text has the frequency 0 and the measures null. A word less frequent than n_parts cannot get into every part, and its measures show concentration even with the most even spread. The key "warnings" lists the warnings: a text not in Spanish, words absent from the text, words less frequent than the number of parts.

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": "dispersion"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoAbsolute path to a UTF-8 text file on the machine where the server runs, or a link ests://datasets/... from find_texts, instead of text: a long text need not be sent in the argument
textNoText in Spanish; path can be given instead
partsNoNumber of parts of the text of about equal size; for a query link ests://datasets/...?<filters> its texts are the parts
top_nNoNumber of the most frequent words if words is not set
wordsNoWords whose dispersion is needed; not set - the most frequent words
lemmatizeNoCompare lemmas: the forms of a word count as one word

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description discloses the return structure, the null-measure behavior for absent words, the statistical caveat that words rarer than n_parts will always look concentrated, the Spanish-only constraint, and the presence of a 'warnings' key. This is substantial behavioral context that annotations do not cover.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and usage are front-loaded efficiently, but a large block enumerates each result field (dp, dp_norm, juilland_d, carroll_d2, rosengren_s, kl_divergence) even though an output schema exists, which is redundant bulk. The core guidance is buried under this reference material.

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 six-parameter analytical tool with an output schema, the description covers everything an agent needs: input source options, part semantics, edge cases (absent words, low frequency relative to parts), language restriction, and warning reporting. Nothing material is left ambiguous.

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 already 100%, so baseline would be 3, but the description adds real meaning: 'parts' is explained as roughly equal-sized divisions or, for an ests:// query link, the texts themselves, and the ordering of 'words' (query order or decreasing frequency) is clarified. Minor remaining gap is that top_n and lemmatize are not elaborated 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 specific verb and measure ('Measure how evenly words are spread over a text (Gries's dispersion)') and immediately contrasts it with frequency-based analysis, which is the most likely source of confusion among siblings. An agent can tell what this tool computes without opening the schema.

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?

It gives a concrete selection criterion: use it to distinguish a word running through the whole text from one gathered in one place, since frequency does not. It does not name any sibling tool as an alternative or state when not to use it, so guidance is clear but not exhaustive.

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