Skip to main content
Glama

get_index_advisor_recommendations

Read-only

Analyzes a SQL++ query with Couchbase Index Advisor and returns recommended secondary and covering indexes for the specified bucket and scope.

Instructions

Get index recommendations from Couchbase Index Advisor for a given SQL++ query.

The Index Advisor analyzes the query and provides recommendations for optimal indexes. This tool works with SELECT, UPDATE, DELETE, or MERGE queries. The queries will be run on the specified scope in the specified bucket.

Returns a dictionary with:

  • current_used_indexes: Array of currently used indexes (if any)

  • recommended_indexes: Array of recommended secondary indexes (if any)

  • recommended_covering_indexes: Array of recommended covering indexes (if any)

Each index object contains:

  • index: The CREATE INDEX SQL++ command

  • statements: Array of statement objects with the query and run count

Raises an error carrying the advisor's message if the advisor cannot analyse the statement (for example, a SQL++ syntax error).

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": {
      "bucket_name": "<bucket_name>",
      "scope_name": "<scope_name>",
      "query": "<query>"
    },
    "name": "get_index_advisor_recommendations"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
scope_nameYes
bucket_nameYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.8.0
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / bucket_name / title
      Removed value: -"Bucket Name"
    • removedInput schema / properties / query / title
      Removed value: -"Query"
    • removedInput schema / properties / scope_name / title
      Removed value: -"Scope Name"
    • removedInput schema / title
      Removed value: -"get_index_advisor_recommendationsArguments"
    • removedOutput schema / title
      Removed value: -"get_index_advisor_recommendationsDictOutput"
  2. Addedv1.0.0

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, and the description adds genuine context beyond that: it discloses the error behavior when the advisor cannot analyze the statement (e.g., syntax errors). However, the sentence 'The queries will be run on the specified scope in the specified bucket' is ambiguous for a read-only tool that accepts UPDATE/DELETE/MERGE — an agent could read it as execution rather than analysis, which is a real clarity risk. It stops short of a contradiction, but it is not a clean disclosure either.

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

Conciseness3/5

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

The lead sentence is front-loaded and useful, and the supported-statement list earns its place. But a large block restates the return dictionary and per-index object fields even though an output schema exists, which duplicates structured data rather than adding meaning. Roughly half the text is redundant with the output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter read-only analysis tool with an output schema and readOnlyHint annotation, the essentials are mostly covered: purpose, accepted query types, error behavior. Gaps remain around parameter semantics (0% schema coverage) and the ambiguous 'will be run' wording, and the return-value enumeration is redundant given the output schema. An agent could call it correctly but might hesitate over whether the query is executed.

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

Parameters3/5

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

Schema description coverage is 0%, so all three parameters (bucket_name, scope_name, query) are undocumented in the schema and the description must compensate. It does partially: the query is identified as a SQL++ statement and the bucket/scope are described as the execution context, which conveys their roles. It adds no format detail, such as whether the query must use fully qualified keyspace paths or how bucket/scope interact with the query text.

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?

The first sentence names a specific verb and resource (index recommendations from the Couchbase Index Advisor) and scopes it to a given SQL++ query. It also enumerates supported statement types (SELECT, UPDATE, DELETE, MERGE), which sharpens the purpose further. It does not, however, distinguish itself from near-neighbors such as explain_sql_plus_plus_query, list_indexes, or get_queries_not_using_covering_index, 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?

Usage is implied rather than stated: the agent learns the tool analyzes a query and works for four statement types, which suggests 'use when you want index advice for a specific query.' There is no explicit when-to-use/when-not, no mention of prerequisites (e.g., whether indexes must already exist or whether the collection must be loaded), and no routing to sibling tools that also deal with indexes or query explanation.

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