get_single_event
Retrieve detailed information about a specific Sentry issue event by providing its URL or ID, enabling targeted debugging and analysis.
Instructions
get issue event by inputting sentry issue event url or sentry issue event id
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url_or_id | Yes | sentry issue event url or sentry issue event id | |
| organization_id_or_slug | No | sentry organization id or slug, it can be undefined | |
| project_id_or_slug | No | sentry project name or slug, it can be undefined | |
| mode | No | mode for output, it can be undefined, it used to control LLM token usage | tiny |
Implementation Reference
- src/index.ts:48-93 (handler)Handler function that parses the input URL or ID to extract event ID, fetches the Sentry event using fetchSentryEvent helper, and returns the data as JSON with optional truncation based on mode.async ({ url_or_id, organization_id_or_slug, project_id_or_slug, mode }) => { let EVENT_ID = ""; if (url_or_id.includes("http") || url_or_id.includes("https")) { EVENT_ID = url_or_id.match(/events\/([a-f0-9]+)/)?.[1] || ""; } else { EVENT_ID = url_or_id; } if (!EVENT_ID) { return { content: [ { type: "text", text: "Invalid Event ID", }, ], }; } const eventEventData = await fetchSentryEvent<{ entries: any[]; }>(EVENT_ID, organization_id_or_slug, project_id_or_slug); if (!eventEventData) { return { content: [ { type: "text", text: "Failed to Get Event", }, ], }; } return { content: [ { type: "text", text: JSON.stringify( mode === "tiny" ? eventEventData.entries : eventEventData ), }, ], }; }
- src/index.ts:26-47 (schema)Zod schema defining the input parameters for the get_single_event tool: url_or_id (required), organization/project ids (optional with defaults), and mode (tiny/huge).{ url_or_id: z .string() .describe("sentry issue event url or sentry issue event id"), organization_id_or_slug: z .string() .optional() .default(process.env.SENTRY_ORG as string) .describe("sentry organization id or slug, it can be undefined"), project_id_or_slug: z .string() .optional() .default(process.env.SENTRY_PROJ as string) .describe("sentry project name or slug, it can be undefined"), mode: z .enum(["tiny", "huge"]) .optional() .default("tiny") .describe( "mode for output, it can be undefined, it used to control LLM token usage" ), },
- src/index.ts:23-94 (registration)MCP server.tool registration for 'get_single_event' tool, specifying name, description, input schema, and handler function.server.tool( "get_single_event", "get issue event by inputting sentry issue event url or sentry issue event id", { url_or_id: z .string() .describe("sentry issue event url or sentry issue event id"), organization_id_or_slug: z .string() .optional() .default(process.env.SENTRY_ORG as string) .describe("sentry organization id or slug, it can be undefined"), project_id_or_slug: z .string() .optional() .default(process.env.SENTRY_PROJ as string) .describe("sentry project name or slug, it can be undefined"), mode: z .enum(["tiny", "huge"]) .optional() .default("tiny") .describe( "mode for output, it can be undefined, it used to control LLM token usage" ), }, async ({ url_or_id, organization_id_or_slug, project_id_or_slug, mode }) => { let EVENT_ID = ""; if (url_or_id.includes("http") || url_or_id.includes("https")) { EVENT_ID = url_or_id.match(/events\/([a-f0-9]+)/)?.[1] || ""; } else { EVENT_ID = url_or_id; } if (!EVENT_ID) { return { content: [ { type: "text", text: "Invalid Event ID", }, ], }; } const eventEventData = await fetchSentryEvent<{ entries: any[]; }>(EVENT_ID, organization_id_or_slug, project_id_or_slug); if (!eventEventData) { return { content: [ { type: "text", text: "Failed to Get Event", }, ], }; } return { content: [ { type: "text", text: JSON.stringify( mode === "tiny" ? eventEventData.entries : eventEventData ), }, ], }; } );
- src/fetcher.ts:1-26 (helper)Helper function fetchSentryEvent that performs the actual API fetch to retrieve a single Sentry event by ID using the provided organization, project, and auth token./** get sentry event by <ID> */ export async function fetchSentryEvent<T>( eventId: string, organization_id_or_slug: string, project_id_or_slug: string ): Promise<T | null> { try { const issueRes = await fetch( `https://${process.env.SENTRY_HOST}/api/0/projects/${organization_id_or_slug}/${project_id_or_slug}/events/${eventId}/`, { method: "GET", headers: { Authorization: `Bearer ${process.env.SENTRY_USER_TOKEN}`, }, } ); if (!issueRes.ok) { throw new Error(`HTTP error! status: ${issueRes.status}`); } return (await issueRes.json()) as T; } catch (error) { console.error("Error making request:", error); return null; } }