Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

get_dashboard_by_uid

Retrieve a complete Grafana dashboard with all panels, variables, and settings using the dashboard's unique identifier (UID).

Instructions

Retrieves the complete dashboard, including panels, variables, and settings, for a specific dashboard identified by its UID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesThe UID of the dashboard

Implementation Reference

  • The main handler implementation for the get_dashboard_by_uid tool, which creates a GrafanaClient instance and fetches the dashboard by UID.
    export const getDashboardByUid: ToolDefinition = {
      name: 'get_dashboard_by_uid',
      description: 'Retrieves the complete dashboard, including panels, variables, and settings, for a specific dashboard identified by its UID',
      inputSchema: GetDashboardByUidSchema,
      handler: async (params, context: ToolContext) => {
        try {
          const client = new GrafanaClient(context.config.grafanaConfig);
          const dashboard = await client.getDashboardByUid(params.uid);
          return createToolResult(dashboard);
        } catch (error: any) {
          return createErrorResult(error.message);
        }
      },
    };
  • Zod schema defining the input parameters for the tool (uid: string).
    const GetDashboardByUidSchema = z.object({
      uid: z.string().describe('The UID of the dashboard'),
    });
  • Registration function that registers the get_dashboard_by_uid tool (and others) with the MCP server. Called from src/cli.ts.
    export function registerDashboardTools(server: any) {
      server.registerTool(getDashboardByUid);
      server.registerTool(getDashboardSummary);
      server.registerTool(getDashboardProperty);
      server.registerTool(getDashboardPanelQueries);
      server.registerTool(updateDashboard);
    }
  • GrafanaClient helper method that performs the actual API call to retrieve the dashboard by UID from Grafana.
    async getDashboardByUid(uid: string): Promise<Dashboard> {
      try {
        const response = await this.client.get(`/api/dashboards/uid/${uid}`);
        return response.data.dashboard;
      } catch (error) {
        this.handleError(error);
      }
    }
  • src/cli.ts:101-102 (registration)
    Call to registerDashboardTools in the main CLI entrypoint, conditionally enabling dashboard tools including get_dashboard_by_uid.
    if (enabledTools.has('dashboard')) {
      registerDashboardTools(server);
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. It states 'retrieves' implying a read operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or response format. 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 front-loads the key action and details. Every word earns its place with no redundancy, making it easy to parse quickly.

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

Completeness3/5

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

Given 1 parameter with full schema coverage and no output schema, the description adequately covers the basic purpose. However, as a retrieval tool with no annotations, it lacks details on return values, error cases, or operational constraints, leaving gaps in completeness.

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%, with the parameter 'uid' documented as 'The UID of the dashboard'. The description adds minimal value beyond this, only reiterating 'identified by its UID'. Baseline 3 is appropriate since the 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 verb ('retrieves') and resource ('complete dashboard'), specifying what it returns ('including panels, variables, and settings') and how it's identified ('by its UID'). It distinguishes from siblings like 'get_dashboard_summary' or 'get_dashboard_property' by emphasizing completeness, though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

The description implies usage when a full dashboard is needed via UID, but doesn't explicitly state when to use this vs. alternatives like 'get_dashboard_summary' or 'search_dashboards'. No exclusions or prerequisites are mentioned, leaving some ambiguity in context.

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

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