Skip to main content
Glama
baburajr

elasticsearch-mcp

by baburajr

explain_query

Read-only

Validate query rewrites, profile component timing, and per-document scoring to identify invalid or slow clauses in Elasticsearch queries.

Instructions

Explain a query three ways: (1) _validate/query?rewrite=true shows how ES rewrites it and why it may be invalid, (2) profile=true gives per-component timing to find the slow clause, (3) if doc_id is given, _explain shows why that document matched or did not, with scoring detail.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
queryYes
doc_idNo
profileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations already indicate read-only and non-destructive behavior. The description adds meaningful transparency by explaining what each execution path will reveal—rewrites, invalid query details, per-component timing, and match/scoring explanation—making the behavioral outcome clear.

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 explanation is delivered in one dense, structured sentence with numbered modes and no filler. The core action is front-loaded, and each clause describes one distinct behavior or use case.

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?

For this tool, the description covers validation, performance analysis, and document-level explanation—essentially all behavior the caller needs to decide invocation. The presence of an output schema also relieves the description from enumerating return structures.

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 for parameter documentation. It explicitly explains the behavioral effect of profile=true and the doc_id parameter, and it clarifies the abstruse rewrite mode. Only the index parameter is left implicit, which is already self-evident from its name.

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 explains a query and enumerates three concrete modes: query rewriting/validation, profiling, and per-document matching. This makes it unambiguous what the tool does and distinguishes it from generic run/query tools.

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 gives clear context for when to use each mode: validation rewrite, finding slow clauses, and explaining document matches. It does not explicitly name alternatives or state when not to use the tool, but the mode-specific guidance is strong enough for correct selection.

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/baburajr/elasticsearch_mcp'

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