Skip to main content
Glama
NekoTarou

kingbase-mcp-server

by NekoTarou

Explain Query

kb_explain
Idempotent

Analyze SQL query performance by retrieving execution plans. Identify full table scans, join strategies, and optimize queries with optional real timing data.

Instructions

Get the execution plan for a SQL query using EXPLAIN.

Use this to analyze query performance, identify full table scans, and optimize queries.

Args:

  • sql (string): The SQL query to explain

  • analyze (boolean, default false): If true, actually executes the query (EXPLAIN ANALYZE) for real timing data

  • format ('text' | 'json' | 'yaml'): Output format (default: 'text')

Returns: Query execution plan showing scan types, costs, and join strategies.

Examples:

  • sql: "SELECT * FROM users WHERE email = 'test@example.com'"

  • sql: "SELECT u., o. FROM users u JOIN orders o ON u.id = o.user_id", analyze: true

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query to explain
formatNoOutput format for the execution plantext
analyzeNoRun EXPLAIN ANALYZE (actually executes the query) for real timing data
Behavior4/5

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

The description notes that setting analyze=true actually executes the query, which is a critical behavioral detail beyond the annotations. Annotations indicate readOnlyHint=false and idempotentHint=true; the description clarifies the execution risk when analyze is true. Missing is any mention of locking or performance impact of ANALYZE.

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 concise, well-structured with paragraphs and examples, and every sentence adds value. It fits within a few lines without 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 the tool's simplicity and the lack of an output schema, the description adequately explains the return type ('execution plan showing scan types, costs, and join strategies'). No missing context for agent usage.

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

Parameters5/5

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

All three parameters (sql, analyze, format) are fully described in the input schema, and the description adds examples and clarifies the effect of analyze and the format options. Schema coverage is 100%, and the description complements it well.

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 explicitly states the tool's purpose: 'Get the execution plan for a SQL query using EXPLAIN.' This clearly distinguishes it from sibling tools like kb_query (which executes) and kb_execute (which runs DML).

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 says 'Use this to analyze query performance, identify full table scans, and optimize queries,' providing clear context for when to use. It lacks explicit when-not-to-use guidance, but the context is sufficient given the sibling tools.

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

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

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