Skip to main content
Glama

UK Data: Maths and statistics

cosine_similarity

Read-onlyIdempotent

Calculates the cosine similarity between two vectors, returning a value between -1 and 1 where 1 indicates identical direction. (cost: 1 credit)

Input Schema

NameRequiredDescriptionDefault
vector_aNoarray of numbers, required, the first vector
vector_bNoarray of numbers, required, the second vector (must be same length as vector_a)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and openWorld, so the safety profile is covered. The description adds two useful behavioral facts beyond that: the output range (-1 to 1 with directional meaning) and the cost of 1 credit. It says nothing about failure behavior, e.g. what happens when vector lengths differ or when inputs are given as strings rather than number arrays.

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 front-loaded sentence stating the operation, its output range and interpretation, with the cost in a short parenthetical. No filler and no redundancy with the title or annotations.

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 a two-parameter, side-effect-free computation with no output schema, the definition covers purpose, return range and cost, which is nearly everything an agent needs. The remaining gap is input-format and error handling, particularly the anyOf schema that technically permits string vectors despite the schema text saying 'array of numbers'.

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 both parameters and the equal-length constraint are already documented in the schema. The description adds no parameter-level meaning beyond that, which is the expected baseline of 3 when the schema does the work.

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?

The description names a specific verb ('Calculates') and resource ('cosine similarity between two vectors') and even states the output range and its interpretation, so the operation is unambiguous. It does not name a sibling such as euclidean_distance to distinguish itself, which is the only thing keeping it from a 5.

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 guidance on when to choose this tool over alternatives in the large sibling set (euclidean_distance, average, linear_regression_prediction, etc.), nor any stated preconditions such as equal vector lengths or numeric input format. The agent must infer all selection logic from the tool name and schema.

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