Skip to main content
Glama

sentry_capture_exception

Capture and send application exceptions to Sentry for error monitoring and debugging purposes.

Instructions

Capture and send an exception to Sentry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorYesError message or description
levelNoSeverity level of the errorerror
tagsNoKey-value pairs to tag the error
contextNoAdditional context data
userNoUser information

Implementation Reference

  • The handler for the 'sentry_capture_exception' tool. It extracts parameters, creates an Error object if needed, sets scope with level, tags, context, and user, then calls Sentry.captureException.
    case "sentry_capture_exception": { const { error, level = "error", tags, context, user } = args as any; // Create an Error object if string provided const errorObj = error instanceof Error ? error : new Error(error); // Create a new scope for this specific error Sentry.withScope((scope) => { scope.setLevel(mapSeverityLevel(level)); if (tags) { Object.entries(tags).forEach(([key, value]) => { scope.setTag(key, value as string); }); } if (context) { Object.entries(context).forEach(([key, value]) => { scope.setContext(key, value as any); }); } if (user) { scope.setUser(user); } Sentry.captureException(errorObj); }); return { content: [ { type: "text", text: `Exception captured: ${error}`, }, ], }; }
  • The input schema and metadata for the 'sentry_capture_exception' tool, defining parameters like error, level, tags, context, and user.
    { name: "sentry_capture_exception", description: "Capture and send an exception to Sentry", inputSchema: { type: "object", properties: { error: { type: "string", description: "Error message or description", }, level: { type: "string", enum: ["fatal", "error", "warning", "info", "debug"], description: "Severity level of the error", default: "error", }, tags: { type: "object", description: "Key-value pairs to tag the error", additionalProperties: { type: "string" }, }, context: { type: "object", description: "Additional context data", additionalProperties: true, }, user: { type: "object", description: "User information", properties: { id: { type: "string" }, email: { type: "string" }, username: { type: "string" }, }, }, }, required: ["error"], }, },
  • Helper function to map string severity levels to Sentry SeverityLevel enum values, used in the handler.
    function mapSeverityLevel(level: string): Sentry.SeverityLevel { const severityMap: Record<string, Sentry.SeverityLevel> = { fatal: "fatal", error: "error", warning: "warning", info: "info", debug: "debug", }; return severityMap[level] || "error"; }

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/diegofornalha/sentry-mcp-cursor'

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