Skip to main content
Glama
mshegolev

mshegolev/kibana-mcp

kibana_search_logs

Read-onlyIdempotent

Search Elasticsearch logs with Query String Syntax, returning the top matching entries including their _source fields. Filter by time range and sort by order.

Instructions

Search logs using Elasticsearch Query String Syntax.

Wraps POST {ES_URL}/{index}/_search with a bool/must query. Returns the top matching log entries with their _source fields.

When more than 20 hits are rendered in the text output, a truncation hint is appended — use the structured hits field for the full list.

Examples: - Use when: "Show me the last 20 ERROR logs from the API service." → index='logs-*', query='level:ERROR AND service:api'. - Use when: "Find 'connection refused' errors in the last hour." → query='message:"connection refused"', time_from='2026-04-18T09:00:00Z', time_to='2026-04-18T10:00:00Z'. - Use when: "Show me 500 errors sorted oldest first for replay." → query='status:500', sort_order='asc'. - Don't use when: You want counts / statistics per field value — use kibana_aggregate_logs instead (size:0 aggregation is much cheaper than retrieving full log documents). - Don't use when: You need more than 500 docs — ES caps size at 500 via this tool; use scroll API directly for bulk export.

Returns: dict with total / returned / took_ms / hits (list).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYesElasticsearch index name or pattern (e.g. 'logs-*', 'filebeat-2026.04.18'). Use `kibana_list_indices` to discover available indices.
queryYesElasticsearch Query String Syntax. Examples: 'level:ERROR', 'level:ERROR AND service:api', 'message:"connection refused" AND host:db*', 'status:[500 TO 599]'. Use '*' to match all documents.
time_fieldNoName of the timestamp field. Default '@timestamp' (Logstash/Filebeat convention).@timestamp
time_fromNoStart of the time range. ISO-8601 (e.g. '2026-04-18T00:00:00Z') or epoch-ms (e.g. '1713398400000'). Omit for unbounded start.
time_toNoEnd of the time range. ISO-8601 or epoch-ms. Omit for unbounded end (searches up to now).
sizeNoMaximum number of log hits to return (1-500, default 20).
sort_orderNoSort order for results: 'desc' (newest first, default) or 'asc' (oldest first).desc

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
totalYes
returnedYes
took_msYes
indexYes
queryYes
time_fromYes
time_toYes
sort_orderYes
hitsYes
Behavior4/5

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

Annotations already provide readOnlyHint and idempotentHint. The description adds specific behavioral details: the bool/must query structure, truncation hint for >20 hits, return format (total/returned/took_ms/hits), and the ES size cap. This is informative but not exhaustive (e.g., no explicit pagination guidance beyond size cap).

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 main purpose, technical detail, truncation note, examples, and exclusions. Though a bit lengthy, every section serves a purpose and the information is front-loaded.

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 complexity (7 parameters, ES integration, truncation, size limits) and the richness of schema/annotations/output schema (return dict described), the description covers all critical aspects: purpose, usage guidelines with examples, behavioral traits, limits, and return structure. No major gaps.

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?

All 7 parameters have schema descriptions (100% coverage), so baseline is 3. The description adds value by providing real-world examples that illustrate parameter usage (e.g., query syntax, time range formats, sort_order), enhancing understanding beyond the schema alone.

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 searches logs using ES Query String Syntax, identifies the specific operation (wrapping a POST _search with bool/must), and distinguishes from sibling tools like kibana_aggregate_logs via explicit 'Don't use when' examples.

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

Usage Guidelines5/5

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

Multiple 'Use when' examples with concrete parameter values, plus explicit 'Don't use when' scenarios directing to kibana_aggregate_logs for aggregations or scroll API for >500 docs, providing clear alternatives.

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/mshegolev/kibana-mcp'

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