Skip to main content
Glama

Similitud entre vectores

vector-similarity
Read-onlyIdempotent

Calcula la similitud coseno, producto punto y distancias euclidiana y Manhattan entre dos vectores. Cuándo: un flujo de agente necesita un resultado exacto y repetible para un paso auxiliar (tokens, costos, reintentos, fragmentos, ranking, limpieza de JSON). No para: ordenar hasta 2.000 vectores por similitud coseno con un vector consulta y devolver los k mejores (vector-top-k). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Computes the cosine similarity, dot product, Euclidean and Manhattan distance between two numeric vectors of equal length (≤ 8,192 dims), plus their L2 norms. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: ranking up to 2,000 candidate vectors by cosine similarity (vector-top-k). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
aYesVector a (array of number; required; at least 1 items; up to 8192 items).
bYesVector b (array of number; required; at least 1 items; up to 8192 items).

Output Schema

NameRequiredDescriptionDefault
dotNo
cosineNo
norm_aNo
norm_bNo
euclideanNo
manhattanNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / a / examples
      Added value: +[
      +  [
      +    1,
      +    0,
      +    1
      +  ]
      +]
    • addedInput schema / properties / b / examples
      Added value: +[
      +  [
      +    1,
      +    1,
      +    0
      +  ]
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Computes the cosine similarity, dot product, Euclidean and Manhattan distance between two numeric vectors of equal length (≤ 8,192 dims), plus their L2 norms. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: ranking up to 2,000 candidate vectors by cosine similarity (vector-top-k). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, and the description reinforces this while adding genuinely new facts: determinism, a 64 KB input cap, 1 s per-call latency, a 1 MB result cap, and the 8,192-dimension limit. The 'side effects: none' sentence partly restates the annotations, which is why this stops short of a 5.

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?

The critical information (what it computes, when to use, when not to, limits) is front-loaded and each clause is informative. It is somewhat dense and the full Spanish text plus an English restatement and a repeated EN block in the schema description create duplication that slightly dilutes scannability.

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?

An output schema exists, so return values need no explanation; the description still covers semantics, routing, determinism, limits and the equal-length constraint. Nothing an agent needs to call this correctly is missing.

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% and both parameters carry descriptions, examples and min/max items, so the baseline of 3 is exceeded. The description adds a cross-parameter constraint not expressible in the schema: the two vectors must be of equal length, which is essential to invoking the tool correctly.

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?

States concrete operations (cosine similarity, dot product, Euclidean and Manhattan distance) on a specific resource (two numeric vectors), plus the L2 norms. It explicitly contrasts itself with the sibling vector-top-k, so an agent can distinguish the two without opening a schema.

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

Usage Guidelines5/5

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

Uses an explicit 'When:' clause naming the appropriate scenarios (tokens, costs, retries, chunking, ranking, JSON clean-up) and an explicit 'Not for:' clause pointing to vector-top-k for top-k ranking. The routing decision is fully specified.

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.

Resources