Skip to main content
Glama

Semantic similarity ranking

similarity
Read-only

Ranks up to 15 candidate texts by cosine similarity to a query, using @cf/baai/bge-base-en-v1.5 embeddings. Returns { model, ranked: [{ index, score }] (highest first), scores: number[] (input order) } Price: 3 credits (1 credit = 1 US cent) per successful call; input that does not match the schema is rejected before billing.

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": {
      "query": "<query>",
      "candidates": "<candidates>"
    },
    "name": "similarity"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesQuery text, up to 2000 characters.
candidatesYes1 to 15 candidate texts, each up to 2000 characters.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and closed-world, but the description goes well beyond them: it names the exact model, specifies the return shape with ordering semantics ('highest first' for ranked, input order for scores), and discloses pricing (3 credits per successful call) plus the fact that schema-invalid input is rejected before billing. That billing/validation detail is genuinely decision-relevant and not present in any structured field.

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?

Two sentences, both front-loaded with the highest-value facts: what it does and which model, then return shape and cost. Every clause carries information an agent would otherwise have to discover, and nothing is repeated from the schema.

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?

With no output schema present, the description compensates by spelling out the return object and ordering. Combined with the cost model, the model identifier, and the rejection-before-billing behavior, an agent has everything needed to invoke this correctly and predict the response.

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 both parameters are already fully documented with types and length bounds, which sets the baseline at 3. The description reinforces the 15-candidate limit and clarifies that scoring is query-vs-candidates rather than pairwise, adding a small amount of semantic framing but no new syntax or format detail.

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?

States a specific verb and resource ('ranks candidate texts by cosine similarity to a query') plus the exact embedding model used, which is far more precise than a generic 'semantic similarity' restatement. It does not reference sibling tools such as 'embed' or 'find-similar', so an agent must infer the boundary itself.

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 ranking framing and the hard cap of 15 candidates imply the intended use case (reranking a small shortlist against one query), but there is no explicit 'use this when / use X instead' statement and no mention of alternatives for embedding generation or large-corpus search. Usage is inferable rather than stated.

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