Skip to main content
Glama
Leee62

Sentry Issues MCP

by Leee62

get_project_events

Retrieve issue events from Sentry projects using organization and project identifiers. Control output format to manage token usage effectively.

Instructions

get issue events by inputting sentry organization id or slug and sentry project name or slug

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organization_id_or_slugNosentry organization id or slug, it can be undefined
project_id_or_slugNosentry project name or slug, it can be undefined
modeNomode for output, it can be undefined, it used to control LLM token usagetiny

Implementation Reference

  • The MCP tool handler function for 'get_project_events'. It fetches events using the helper fetchSentryEvents, processes the output based on the 'mode' parameter ('tiny' summarizes to id/title/dateCreated, 'huge' full data), handles errors, and returns MCP-formatted content.
    async ({ organization_id_or_slug, project_id_or_slug, mode }) => { const eventsData = await fetchSentryEvents< { id: string; title: string; dateCreated: string }[] >(organization_id_or_slug, project_id_or_slug); if (!eventsData) { return { content: [ { type: "text", text: "Failed to Get Issue", }, ], }; } return { content: [ { type: "text", text: JSON.stringify( mode === "tiny" ? eventsData.map(({ id, title, dateCreated }) => ({ id, title, dateCreated, })) : eventsData ), }, ], }; }
  • Input schema for the 'get_project_events' tool using Zod, defining optional organization/project slugs (defaulting to env vars) and mode enum.
    { 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:97-152 (registration)
    Registration of the 'get_project_events' tool on the MCP server using server.tool(), including description, input schema, and execution handler.
    server.tool( "get_project_events", "get issue events by inputting sentry organization id or slug and sentry project name or slug", { 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 ({ organization_id_or_slug, project_id_or_slug, mode }) => { const eventsData = await fetchSentryEvents< { id: string; title: string; dateCreated: string }[] >(organization_id_or_slug, project_id_or_slug); if (!eventsData) { return { content: [ { type: "text", text: "Failed to Get Issue", }, ], }; } return { content: [ { type: "text", text: JSON.stringify( mode === "tiny" ? eventsData.map(({ id, title, dateCreated }) => ({ id, title, dateCreated, })) : eventsData ), }, ], }; } );
  • Supporting utility function fetchSentryEvents that makes the API call to retrieve Sentry project events, used by the tool handler.
    /** get sentry events */ export async function fetchSentryEvents<T>( 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/`, { 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; } }
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/Leee62/sentry-issues-mcp'

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