Skip to main content
Glama
0xteamhq

Grafana MCP Server

by 0xteamhq

create_incident

Create a new incident in Grafana with specified title, severity, and room prefix to manage and track operational issues within monitoring systems.

Instructions

Create a new Grafana incident. Requires title, severity, and room prefix

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attachCaptionNoCaption of the attachment
attachUrlNoURL of the attachment
isDrillNoWhether the incident is a drill
labelsNoLabels to add to the incident
roomPrefixYesThe prefix of the room to create the incident in
severityYesThe severity of the incident
statusNoThe status of the incident
titleYesThe title of the incident

Implementation Reference

  • The core handler implementation for the 'create_incident' tool. It constructs incident data from input params, optionally adds attachments, and posts to the Grafana Incident API using an axios client.
    export const createIncident: ToolDefinition = {
      name: 'create_incident',
      description: 'Create a new Grafana incident. Requires title, severity, and room prefix',
      inputSchema: CreateIncidentSchema,
      handler: async (params, context: ToolContext) => {
        try {
          const client = createIncidentClient(context.config.grafanaConfig);
          
          const incidentData: any = {
            title: params.title,
            severity: params.severity,
            roomPrefix: params.roomPrefix,
          };
          
          if (params.status) incidentData.status = params.status;
          if (params.isDrill !== undefined) incidentData.isDrill = params.isDrill;
          if (params.labels) incidentData.labels = params.labels;
          
          const attachments = [];
          if (params.attachUrl) {
            attachments.push({
              attachmentID: 'attach-1',
              url: params.attachUrl,
              useToSummarize: true,
              caption: params.attachCaption,
            });
          }
          
          const response = await client.post('/IncidentService.CreateIncident', {
            incident: incidentData,
            attachments,
          });
          
          return createToolResult({
            incidentID: response.data.incident.incidentID,
            title: response.data.incident.title,
            status: response.data.incident.status,
            message: 'Incident created successfully',
          });
        } catch (error: any) {
          return createErrorResult(error.response?.data?.message || error.message);
        }
      },
    };
  • Zod input schema defining parameters for creating an incident, including title, severity, roomPrefix, and optional fields like status, labels, and attachments.
    const CreateIncidentSchema = z.object({
      title: z.string().describe('The title of the incident'),
      severity: z.string().describe('The severity of the incident'),
      status: z.string().optional().describe('The status of the incident'),
      roomPrefix: z.string().describe('The prefix of the room to create the incident in'),
      isDrill: z.boolean().optional().describe('Whether the incident is a drill'),
      labels: z.array(z.object({
        key: z.string(),
        label: z.string(),
        description: z.string().optional(),
        colorHex: z.string().optional(),
      })).optional().describe('Labels to add to the incident'),
      attachUrl: z.string().optional().describe('URL of the attachment'),
      attachCaption: z.string().optional().describe('Caption of the attachment'),
    });
  • Registration function for all incident-related tools, including 'create_incident'.
    export function registerIncidentTools(server: any) {
      server.registerTool(listIncidents);
      server.registerTool(getIncident);
      server.registerTool(createIncident);
      server.registerTool(addActivityToIncident);
    }
  • src/cli.ts:114-114 (registration)
    Invocation of the incident tools registration in the main CLI entrypoint, conditional on the 'incident' tool category being enabled.
    registerIncidentTools(server);
  • Helper function that creates an authenticated axios client for the Grafana Incident API, used by all incident tools including create_incident.
    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?

With no annotations provided, the description carries full burden. It states 'Create a new Grafana incident' which implies a write/mutation operation, but doesn't disclose behavioral traits like authentication requirements, rate limits, side effects, or what happens upon creation (e.g., does it return an incident ID?). This leaves significant gaps for a mutation tool.

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 core purpose and immediately specifies required parameters. There's no wasted language or 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.

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or important behavioral context (like whether incidents are editable after creation). Given the complexity of creating incidents with 8 parameters, more guidance is needed.

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 description lists three required parameters (title, severity, room prefix), which matches the schema's required fields. With 100% schema description coverage, the schema already documents all 8 parameters thoroughly. The description adds minimal value beyond confirming required fields, meeting 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 action ('Create a new Grafana incident') and specifies required parameters (title, severity, room prefix). It distinguishes from sibling tools like 'get_incident' or 'list_incidents' by being a creation tool, though it doesn't explicitly contrast with other creation-related tools (none exist in the sibling list).

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 mentions required parameters but provides no guidance on when to use this tool versus alternatives. There are no explicit instructions about prerequisites, timing, or comparisons to other tools in the sibling list (e.g., when to create vs. get/list incidents).

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