Skip to main content
Glama
TocharianOU

Kibana MCP Server

by TocharianOU

get_kibana_api_detail

Retrieve detailed information for a specific Kibana API endpoint by specifying the HTTP method and path to streamline integration and debugging processes.

Instructions

Get details for a specific Kibana API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesHTTP method, e.g. GET, POST, PUT, DELETE
pathYesAPI path, e.g. /api/actions/connector_types

Implementation Reference

  • Handler for 'get_kibana_api_detail': builds API index, finds endpoint by method/path, resolves OpenAPI refs for parameters/body/responses, returns detailed JSON or error if not found.
    async ({ method, path }): Promise<ToolResponse> => {
      await buildApiIndex();
      const endpoint = apiEndpointIndex.find(
        e => e.method === method.toUpperCase() && e.path === path
      );
      if (!endpoint) {
        return {
          content: [
            {
              type: "text",
              text: `API endpoint not found: ${method} ${path}`
            }
          ],
          isError: true
        };
      }
      // Recursively resolve parameters, requestBody, and responses references
      const detailed = {
        ...endpoint,
        parameters: resolveRef(endpoint.parameters, openApiDoc),
        requestBody: resolveRef(endpoint.requestBody, openApiDoc),
        responses: resolveRef(endpoint.responses, openApiDoc)
      };
      return {
        content: [
          {
            type: "text",
            text: `API endpoint details: ${JSON.stringify(detailed, null, 2)}`
          }
        ]
      };
    }
  • Input schema using Zod: requires 'method' (string) and 'path' (string) parameters.
    z.object({
      method: z.string().describe("HTTP method, e.g. GET, POST, PUT, DELETE"),
      path: z.string().describe("API path, e.g. /api/actions/connector_types")
    }),
  • Tool registration call in registerBaseTools function, specifying name, description, schema, and inline handler.
    server.tool(
      "get_kibana_api_detail",
      `Get details for a specific Kibana API endpoint`,
      z.object({
        method: z.string().describe("HTTP method, e.g. GET, POST, PUT, DELETE"),
        path: z.string().describe("API path, e.g. /api/actions/connector_types")
      }),
      async ({ method, path }): Promise<ToolResponse> => {
        await buildApiIndex();
        const endpoint = apiEndpointIndex.find(
          e => e.method === method.toUpperCase() && e.path === path
        );
        if (!endpoint) {
          return {
            content: [
              {
                type: "text",
                text: `API endpoint not found: ${method} ${path}`
              }
            ],
            isError: true
          };
        }
        // Recursively resolve parameters, requestBody, and responses references
        const detailed = {
          ...endpoint,
          parameters: resolveRef(endpoint.parameters, openApiDoc),
          requestBody: resolveRef(endpoint.requestBody, openApiDoc),
          responses: resolveRef(endpoint.responses, openApiDoc)
        };
        return {
          content: [
            {
              type: "text",
              text: `API endpoint details: ${JSON.stringify(detailed, null, 2)}`
            }
          ]
        };
      }
    );
  • Recursive helper to resolve $ref references in OpenAPI objects, preventing circular refs, used in the tool handler for parameters, requestBody, responses.
    function resolveRef(obj: any, doc: any, seen = new Set()): any {
      if (!obj || typeof obj !== 'object') return obj;
      if (Array.isArray(obj)) return obj.map(item => resolveRef(item, doc, seen));
      if (obj.$ref) {
        const ref = obj.$ref;
        if (seen.has(ref)) return { circularRef: ref };
        seen.add(ref);
    
        const parts = ref.replace(/^#\//, '').split('/');
        let target = doc;
        for (const p of parts) {
          if (target && typeof target === 'object') target = target[p];
          else return { invalidRef: ref };
        }
        return resolveRef(target, doc, seen);
      }
    
      const result: any = {};
      for (const k of Object.keys(obj)) {
        result[k] = resolveRef(obj[k], doc, seen);
      }
      return result;
    }
  • Builds the global apiEndpointIndex by parsing kibana-openapi-source.yaml file, populating endpoints list, called by the tool handler.
    async function buildApiIndex(): Promise<void> {
      if (isIndexBuilt) return;
      
      // Enhanced path resolution for both compiled JS and direct TS execution
      const possiblePaths = [
        // Environment variable takes highest priority
        process.env.KIBANA_OPENAPI_YAML_PATH,
        // Current working directory
        path.join(process.cwd(), 'kibana-openapi-source.yaml'),
        // Relative to the source file
        path.join(__dirname, 'kibana-openapi-source.yaml'),
        // One level up from source file (for ts-node execution)
        path.resolve(__dirname, '..', 'kibana-openapi-source.yaml'),
        // dist directory for compiled JS
        path.join(process.cwd(), 'dist', 'src', 'kibana-openapi-source.yaml')
      ].filter((p): p is string => typeof p === 'string' && p.length > 0);
    
      for (const p of possiblePaths) {
        if (fs.existsSync(p)) {
          YAML_FILE_PATH = p;
          console.warn(`Using YAML file from: ${p}`);
          break;
        }
      }
    
      if (!YAML_FILE_PATH) {
        console.error('Could not find kibana-openapi-source.yaml file');
        isIndexBuilt = true;
        return;
      }
    
      try {
        const yamlContent = fs.readFileSync(YAML_FILE_PATH, 'utf8');
        openApiDoc = yaml.load(yamlContent);
        
        if (!openApiDoc || !openApiDoc.paths) {
          throw new Error('Invalid YAML file structure: missing paths');
        }
    
        for (const [pathStr, pathObj] of Object.entries(openApiDoc.paths)) {
          for (const [method, methodObj] of Object.entries(pathObj as Record<string, any>)) {
            if (["get", "post", "put", "delete", "patch"].includes(method)) {
              apiEndpointIndex.push({
                path: pathStr as string,
                method: method.toUpperCase(),
                description: (methodObj as any).description,
                summary: (methodObj as any).summary,
                parameters: (methodObj as any).parameters,
                requestBody: (methodObj as any).requestBody,
                responses: (methodObj as any).responses,
                deprecated: (methodObj as any).deprecated,
                tags: (methodObj as any).tags
              });
            }
          }
        }
        isIndexBuilt = true;
      } catch (error) {
        console.error('Error loading or parsing YAML file:', error);
        throw error;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves—such as whether it's read-only, what format the details are returned in, error handling, or any rate limits. This is a significant gap for a tool with no annotation coverage.

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 a single, efficient sentence that directly states the tool's purpose without any fluff. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 complexity of querying API endpoints and the lack of annotations and output schema, the description is insufficient. It doesn't explain what 'details' include, how results are structured, or any behavioral aspects like safety or performance, leaving the agent with incomplete information for proper 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?

The schema description coverage is 100%, with both parameters ('method' and 'path') well-documented in the schema. The description adds no additional meaning beyond implying that these parameters identify a specific endpoint, which is already clear from the schema. This meets the baseline for high schema coverage.

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 verb ('Get details') and resource ('specific Kibana API endpoint'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_all_kibana_api_paths' or 'search_kibana_api_paths' which also deal with Kibana API endpoints, so it doesn't fully distinguish itself from alternatives.

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 like 'list_all_kibana_api_paths' or 'execute_kb_api'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage based on the name alone.

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

Related 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/TocharianOU/mcp-server-kibana'

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