Skip to main content
Glama
c20020207

AppSignal MCP Server

by c20020207

getIncident

Fetch detailed incident information by providing a valid incident number using the Model Context Protocol server connected to AppSignal monitoring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
incidentNumberYes

Implementation Reference

  • Registration of the MCP 'getIncident' tool, including input schema validation with Zod and the handler function that calls AppSignalClient.getIncident and formats the response as text content.
    this.server.tool(
      'getIncident',
      {
        incidentNumber: z.number().int().positive(),
      },
      async ({ incidentNumber }) => {
        try {
          const incident = await this.client.getIncident(incidentNumber);
          return {
            content: [{
              type: 'text',
              text: JSON.stringify(incident, null, 2),
            }],
          };
        } catch (error) {
          if (error instanceof Error) {
            return {
              content: [{
                type: 'text',
                text: `Error fetching incident: ${error.message}`,
              }],
              isError: true,
            };
          }
          throw error;
        }
      }
    );
  • Core handler logic in AppSignalClient that executes GraphQL query to fetch incident details from AppSignal API.
    async getIncident(incidentNumber: number): Promise<Incident> {
      const query = `
        query IncidentQuery($appId: String!, $incidentNumber: Int!) {
          app(id: $appId) {
            id
            incident(incidentNumber: $incidentNumber) {
              ... on ExceptionIncident {
                id
                number
                count
                lastOccurredAt
                actionNames
                exceptionName
                state
                namespace
                firstBacktraceLine
                errorGroupingStrategy
                severity
              }
            }
          }
        }
      `;
    
      const result = await this.executeQuery<{
        app: {
          id: string;
          incident: Incident;
        };
      }>(query, {
        appId: this.appId,
        incidentNumber,
      });
    
      return result.app.incident;
    }
  • Zod schema defining the structure of Incident data returned by getIncident.
    export const IncidentSchema = z.object({
      id: z.string(),
      number: z.number(),
      count: z.number(),
      lastOccurredAt: z.string(),
      actionNames: z.array(z.string()),
      exceptionName: z.string(),
      state: z.string(),
      namespace: z.string(),
      firstBacktraceLine: z.string().optional(),
      errorGroupingStrategy: z.string().optional(),
      severity: z.string().optional(),
    });
Install Server

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/c20020207/mcp-appsignal'

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