Skip to main content
Glama

neighbors

Find k nearest rows or a point in high-dimensional data, returning distances, positions, selected columns, and relative contrast vs a random row. Supports scikit-learn metrics and standardization.

Instructions

k nearest neighbours of one row (index = row label or integer position) or of an explicit point (vector in feature order), in the original high-dimensional space. Returns distances, positions and a few columns of each neighbour, plus how those distances compare with the distance to a random row (relative contrast). metric: any scikit-learn metric (euclidean, cosine, manhattan, ...); cosine is usually the right choice for embeddings and other hub-prone spaces. standardize: False (default), True or 'auto'.

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": {
      "name": "<name>"
    },
    "name": "neighbors"
  }
}

Input Schema

NameRequiredDescriptionDefault
kNo
nameYes
indexNo
pointNo
metricNoeuclidean
columnsNo
featuresNo
standardizeNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does reasonably well: it discloses that results include distances, positions, selected columns, and a relative-contrast measure against a random row. It never states explicitly that the operation is read-only and non-mutating, nor what happens if both index and point are omitted, which keeps it from 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 content is front-loaded with the core definition before the return description and per-parameter notes, and nearly every clause adds information an agent needs. Some sentences are dense and the metric/standardize notes read like a run-on list, but there is little genuinely wasted text.

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?

For an 8-parameter query tool with a full output schema, the description covers inputs, cost-relevant options (metric, standardize), and the shape of results, so an agent can invoke it correctly. The main omission is the required 'name' argument and any statement of read-only safety, which matter given the absence of annotations.

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 description coverage is 0% across 8 parameters, so the description must compensate, and it covers most of them: k (implicit in 'k nearest neighbours'), index (row label or integer position), point (vector in feature order), metric (any scikit-learn metric with a recommendation), standardize (False/True/'auto'), features (feature order for the point), and columns ('a few columns of each neighbour'). Only the required 'name' parameter is left unmentioned, and formats such as string-vs-list for columns/features are not clarified.

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?

The description names a specific operation (k nearest neighbours) and its two input modes — an existing row identified by label or integer position, or an explicit feature vector — and scopes it to the original high-dimensional space. This clearly separates it from siblings like project, cluster, or tensor_transform, which are dimensionality-reduction or grouping operations.

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?

It gives actionable selection guidance: use cosine 'usually ... for embeddings and other hub-prone spaces', and choose index vs. point depending on whether the query is an existing row or an external vector. It does not explicitly say when to prefer this tool over siblings such as project or cluster, so there is a small gap.

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