Skip to main content
Glama

embedding_similarity

Read-onlyIdempotent

Compute a deterministic similarity score between two embedding vectors using a selected metric like cosine. Validates equal vector lengths and returns the similarity score for comparison tasks.

Instructions

Score the similarity between two caller-supplied embedding vectors with a supported deterministic metric (default embeddings.cosine_similarity). This tool does not generate embeddings from text — call embeddings first to produce the vectors. left and right must have equal length or the call fails with invalid_embedding_dimensions. Read-only and deterministic. Returns the resolved model id, similarity_metric, the score, and the shared vector dimension.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leftYesFirst embedding vector; length must equal right's.
modelNoSimilarity model id from list_models; selects the metric.embeddings.cosine_similarity
rightYesSecond embedding vector; length must equal left's.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.3
    • addedInput schema / properties / left / description
      Added value: +"First embedding vector; length must equal right's."
    • addedInput schema / properties / model / description
      Added value: +"Similarity model id from list_models; selects the metric."
    • addedInput schema / properties / right / description
      Added value: +"Second embedding vector; length must equal left's."
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Beyond annotations (readOnlyHint, idempotentHint), the description discloses deterministic behavior, the exact failure condition (invalid_embedding_dimensions on unequal lengths), and the precise return fields. This is substantive behavioral context that an agent needs to handle errors and interpret results.

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?

Four sentences, each earning its place: purpose, key exclusion, constraint/failure, and read-only/return behavior. Information is front-loaded and there is no filler or repetition of schema content.

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?

Despite lacking an output schema, the description names all returned fields (resolved model id, similarity_metric, score, shared vector dimension) and the failure mode. Given the simple parameter set and strong annotations, nothing an agent needs to call 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%, so the baseline is 3. The description adds real value by specifying that left and right must have equal length or the call fails, and by noting that model selects the metric (reinforcing the schema's own note). This failure-mode detail is not in the schema, so the score is above baseline.

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 ('Score') and resource ('similarity between two caller-supplied embedding vectors') and explicitly differentiates itself from embeddings generation by naming the embeddings tool as the prerequisite. This makes it unmistakable among the large sibling set.

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 clear usage context by stating that embeddings must be produced first and that this tool does not generate them. It stops short of naming alternative similarity/ranking tools or giving explicit 'when not to use' instructions beyond the embeddings prerequisite, but the guidance is unambiguous for the core workflow.

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

Deploy Server

Other Tools