Skip to main content
Glama
baburajr

elasticsearch-mcp

by baburajr

sql_query

Read-only

Execute Elasticsearch SQL SELECT queries to aggregate and filter data without hand-writing Query DSL. Returns columns and rows, with a cursor for retrieving larger results.

Instructions

Run an Elasticsearch SQL query via the _sql API. Good for quick aggregate/filter questions without hand-writing Query DSL, e.g. SELECT status, COUNT() FROM "logs-" WHERE code >= 500 GROUP BY status. Only SELECT is allowed. The index in FROM is checked against the allow/deny policy. Row count is capped by fetch_size (server result-size limit applies). Returns columns and rows; if there are more rows a cursor is returned to pass back as the cursor argument.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo
cursorNo
fetch_sizeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Annotations already declare the read-only, non-destructive nature. The description adds substantial behavioral detail beyond that: the index allow/deny policy check, the fetch_size cap, server result-size limits, and cursor-based pagination behavior. This is valuable operating context an agent needs before calling.

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?

Four sentences, each earning its place. The main purpose is front-loaded, the example is compact and illustrative, and the constraints are stated in two short clauses. No filler or repetition.

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 a read-only SQL execution tool with 3 optional parameters and an output schema, the description covers all necessary operational details: what query types are allowed, index policy enforcement, row limits, result shape, and cursor continuation. Nothing important for an agent to invoke it correctly is missing.

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?

Schema coverage is 0%, so the description must carry the meaning of the parameters alone. It does this well: the example illustrates the query parameter, 'Row count is capped by fetch_size' explains fetch_size, and 'a cursor is returned to pass back as the cursor argument' defines the cursor parameter. All three parameters are semantically grounded.

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 opens with a specific verb-resource pair ('Run an Elasticsearch SQL query via the _sql API') and immediately clarifies its purpose: quick aggregate/filter questions without hand-writing Query DSL. The SQL example and 'Only SELECT is allowed' makes the tool's scope unambiguous and distinguishable from DSL-oriented siblings.

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?

It clearly states when to use it ('quick aggregate/filter questions without hand-writing Query DSL') and provides an explicit exclusion ('Only SELECT is allowed'). It does not name specific sibling tools as alternatives, so guidance is strong but not maximally explicit.

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