Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

get_incident

Retrieve detailed information about a specific Grafana incident using its unique ID to access full incident data for monitoring and analysis.

Instructions

Get a single incident by ID. Returns the full incident details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the incident to retrieve

Implementation Reference

  • The main handler for the 'get_incident' tool, which creates an API client and fetches the incident details by ID using Grafana IncidentService.
    export const getIncident: ToolDefinition = {
      name: 'get_incident',
      description: 'Get a single incident by ID. Returns the full incident details',
      inputSchema: GetIncidentSchema,
      handler: async (params, context: ToolContext) => {
        try {
          const client = createIncidentClient(context.config.grafanaConfig);
          const response = await client.get(`/IncidentService.GetIncident`, {
            params: { incidentID: params.id },
          });
          
          return createToolResult(response.data.incident);
        } catch (error: any) {
          return createErrorResult(error.response?.data?.message || error.message);
        }
      },
    };
  • Zod input schema for 'get_incident' tool, defining the required 'id' parameter.
    const GetIncidentSchema = z.object({
      id: z.string().describe('The ID of the incident to retrieve'),
    });
  • Registration function that registers the 'getIncident' tool (and others) with the MCP server.
    export function registerIncidentTools(server: any) {
      server.registerTool(listIncidents);
      server.registerTool(getIncident);
      server.registerTool(createIncident);
      server.registerTool(addActivityToIncident);
    }
  • Helper function to create the Axios client for Grafana Incident API, used by the get_incident handler.
    function createIncidentClient(config: any) {
      const headers: any = {
        'User-Agent': 'mcp-grafana/1.0.0',
      };
      
      if (config.serviceAccountToken) {
        headers['Authorization'] = `Bearer ${config.serviceAccountToken}`;
      } else if (config.apiKey) {
        headers['Authorization'] = `Bearer ${config.apiKey}`;
      }
      
      return axios.create({
        baseURL: `${config.url}/api/plugins/grafana-incident-app/resources/api/v1`,
        headers,
        timeout: 30000,
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that it 'Returns the full incident details,' which adds some context about output behavior, but it lacks details on error handling (e.g., what happens if the ID is invalid), authentication requirements, rate limits, or whether it's a read-only operation. For a tool with no annotations, this is insufficient to fully understand its behavior.

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 extremely concise and front-loaded, consisting of only two sentences that directly state the tool's function and output. There is no wasted language or redundancy, making it easy to parse and understand 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 the tool's low complexity (one required parameter, no nested objects) and no output schema, the description provides basic completeness by stating the purpose and return value. However, it lacks details on error cases, permissions, or data format, which could be important for an agent to use it correctly. With no annotations and no output schema, the description should ideally include more behavioral context to be fully complete.

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 input schema has 100% description coverage, with the 'id' parameter documented as 'The ID of the incident to retrieve.' The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema adequately handles parameter documentation.

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

Purpose5/5

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

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('a single incident by ID'), distinguishing it from sibling tools like 'list_incidents' (which retrieves multiple incidents) and 'create_incident' (which creates new incidents). It explicitly mentions the scope ('single incident') and the action ('retrieve'), making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'by ID,' indicating it should be used when you have a specific incident identifier, as opposed to 'list_incidents' for browsing multiple incidents. However, it does not explicitly state when not to use it or mention alternatives like 'get_sift_investigation' for related resources, leaving some guidance gaps.

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