Skip to main content
Glama

Cosine similarity of vectors

bpj_pairs_cosine
Read-onlyIdempotent

Compare direction using the dot product divided by both nonzero Euclidean norms.

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": {
      "x": "<x>",
      "y": "<y>"
    },
    "name": "bpj_pairs_cosine"
  }
}

Input Schema

NameRequiredDescriptionDefault
xYes
yYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

C2.7/5.0
Behavior3/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 the safety profile is covered. The description contributes one genuinely useful behavioral detail: "both nonzero Euclidean norms" signals that a zero vector is an error/undefined case. It says nothing about behavior for mismatched series lengths, tolerance, or the numeric range of the result.

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?

A single front-loaded sentence with no filler; the operative constraint (nonzero norms) comes last but within the same clause. It is efficient, though terse to the point of being cryptic about the output.

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

Completeness2/5

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

For a simple two-parameter math tool with no output schema, the definition should at least establish the JSON-array input format and that the result is a single scalar in [-1, 1]. Neither is present, and the 0% schema coverage leaves the input encoding entirely undocumented, which is a real risk of malformed calls.

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

Parameters2/5

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

Schema description coverage is 0%; the only guidance is parameter titles saying "numeric series (JSON)." The description does not explain that x and y are JSON-encoded arrays of numbers, that they must be equal length, or what happens on parse failure. With zero schema coverage the description should carry this burden and does not.

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

Purpose3/5

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

"Compare direction using the dot product divided by both nonzero Euclidean norms" names the exact computation (cosine similarity) and is distinguishable from error-metric siblings by the words "direction" and "norms." However, it never states the tool's name-level concept ("cosine similarity") nor that it returns a single scalar score, so an agent must decode a formula to know what it gets back. It also gives no hint of how it differs from the closely related bpj_pairs_pearson.

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

Usage Guidelines2/5

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

There is no when-to-use statement, no exclusion, and no named alternative. The description never says to prefer this over correlation or distance tools when scale-invariant direction comparison is wanted, nor when a zero-magnitude vector makes it unusable. Only the implicit math distinguishes it.

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.