Skip to main content
Glama

tfidf_calculate

Read-onlyIdempotent

Calculate TF-IDF scores to rank documents by relevance to a query, enabling efficient search and information retrieval.

Instructions

Calculate TF-IDF scores to rank documents by relevance to a query.

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": {
      "documents": "<documents>",
      "query": "<query>"
    },
    "name": "tfidf_calculate"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesSearch query.
documentsYesArray of document strings.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.3/5.0
Behavior2/5

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

The annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the safety profile is covered. The description adds no behavioral context beyond that: it says nothing about whether scores are normalized, whether results are sorted, whether zero-relevance documents are omitted, or how ties are handled — all things an agent needs to interpret the returned ranking.

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?

A single sentence with zero filler, front-loaded with the verb and resource. Nothing is redundant and there is no padding to trim.

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

Completeness3/5

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

For a two-parameter pure computation with full annotation coverage this is close to adequate, but with no output schema the description should at least sketch the return shape (e.g., per-document scores vs. a sorted ranking), which it does not. The agent can call it, but cannot anticipate the result structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and both parameters ('query', 'documents') are documented in the schema, so the schema carries the semantics. The description adds no extra meaning such as corpus size expectations, tokenization behavior, or whether documents are treated as pre-tokenized.

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 ('Calculate TF-IDF scores') plus the outcome ('rank documents by relevance to a query'), which is far more informative than a name restatement. It does not name nearby siblings such as cosinesim_compare or jaccard_similarity, so an agent still has to infer that this is the lexical-weighting option rather than a similarity metric.

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

Usage Guidelines3/5

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

The phrase 'to rank documents by relevance to a query' implies the use case (search/ranking over a small in-memory corpus), but there is no explicit when-to-use, when-not-to-use, or referral to an alternative. Usage is inferable, not instructed.

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

Deploy Server

Other Tools