Skip to main content
Glama

Collocations

collocations
Read-onlyIdempotent

Identify word pairs that co-occur more often than chance in Spanish text to reveal set phrases, terminology, and a target word's typical neighbors.

Instructions

Find the collocations of a text - pairs of words that occur together more often than by chance.

Use it for set phrases, terminology and the company of a word (the parameter node; side - only the words before or after it). A pair is ordered: the right word stands at most window words after the left one. The lemmas are those of esMorph in the context of the sentence, as kwic finds them with by_lemma. The texts of a query link ests://datasets/...? go one after another, and at the junction of two texts the pairs are made of the words of both: the company within one text is more exact by a link to it.

The result has "n_words" - the number of words of the text, "measure" - the measure and how to read it, and "collocations" - the pairs by decreasing measure: the left word "left", the right word "right", their frequencies "freq_left" and "freq_right", the frequency of the pair "freq_pair" and the value of the measure "score". freq_pair is the number of pairs of positions where the right word stands in the window after the left one: a word repeated in the window gives several pairs, so freq_pair can exceed the frequency of a word, and such a pair is a repetition, not a set phrase. The key "warnings" lists the warnings: a text not in Spanish, the word node is not in the text, no pairs of such frequency.

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

Input Schema

NameRequiredDescriptionDefault
nodeNoWord whose company is needed; not set - all the pairs
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
sideNoSide of the company of node: left - the words before it, right - after it; not set - on both sides
textNoText in Spanish; path can be given instead
top_nNoNumber of collocations in the response
windowNoLargest distance between the words of a pair; 1 - bigrams
measureNoAssociation measure: logdice - the strength of a pair, independent of the size of the text; mi overrates rare pairs; mi3 and t_score favour frequent oneslogdice
min_freqNoSmallest freq_pair - the number of pairs of positions in the window
lemmatizeNoCompare lemmas: estado de ánimo and estados de ánimo give one pair

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

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

Annotations already declare a safe read-only, idempotent, closed-world operation, yet the description still adds real behavioral context: the text-junction caveat (pairs are formed across consecutive texts unless you link to one), the meaning of freq_pair versus word frequency (repetitions are not set phrases), and the 'warnings' key for non-Spanish text, absent node, or no qualifying pairs. These are exactly the non-obvious traits an agent needs before invoking.

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 opening is well front-loaded, but a substantial middle block enumerates return fields (n_words, measure, left/right/freq_*, score) that an output schema already supplies, which dilutes the payoff. Phrasing is dense and occasionally repetitive ('the company of a word' recurs), so the description is longer than it needs to be even though most sentences carry information.

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 9-parameter tool, the definition covers input selection (text vs. path/ests link), scoping (node/side/window), measure interpretation, and output caveats including warnings and cross-text junction behavior. Combined with the existing annotations and output schema, an agent has everything needed to call it correctly and read the result.

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 baseline is 3, but the description adds meaning beyond the schema: it defines the ordered/directional nature of a pair ('the right word stands at most window words after the left one'), explains that lemmatization follows esMorph/kwic lemmas in sentence context, and deepens min_freq by clarifying that freq_pair counts positional pairs so it can exceed a word's frequency. That is genuine semantic value over the field descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb+resource ('Find the collocations of a text') and immediately defines the concept ('pairs of words that occur together more often than by chance'), so an agent knows exactly what is produced. It also anchors itself to siblings ('the lemmas ... as kwic finds them with by_lemma', 'a link ests://datasets/... from find_texts'), which clarifies the relationship without an explicit 'use X instead' statement.

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 states clear usage contexts ('set phrases, terminology and the company of a word') and explains the node/side scoping that selects the intended use. It even gives a practical rule of thumb ('the company within one text is more exact by a link to it'), implying one should prefer path-linked single texts. What is missing is an explicit exclusion, e.g. when kwic or keyness is the better choice.

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