Skip to main content
Glama
baburajr

elasticsearch-mcp

by baburajr

run_query

Read-only

Execute an Elasticsearch search on an index or alias using Query DSL, returning hits, aggregations, timing, and shard stats. Use search_after for pagination beyond 10k.

Instructions

Execute an Elasticsearch search against an index or alias. Accepts a full Query DSL body (JSON string or object). Size is capped by server policy, a search timeout is injected, and deep paging is rejected. Returns hits, aggregations, timing and shard stats. Use search_after for pagination beyond 10k.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sizeNo
sortNo
from_No
indexYes
queryNo
profileNo
routingNo
preferenceNo
search_afterNo
source_includesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Annotations already establish that this is read-only and non-destructive, and the description builds on that by disclosing behavior not visible in the schema: a server-side size cap, an injected timeout, deep-paging rejection, and the return shape. These are exactly the kind of hidden constraints an agent needs before invoking the tool.

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 compact but information-dense. Every sentence serves a purpose: define the call, describe constraints, describe output, and give pivotal pagination guidance. There is no redundancy, filler, or vague wording.

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 low-level Elasticsearch search tool, the description provides key execution semantics: what it sends, what the server does, and what is returned. It covers a safe, courteous usage pattern by disclosing limiting and deep-paging behavior. It leaves a gap around explicit alternative-tool selection with other search-family siblings, but the presence of an output schema and the readOnly annotations lower the need for additional detail.

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

Parameters3/5

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

The schema has 10 parameters and 0% described in tooling, so the tool description cannot rely on parameter documentation. It does add semantics for the central parts — query accepts a full Elasticsearch Query DSL body, size is capped, and search_after is used for deep pagination. However, sort, from_, routing, preference, source_includes, and profile rely on property titles and types, leaving somewhat unresolved how an agent should compose a full request.

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 names the exact operation with a specific verb and resource: "Execute an Elasticsearch search against an index or alias." It also conveys the query contract by saying it accepts a full Query DSL body, which helps distinguish it from siblings like count_documents, sql_translate, and generate_dsl. The mention of returned data (hits, aggregations, timing, shard stats) further clarifies the tool's role.

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 clearly communicates operational constraints: size is capped, a timeout is injected, and deep paging is rejected. It also explicitly advises using search_after for pagination beyond 10k, which tells the agent how to behave when large result sets are involved. It does not explicitly exclude siblings like paged_search or count_documents, so the guidance about alternatives is mostly implied rather than fully stated.

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