Skip to main content
Glama

Vectores más cercanos (top-k)

vector-top-k
Read-onlyIdempotent

Ordena hasta 2.000 vectores por similitud coseno con un vector consulta y devuelve los k mejores. 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: comparar dos vectores numéricos por coseno, producto punto o distancia euclidiana o Manhattan (vector-similarity). 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: Ranks up to 2,000 candidate vectors by cosine similarity (or negative Euclidean distance) to a query vector and returns the top k with indices and scores; total size capped at 2M numbers. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
kNok (integer; optional; default 5; min 1; max 2000).
queryYesQuery vector (array of number; required; at least 1 items; up to 8192 items).
metricNoMetric (optional; one of: cosine, euclidean; default "cosine").cosine
vectorsYesCandidate vectors (array of array; required; at least 1 items; up to 2000 items).

Output Schema

NameRequiredDescriptionDefault
resultsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / query / examples
      Added value: +[
      +  [
      +    1,
      +    0
      +  ]
      +]
    • addedInput schema / properties / vectors / examples
      Added value: +[
      +  [
      +    [
      +      0,
      +      1
      +    ],
      +    [
      +      1,
      +      1
      +    ],
      +    [
      +      2,
      +      0
      +    ]
      +  ]
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Ranks up to 2,000 candidate vectors by cosine similarity (or negative Euclidean distance) to a query vector and returns the top k with indices and scores; total size capped at 2M numbers. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: comparing two numeric vectors by cosine, dot product, Euclidean or Manhattan distance (vector-similarity). 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/5.0
Behavior4/5

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

Adds real context beyond the annotations: determinism guarantee, size/time limits (64 KB input, 1 s per call, 1 MB result, 2M numbers), and the fact that it returns indices with scores. The read-only/no-network/no-state claims duplicate what readOnlyHint and openWorldHint already declare, so part of the text is redundant.

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?

Information is front-loaded and labeled clearly (Cuándo / No para / Efectos / Límites), which aids scanning. But the Spanish text is followed by a full English duplicate of the same content plus a cross-reference to the schema description, roughly doubling length without adding information.

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

Completeness4/5

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

With annotations covering the safety profile, a complete schema, and an output schema, the description covers everything needed to call it correctly. The only gap is the unresolved tension between the Euclidean metric parameter and the Euclidean exclusion in the guidance.

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%, so all four parameters are already documented with bounds, defaults, and enum. The description only restates the 2,000-vector and 2M-number caps and the top-k semantics, adding little new parameter-level meaning.

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 a specific verb and resource (rank up to 2,000 vectors by cosine similarity to a query vector, return top k with indices and scores) plus the exact scope limit. It explicitly names the sibling vector-similarity as the tool it is not, so an agent can separate 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 Guidelines4/5

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

Provides an explicit When block (exact, repeatable bookkeeping steps) and a Not-for block pointing at vector-similarity. However, the exclusion list includes 'distancia euclidiana' while the tool's own metric enum supports euclidean, which introduces mild ambiguity about when pairwise Euclidean comparison is or isn't appropriate.

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