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
| Name | Required | Description | Default |
|---|---|---|---|
| incidentNumber | Yes |
Implementation Reference
- src/mcp/server.ts:114-141 (registration)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; } } );
- src/appsignal/client.ts:103-138 (handler)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; }
- src/appsignal/client.ts:5-17 (schema)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(), });