Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

get_dashboard_summary

Retrieve a compact summary of a Grafana dashboard including title, panel count, panel types, variables, and metadata by providing the dashboard UID.

Instructions

Get a compact summary of a dashboard including title, panel count, panel types, variables, and other metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesThe UID of the dashboard

Implementation Reference

  • Complete ToolDefinition export for 'get_dashboard_summary' including description, schema reference, and the handler function that fetches dashboard data via GrafanaClient and constructs a metadata summary.
    export const getDashboardSummary: ToolDefinition = {
      name: 'get_dashboard_summary',
      description: 'Get a compact summary of a dashboard including title, panel count, panel types, variables, and other metadata',
      inputSchema: GetDashboardSummarySchema,
      handler: async (params, context: ToolContext) => {
        try {
          const client = new GrafanaClient(context.config.grafanaConfig);
          const dashboard = await client.getDashboardByUid(params.uid);
          
          const summary = {
            uid: dashboard.uid,
            title: dashboard.title,
            tags: dashboard.tags || [],
            panelCount: dashboard.panels?.length || 0,
            panelTypes: [...new Set(dashboard.panels?.map((p: any) => p.type) || [])],
            variables: dashboard.templating?.list?.map((v: any) => ({
              name: v.name,
              type: v.type,
              label: v.label,
            })) || [],
            version: dashboard.version,
            schemaVersion: dashboard.schemaVersion,
          };
          
          return createToolResult(summary);
        } catch (error: any) {
          return createErrorResult(error.message);
        }
      },
    };
  • Zod input schema for get_dashboard_summary tool requiring a dashboard UID.
    const GetDashboardSummarySchema = z.object({
      uid: z.string().describe('The UID of the dashboard'),
    });
  • Server registration of the getDashboardSummary tool within the registerDashboardTools function.
    server.registerTool(getDashboardSummary);
  • src/cli.ts:102-102 (registration)
    Invocation of registerDashboardTools during MCP server initialization in CLI entrypoint, enabling the dashboard tools including get_dashboard_summary.
    registerDashboardTools(server);

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/0xteamhq/mcp-grafana'

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