Skip to main content
Glama

semantic_search

Ranks documents by meaning similarity to a query using DashScope embeddings, then returns relevant matches with similarity scores for retrieval and ranking.

Instructions

Rank documents by meaning-similarity to a query (DashScope embeddings).

Embeds the query and all documents in one API call, then ranks by cosine similarity locally. Returns the top_k matches with scores, no vectors.

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>",
      "documents": "<documents>"
    },
    "name": "semantic_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNotext-embedding-v4
queryYes
top_kNo
documentsYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full disclosure burden and does add real value: it reveals that embedding happens in a single API call, ranking happens locally, and vectors are not returned. It omits operational traits that matter for an embedding-backed call — per-call cost scaling with document count, any cap on document array size, model selection effects, and failure behavior on empty or oversized input.

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?

Three short sentences, front-loaded with the purpose and followed by mechanism then return shape. Every clause earns its place — even 'no vectors' and 'locally' are decision-relevant details rather than filler.

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?

An output schema exists, so the description needn't enumerate the response, and it still gives a useful summary ('top_k matches with scores, no vectors'). For a four-parameter embedding tool with no annotations the remaining gaps are modest: the model parameter and practical limits on document volume/cost are the only material omissions.

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%, so the description must compensate, and it does for three of four parameters: 'query' and 'documents' are named as inputs and 'top_k' is explained via 'Returns the top_k matches with scores'. The 'model' parameter (default text-embedding-v4) is never mentioned, leaving one undocumented knob with no guidance on when to change it.

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 ('rank documents by meaning-similarity to a query') plus the underlying mechanism (DashScope embeddings, local cosine ranking), which unambiguously separates it from embed_text and the task-management siblings. It never names the one sibling it genuinely overlaps with, rerank_documents, so an agent must infer the distinction from behavior rather than from an explicit statement.

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?

No explicit when-to-use, when-not-to-use, or alternative routing is given. The mechanism description ('embeds the query and all documents in one API call') implies the intended scenario — you already hold the full candidate set and want a one-shot ranked list — but the agent must derive that, and the closest alternative (rerank_documents) is never addressed.

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