Skip to main content
Glama
jerrelblankenship

Kibana MCP Server

search_logs

Search Elasticsearch logs and data using query DSL to retrieve specific records from specified indices for analysis and troubleshooting.

Instructions

Search Elasticsearch data through Kibana using Elasticsearch query DSL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYesIndex pattern or name to search
queryNoElasticsearch query DSL (e.g., {"match_all": {}} or {"term": {"field": "value"}})
sizeNoNumber of results to return (default: 10, max: 100)
fromNoStarting offset for pagination (default: 0)
sortNoSort specification (e.g., [{"@timestamp": "desc"}])

Implementation Reference

  • Handler for the 'search_logs' tool in MCP, which processes the request parameters and calls the Kibana client.
    case 'search_logs': {
      const { index, query, size = 10, from = 0, sort } = args as {
        index: string;
        query?: Record<string, unknown>;
        size?: number;
        from?: number;
        sort?: unknown[];
      };
    
      const searchParams = {
        index,
        body: {
          query: query || { match_all: {} },
          size: Math.min(size, 100),
          from,
          ...(sort && { sort }),
        },
      };
    
      const result = await kibanaClient.searchLogs(searchParams);
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(
              {
                took: result.took,
                total: result.hits.total,
                hits: result.hits.hits.map((hit) => ({
                  _id: hit._id,
                  _index: hit._index,
                  _score: hit._score,
                  _source: hit._source,
                })),
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Actual API implementation of searchLogs in the KibanaClient that executes the search request against the Kibana backend.
    async searchLogs(
      params: ElasticsearchSearchParams
    ): Promise<ElasticsearchSearchResponse> {
      // Use Kibana's internal Elasticsearch proxy
      const response = await this.axiosInstance.post(
        `/internal/search/es`,
        {
          params: {
            index: params.index,
            body: params.body || {},
          },
        }
      );
    
      // Kibana wraps the ES response under rawResponse
      return response.data.rawResponse ?? response.data;
    }
  • Schema registration for the 'search_logs' tool, defining input requirements and descriptions.
      name: 'search_logs',
      description:
        'Search Elasticsearch data through Kibana using Elasticsearch query DSL',
      inputSchema: {
        type: 'object',
        properties: {
          index: {
            type: 'string',
            description: 'Index pattern or name to search',
          },
          query: {
            type: 'object',
            description:
              'Elasticsearch query DSL (e.g., {"match_all": {}} or {"term": {"field": "value"}})',
          },
          size: {
            type: 'number',
            description: 'Number of results to return (default: 10, max: 100)',
            default: 10,
          },
          from: {
            type: 'number',
            description: 'Starting offset for pagination (default: 0)',
            default: 0,
          },
          sort: {
            type: 'array',
            description:
              'Sort specification (e.g., [{"@timestamp": "desc"}])',
          },
        },
        required: ['index'],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It mentions using Elasticsearch query DSL but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what happens on execution (e.g., whether it's read-only or has side effects). For a search tool with complex parameters, this is a significant gap.

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 a single, efficient sentence that directly states the tool's function. It's front-loaded with the core action and avoids unnecessary words. However, it could be slightly more structured by explicitly separating purpose from context or constraints.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain return values, error conditions, or behavioral traits like pagination or query limitations. For a search tool with rich input schema but no output schema, more context is needed to guide effective use.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'Elasticsearch query DSL' and 'Kibana', but doesn't provide additional syntax, format details, or examples beyond what's in the schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Search') and target resource ('Elasticsearch data through Kibana'), making the purpose evident. However, it doesn't differentiate this tool from its siblings (like list_data_views or get_dashboard), which are related but distinct operations. The description is specific but lacks sibling comparison.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing valid indices or query knowledge), exclusions, or comparisons to sibling tools like list_data_views for browsing available indices. Usage context is implied but not 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/jerrelblankenship/jb-kibana-mcp'

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