Skip to main content
Glama

explain_query

Generate CockroachDB statement plans to optimize SQL queries. Use EXPLAIN or EXPLAIN ANALYZE to analyze query execution and obtain performance statistics for improved database efficiency.

Instructions

Return CockroachDB's statement plan for a preparable statement. You can use this information to optimize the query. If you run it with Analyze, it executes the SQL query and generates a statement plan with execution statistics.

Args: query (str): SQL query to explain. analyze (bool): If True, run EXPLAIN ANALYZE.

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analyzeNo
queryYes
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that the tool returns a statement plan and can execute the query with 'analyze' for statistics, covering key behavioral aspects. However, it lacks details on potential side effects (e.g., if 'analyze' affects database state), error handling, or performance implications, leaving some gaps.

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 description is well-structured with a purpose statement, usage guidance, and parameter explanations in separate sections. It is appropriately sized and front-loaded, but the 'Returns' section is somewhat vague ('A success message or an error message'), slightly reducing efficiency.

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?

Given the complexity of a database explanation tool with 2 parameters, no annotations, and no output schema, the description is moderately complete. It covers purpose, usage, and parameters but lacks details on output format, error cases, or integration with sibling tools, which would enhance completeness for this context.

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 schema description coverage is 0%, so the description must compensate. It explicitly documents both parameters ('query' and 'analyze') with clear semantics: 'SQL query to explain' and 'If True, run EXPLAIN ANALYZE'. This adds significant value beyond the bare schema, though it could provide more detail on query format or analyze effects for a higher score.

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 clearly states the tool's purpose: 'Return CockroachDB's statement plan for a preparable statement' and 'use this information to optimize the query'. It specifies the verb ('return'), resource ('statement plan'), and target system ('CockroachDB'), distinguishing it from siblings like execute_query or analyze_performance by focusing on query explanation rather than execution or performance analysis.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool ('to optimize the query') and mentions the 'analyze' parameter for execution statistics. However, it does not explicitly state when not to use it or name specific alternatives among the sibling tools (e.g., execute_query for actual query execution), which prevents a perfect score.

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

Install Server

Other Tools

Related Tools

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/amineelkouhen/mcp-cockroachdb'

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