Skip to main content
Glama

similarity

Calculate pairwise cosine similarity between two text sets, returning a 2D matrix of scores to measure semantic relatedness.

Instructions

Cosine similarity matrix between two sets of texts.

Args: texts_a: First set of strings (rows of the result matrix). texts_b: Second set of strings (columns of the result matrix). dim: Matryoshka truncation dimension; one of 512, 256, 128, 64, 32.

Returns a dict with a 2D similarity matrix of shape (len(a), len(b)).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dimNo
texts_aYes
texts_bYes
Behavior3/5

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

With no annotations provided, the description carries the transparency burden. It discloses the output shape and the Matryoshka truncation dimension, which hints at the internal embedding mechanism. However, it does not mention potential side effects, performance costs, or prerequisites, leaving an adequate but not complete behavioral picture.

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?

The description is a concise intro followed by an argument list and a return note. Every sentence and line adds essential information with no repetition or extraneous content.

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 tool with modest complexity, no annotations, and no output schema, the description adequately covers purpose, parameters, and return format. It could additionally mention edge cases or explicitly note that raw texts are embedded internally, but the provided information is sufficient for an agent to invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides only titles and types with 0% description coverage, but the description fully compensates by explaining that texts_a forms rows, texts_b forms columns, and dim is a truncation dimension with specific allowed values. This adds crucial semantic meaning far beyond the structured schema.

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 clearly states 'Cosine similarity matrix between two sets of texts,' which uses a specific verb+resource combination. It distinguishes itself from siblings like embed_text and search by focusing on pairwise similarity comparison.

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

Usage Guidelines3/5

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

The description implies its usage for computing a similarity matrix but provides no explicit guidance on when to choose this over alternatives like search. There are no when-not conditions or alternative recommendations, so the applicability is only implied.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Rikka-Botan/Fast-Embedding-MCP-SSE'

If you have feedback or need assistance with the MCP directory API, please join our Discord server