Skip to main content
Glama

getIncidentSample

Fetch a specific sample from an AppSignal incident using the incident number and sample ID to analyze and troubleshoot monitoring issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
incidentNumberYes
sampleIdNo

Implementation Reference

  • Registration of the 'getIncidentSample' MCP tool, including input schema and thin wrapper handler that delegates to AppSignalClient.getIncidentSample and returns JSON.
    this.server.tool( 'getIncidentSample', { incidentNumber: z.number().int().positive(), sampleId: z.string().optional(), }, async ({ incidentNumber, sampleId }) => { try { const sample = await this.client.getIncidentSample(incidentNumber, sampleId); return { content: [{ type: 'text', text: JSON.stringify(sample, null, 2), }], }; } catch (error) { if (error instanceof Error) { return { content: [{ type: 'text', text: `Error fetching incident sample: ${error.message}`, }], isError: true, }; } throw error; } } );
  • Primary handler logic in AppSignalClient that executes GraphQL query to retrieve the incident sample from AppSignal API.
    async getIncidentSample(incidentNumber: number, sampleId?: string): Promise<Sample> { const query = ` query IncidentSampleQuery($appId: String!, $incidentNumber: Int!, $sampleId: String) { app(id: $appId) { id incident(incidentNumber: $incidentNumber) { ... on ExceptionIncident { sample(id: $sampleId) { id appId time revision action namespace overview { key value } exception { name message backtrace { original line column path method url type code { line source } error { class message } } } } } } } } `; const result = await this.executeQuery<{ app: { id: string; incident: { sample: Sample; }; }; }>(query, { appId: this.appId, incidentNumber, sampleId, }); return result.app.incident.sample; }
  • Zod schema defining the structure of Sample data used for typing the response from getIncidentSample.
    export const SampleSchema = z.object({ id: z.string(), appId: z.string(), time: z.string(), revision: z.string().optional(), action: z.string(), namespace: z.string(), overview: z.array(z.object({ key: z.string(), value: z.string(), })), exception: z.object({ name: z.string(), message: z.string(), backtrace: z.array(z.object({ original: z.string().optional(), line: z.number().optional(), column: z.number().optional(), path: z.string().optional(), method: z.string().optional(), url: z.string().optional(), type: z.string().optional(), code: z.object({ line: z.number().optional(), source: z.string().optional(), }).optional(), error: z.object({ class: z.string().optional(), message: z.string().optional(), }).optional(), })), }), });
  • Input schema (Zod) for the getIncidentSample MCP tool parameters: incidentNumber (required positive int) and optional sampleId.
    { incidentNumber: z.number().int().positive(), sampleId: z.string().optional(), },

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