Skip to main content
Glama

get_available_spaces

Retrieve all available Kibana spaces with detailed information using the provided context to manage and organize data efficiently.

Instructions

Get all available Kibana spaces with current context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_detailsNoInclude detailed space information (name, description, etc.)

Implementation Reference

  • Registration of the 'get_available_spaces' tool including inline schema and handler. The handler fetches available Kibana spaces using kibanaClient.get('/api/spaces/space'), formats the response with default space info and optional details, handles errors.
    server.tool( "get_available_spaces", "Get all available Kibana spaces with current context", z.object({ include_details: z.boolean().optional().default(true).describe("Include detailed space information (name, description, etc.)") }), async ({ include_details = true }): Promise<ToolResponse> => { try { const response = await kibanaClient.get('/api/spaces/space'); const result = { current_default_space: defaultSpace, total_count: response.length, available_spaces: include_details ? response : response.map((space: any) => ({ id: space.id, name: space.name })) }; return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { console.error(`Failed to get available spaces: ${error}`); return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
  • index.ts:299-299 (registration)
    Top-level call to registerBaseTools which includes the 'get_available_spaces' tool among base tools.
    registerBaseTools(serverBase, kibanaClient, defaultSpace),
  • The core handler logic for executing the 'get_available_spaces' tool: retrieves spaces from Kibana API, processes and returns as JSON with error handling.
    async ({ include_details = true }): Promise<ToolResponse> => { try { const response = await kibanaClient.get('/api/spaces/space'); const result = { current_default_space: defaultSpace, total_count: response.length, available_spaces: include_details ? response : response.map((space: any) => ({ id: space.id, name: space.name })) }; return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { console.error(`Failed to get available spaces: ${error}`); return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
  • Input schema for the tool using Zod: optional boolean to include full space details.
    z.object({ include_details: z.boolean().optional().default(true).describe("Include detailed space information (name, description, etc.)") }),

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