Skip to main content
Glama

run_vector_search

Read-only

Run vector similarity searches on a named Couchbase Search index, optionally combining scalar queries for hybrid ranking or prefilters to narrow candidates.

Instructions

Run the Search service's vector search, including hybrid and prefiltered search.

Embedding: vector_query_text is embedded using the model configured via CB_MCP_EMBEDDING_MODEL_PROVIDER/CB_MCP_EMBEDDING_MODEL/CB_MCP_EMBEDDING_MODEL_API_KEY/CB_MCP_EMBEDDING_MODEL_ENDPOINT (plus CB_MCP_EMBEDDING_MODEL_AWS_* for provider=bedrock). If no provider is configured, this tool returns {"success": False, "error": ...} explaining what to set

Unlike run_vector_query's GSI-backed search, this tool always targets a named Search (FTS) index -- index_name is required. Pass both bucket_name and scope_name together to query a scope-level (scoped) index, or omit both to query a cluster-level ("legacy") index. Confirm the index's exact name/location first with list_search_indexes if unsure -- this tool does not pre-validate index_name; a wrong or non-vector index name fails naturally at the Search service with its own error.

scalar_query and prefilter are both optional and both take the same raw FTS query JSON body run_search accepts (e.g. {"match": "jacket", "field": "description"}), but they do different things -- do not confuse them:

  • scalar_query makes this a genuinely hybrid search: both the vector query and this scalar query are sent to the Search service together, and it ranks/combines their hits server-side (a document can match via either signal). is_hybrid in the response reflects whether this was set.

  • prefilter narrows which documents the vector search is even allowed to consider as nearest-neighbor candidates, evaluated before the k-nearest-neighbor search runs -- the Search-service equivalent of run_vector_query's where prefilter on a GSI Composite Vector Index. A document that doesn't match prefilter is never returned, regardless of vector similarity.

Both can be set together (prefilter narrows the candidate pool, then scalar_query's relevance signal still contributes to ranking within it). Omit both for a plain vector-only search through this tool (equivalent in intent to run_vector_query, but against a named Search index instead of a GSI vector index).

num_candidates bounds how many nearest-neighbor candidates the vector query considers; limit bounds how many hits the search as a whole returns, and both default to 10. For a vector-only search (no scalar_query), limit above num_candidates is a no-op -- there are never more than num_candidates vector hits to return. With scalar_query set, limit can meaningfully exceed num_candidates, since scalar_query's own matches aren't bounded by it. fields requests specific stored index fields per hit.

This tool does not fetch full document bodies -- a Search hit carries whatever fields the index stores (row.fields), the same as run_search, not a KV-fetched document (a hit has no reliable per-row collection name to fetch against). Follow up with get_document_by_id for any hit you need the full document for.

Returns {"success": True, "index_name", "vector_field", "num_candidates", "limit", "total_hits", "hits": [{"id", "score", "fields"}], "is_hybrid", "is_prefiltered"} or {"success": False, "error": ...}.

Input Schema

NameRequiredDescriptionDefault
limitNo
fieldsNo
prefilterNo
index_nameYes
scope_nameNo
bucket_nameNo
scalar_queryNo
vector_fieldYes
num_candidatesNo
vector_query_textYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only cover readOnlyHint=true, but the description adds substantive behavior: no index_name pre-validation (wrong names fail naturally at the Search service), a hard failure with {"success": False, "error": ...} when no embedding provider is configured, and the fact that hits carry only stored index fields rather than KV-fetched documents. It also details the interaction semantics of prefilter (applied before KNN) versus scalar_query (server-side hybrid ranking) and the limit/num_candidates no-op relationship.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Long, but front-loaded and well-structured with bullet points separating the two easily-confused parameters, and the closing paragraph states the return shape. A few passages could be tightened — the run_search comparison is restated in two places, and the env-var list is verbose — but almost every sentence carries operative information.

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?

For a 10-parameter tool with zero schema descriptions, the description covers index location, embedding configuration, failure modes, parameter interactions, result shape, and the required follow-up tool for full documents. Even though an output schema exists, the inline return description reinforces it without redundancy.

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?

With 0% schema description coverage, the description carries the full burden and largely succeeds: it explains vector_query_text's embedding pipeline and env vars, index_name's requiredness, the bucket_name/scope_name pairing rule, the distinct roles of scalar_query and prefilter (with an example query body), and the limit vs num_candidates bound semantics. Gaps remain: vector_field is never explained (which field holds the vector), and fields is only glossed as "specific stored index fields per hit" with no format guidance.

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?

Opens with a specific verb+resource ("Run the Search service's vector search") and immediately scopes it to hybrid and prefiltered variants. It explicitly distinguishes itself from run_vector_query (GSI-backed) and repeatedly anchors to "named Search (FTS) index" vs run_search, so an agent can route without opening a schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use rules: pass bucket_name+scope_name together for scoped indexes, omit both for cluster-level legacy indexes, omit both scalar_query and prefilter for plain vector-only search. It names concrete alternatives and prerequisites — list_search_indexes to confirm the index name, get_document_by_id to fetch full documents, run_vector_query for GSI vector indexes.

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