Skip to main content
Glama

query-plan

Read-only

Compile a SQL statement and return its execution plan without running it, so you can inspect how the query will execute on the database server.

Instructions

dbabrain common.cli query-plan: One database object or the server's activity read: a table, a definition, what runs now, a plan. server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password. Request fields (pass them as request):

  • target: The machine or instance: a server_id, or <db_type> <ip>[:port].

  • credential_name: Which login in users.json; default: the instance's own.

  • sql_access: How to reach the SQL engine - the inventory's (the 8i bridge).

  • database_name: The database to read in; SQL Server: else master.

  • object: table-info / object-source: the object, name, schema.name or [schema].[name].

  • view: db-activity: requests (default) | blocking | waits | top_queries.

  • sql_text: query-plan: the one statement to compile - never run.

  • max_rows: db-activity: rows at most, 1 to 1000 (default 50).

  • timeout_seconds: How long to wait.

  • connection: The database login, complete: db_type, host, port, username, password. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (rules R09).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "query-plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
requestNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior4/5

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

The annotations already establish read-only, open-world, and non-destructive behavior. The description adds useful operational context: credentials are resolved from inventory/secret storage, requests carry no password, and `sql_text` is compiled but never run.

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 description is structured as a field list and contains useful details, but it is dense and awkwardly front-loaded with an internal CLI path before the core purpose. Several parts mix auth behavior, mode selection, and parameter semantics in a way that could be tightened.

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?

For a complex request object with an output schema and existing annotations, the description covers invocation essentials: target resolution, credentials, SQL access, database selection, mode-specific fields, row limits, and timeouts. The main remaining gap is clear guidance for choosing this tool over sibling alternatives.

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 is only a bare `request` object with 0% description coverage, so the description does substantial work by enumerating target, credential_name, sql_access, database_name, object, view, sql_text, max_rows, timeout_seconds, and connection. It also supplies defaults and constraints for some fields, though the mode mapping and password guidance are not fully coherent.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names specific resources and modes, including table, definition, activity, and plan, but it spans query-plan, object-source/table-info-style reads, and db-activity-style reads. The tool's primary purpose and its distinction from similarly named sibling tools remain muddled.

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 by the request fields: `object` for object reads, `view` for db-activity, and `sql_text` for query-plan. However, it does not explicitly say when to use this tool instead of siblings such as table-info, object-source, or db-activity, nor does it state exclusions.

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

Deploy Server

Other Tools