Skip to main content
Glama

Keywords

keyness
Read-onlyIdempotent

Identify words or phrases significantly more or less frequent in a Spanish text than a reference dictionary or another text, revealing distinctive vocabulary.

Instructions

Find the keywords of a text - words significantly more (or less) frequent in it than in a reference.

Use it to see how the vocabulary of a text differs from the language at large (the default reference is the frequency dictionary, downloaded by the command ests-mcp download) or from another text (reference or reference_path). Against the dictionary the words of the text are read in the context of their sentences and compared by the lemmas of the dictionary (a verb takes the first of its verb analyses: fue - ser, also in fue a casa), a proper noun by the lemma of its form taken alone, under which the dictionary counts the proper nouns as well, so a name that is also a form of another word appears as that word's lemma (Tomás - tomar, Batiste - batir); numbers and words with a hyphen, a period or letters outside Spanish are left out, and a word outside the dictionary gets its smallest frequency, so names, terms and typos get into the keywords. Against a text the words are compared in lower case, the lemmas by esMorph in the context of the sentence; with n from 2 - phrases of n consecutive words, which do not run across the end of a sentence nor the boundary of the texts of a query link ests://datasets/...?.

The result has "n_words" - the number of words of the text compared with the reference, "reference" - the reference, "measure" - the measure of the sorting and how to read it, and "keywords" - the words by decreasing measure: the frequency in the text "freq_target" and in the reference "freq_reference", the same per million words "ipm_target" and "ipm_reference", the log-likelihood "g2" (the significance, negative - the word is more frequent in the reference) with its p-value "p_value", Log Ratio "log_ratio" (the effect size; with a zero frequency in the reference - an estimate with the correction 0.5, can be below 0) and the value of the measure "score". p_value is not corrected for the number of words tested: p < 0.0001 (g2 from 15.13) is more reliable. The key "warnings" lists the warnings: a text not in Spanish, no keywords.

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

Input Schema

NameRequiredDescriptionDefault
nNoLength of the n-grams: 1 - words, 2-3 - phrases of consecutive words within a sentence, only against a reference text; with lemmatize these are phrases of lemmas (el casa), and kwic finds them with by_lemma=true
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
top_nNoNumber of keywords in the response
measureNoMeasure of the sorting: log_likelihood - the significance of the difference, log_ratio - how many times more frequent the word islog_likelihood
min_freqNoSmallest frequency of a word where it is more frequent
positiveNoWords more frequent in the text; false - more frequent in the reference
lemmatizeNoCompare lemmas; against the frequency dictionary lemmas are always compared
referenceNoReference text; not set (nor reference_path) - the frequency dictionary of Google Books Ngram (Spanish books of 1980-2019)
reference_pathNoAbsolute path to a file with the reference text or a link ests://datasets/... from find_texts instead of reference; a query link - all its texts as one reference

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?

Goes well past the readOnly/idempotent annotations: it explains lemma resolution (fue - ser, Tomás - tomar), that numbers, hyphenated words and non-Spanish letters are dropped, that out-of-vocabulary words get the smallest frequency, that n-grams do not cross sentence or text boundaries, and that p_value is uncorrected (p < 0.0001 is more reliable). It also warns about the 'warnings' key for non-Spanish text or empty keyword sets.

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?

Nearly all content is substantive, but it is delivered as one dense block of semicolon-chained clauses with deeply nested parentheses, so the most important facts (what the tool does, the dictionary default) compete with lemma edge cases. Front-loading the purpose is done well, yet the body could be split for scanability.

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 10-parameter, statistically oriented tool, the description covers the comparison modes, edge-case word handling, n-gram boundaries, and statistical caveats. It also restates the result keys despite an output schema existing, which is redundant but leaves no gap in understanding what comes back or how to read it.

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 nevertheless adds conceptual meaning, notably the restriction that n >= 2 phrases work only against a reference text and how the frequency-dictionary versus text comparison modes differ in how they read words. It does not cover every parameter (e.g. top_n, min_freq, measure) beyond what the schema already says, so it is above baseline but not exhaustive.

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?

States a specific verb and resource: 'Find the keywords of a text - words significantly more (or less) frequent in it than in a reference.' The contrast with a reference is a real scope statement, but the description never distinguishes this from the sibling compare_texts, leaving the agent to infer which comparative tool to pick.

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?

'Use it to see how the vocabulary of a text differs from the language at large ... or from another text' gives clear context for the two supported comparison modes and names the default reference dictionary and the download command that supplies it. It stops short of exclusions or of naming alternatives for the overlapping case (comparing two texts), so it is clear context without routing guidance.

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