Skip to main content
Glama

run_sql_plus_plus_query

Execute SQL++ queries against a Couchbase scope and return JSON results. Use named parameters to bind values and prevent SQL++ injection instead of concatenating user input.

Instructions

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

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 (scalar or vector), prefer the create_query_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.

For relevance-scored, fuzzy, or linguistic full-text search (scoring, highlighting, faceting, fuzzy/phrase/wildcard matching), prefer run_search over SQL++'s SEARCH() function — it keeps FTS-specific result shape (score, fragments, facets) out of general query results and gives clearer tracing of what was searched.

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": "run_sql_plus_plus_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
scope_nameYes
bucket_nameYes
named_parametersNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.1.0
    • removedOutput schema / properties / result / items / additionalProperties
      Removed value: -true
    • removedOutput schema / properties / result / items / type
      Removed value: -"object"
  2. Changed1 schema field changedv0.8.1
    • addedInput schema / properties / named_parameters
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  3. 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
  4. 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"
      +]
  5. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations are empty, so the description carries the full burden. It usefully discloses that scope context is auto-set, that named parameters prevent injection, and that results are a list of JSON values, but it never says whether mutating statements (INSERT/UPDATE/DELETE) are permitted, what permissions are required, or what limits/timeouts apply to arbitrary query execution.

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?

The core behavior is front-loaded in the first sentence, and the remaining paragraphs each serve a routing or correctness purpose. It is somewhat long, but the example and sibling comparisons are not filler.

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?

An output schema exists, so return-value explanation is unnecessary, and the description covers scope semantics and parameter binding well. However, for a tool that runs arbitrary SQL++, the absence of annotations leaves a real gap around read-only vs mutation behavior and permission requirements.

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: it explains the query parameter's scope-relative syntax with a concrete example, clarifies that bucket and scope are supplied separately, and documents named_parameters as the binding mechanism for $name placeholders.

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?

States a specific verb and resource ('Run a SQL++ query on a scope') plus the return shape, and repeatedly distinguishes itself from siblings like create_query_index, list_indexes, and run_search. An agent can identify the tool without opening the 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 routing rules: prefer create_query_index for index creation, list_indexes to verify index readiness, and run_search for relevance-scored/fuzzy/FTS work rather than SQL++ SEARCH(). It also states the scope-context convention that selects correct query syntax.

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