Skip to main content
Glama

run_sql_plus_plus_query

Execute SQL++ queries on a Couchbase scope and return JSON results. Use named parameters to bind values securely and avoid injection.

Instructions

Run a SQL++ query on a scope and return the results as a list of JSON objects.

The query will be run on the specified scope in the specified bucket. The query should use collection names directly without bucket/scope prefixes, as the scope context is automatically set.

Use named_parameters to bind values to $name placeholders in the query instead of concatenating user input into the statement. This prevents SQL++ injection

Example: query = "SELECT * FROM users WHERE age > 18" # Incorrect: "SELECT * FROM bucket.scope.users WHERE age > 18"

For creating a new index, prefer the create_index tool over a raw CREATE INDEX statement here — it defers the build by default and tells you the recommended next step. Use list_indexes to check whether an index is online before relying on it in a query plan.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
scope_nameYes
bucket_nameYes
named_parametersNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv0.8.1
    • addedInput schema / properties / named_parameters
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  2. Changed8 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: -"run_sql_plus_plus_queryArguments"
    • removedOutput schema / properties / result / title
      Removed value: -"Result"
    • removedOutput schema / title
      Removed value: -"run_sql_plus_plus_queryOutput"
    • addedOutput schema / x-fastmcp-wrap-result
      Added value: +true
  3. Changed2 schema fields changedv1.0.0
    • addedInput schema / properties / bucket_name
      Added value: +{
      +  "title": "Bucket Name",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "scope_name",
      -  "query"
      -]New value: +[
      +  "bucket_name",
      +  "scope_name",
      +  "query"
      +]
  4. First observed

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations present, the description carries the behavioral disclosure burden. It explains that the scope context is automatically set, that named parameters are the injection-safe binding mechanism, and that results are returned as JSON objects. It stops short of mentioning side-effect potential for mutating queries, but the inclusion of CREATE INDEX guidance implies mutability.

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 well-structured and front-loaded: purpose, scoping rule, security guidance, example, and sibling tool routing. Every sentence contributes useful decision-making or invocation detail with minimal redundancy.

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?

Given that an output schema exists, return-value details are already covered. The description provides enough operational context for the agent to invoke the tool correctly, including naming rules, parameter binding, and when to use alternative tools.

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?

The input schema has 0% description coverage, so the tool description must compensate. It explains the query parameter's naming convention, the role of named_parameters with $name placeholders, and the bucket/scope context. This covers most parameters indirectly, though bucket_name and scope_name formats are left to inference.

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 starts with a specific action, 'Run a SQL++ query on a scope and return the results as a list of JSON objects,' which clearly identifies the verb and resource. It further distinguishes itself from sibling diagnostic and explain tools by emphasizing execution and result output.

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?

The description gives concrete usage guidance: use collection names without bucket/scope prefixes, bind parameters via named_parameters to prevent injection, and prefer create_index over raw CREATE INDEX. It also references list_indexes as a complementary tool, giving the agent explicit routing cues.

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

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/couchbase/mcp-server-couchbase'

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