Skip to main content
Glama
Leee62

Sentry Issues MCP

by Leee62

get_project_events

Retrieve Sentry issue events by providing organization or project details. Control output size with 'tiny' or 'huge' mode to optimize LLM token usage.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function for the 'get_project_events' tool. It calls fetchSentryEvents to retrieve events, handles errors, and returns a JSON string of events (tiny mode extracts id, title, dateCreated).
    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 'get_project_events' tool using Zod: organization/project slugs (optional, env default), mode (tiny/huge).
    { 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, including description, input schema, and handler function.
    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 ), }, ], }; } );
  • Helper function fetchSentryEvents used by the handler to fetch Sentry project events via API.
    /** 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; } }

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/Leee62/sentry-issues-mcp'

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