Skip to main content
Glama

sentry_create_alert_rule

Define custom alert rules for project monitoring by specifying conditions, actions, and frequency. Streamline error tracking and application health management with MCP Sentry para Cursor integration.

Instructions

Create an alert rule for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsNoAlert actions
conditionsNoAlert conditions
frequencyNoCheck frequency in minutes
nameYesAlert rule name
projectSlugYesProject slug/identifier

Implementation Reference

  • MCP tool handler that processes input arguments, applies defaults for conditions and actions, calls SentryAPIClient.createAlertRule, and returns confirmation.
    case "sentry_create_alert_rule": { if (!apiClient) { throw new Error("Sentry API client not initialized. Provide auth token."); } const { projectSlug, name, conditions = [], actions = [], frequency } = args as any; // Default alert rule if not provided const rule = { name, conditions: conditions.length > 0 ? conditions : [ { id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', } ], actions: actions.length > 0 ? actions : [ { id: 'sentry.rules.actions.notify_event.NotifyEventAction', } ], actionMatch: 'all', frequency: frequency || 30, }; const createdRule = await apiClient.createAlertRule(projectSlug, rule); return { content: [ { type: "text", text: `Alert rule created: ${createdRule.name} for project ${projectSlug}`, }, ], }; }
  • Input schema definition for the sentry_create_alert_rule tool, including properties for project, name, conditions, actions, and frequency.
    { name: "sentry_create_alert_rule", description: "Create an alert rule for a project", inputSchema: { type: "object", properties: { projectSlug: { type: "string", description: "Project slug/identifier", }, name: { type: "string", description: "Alert rule name", }, conditions: { type: "array", description: "Alert conditions", }, actions: { type: "array", description: "Alert actions", }, frequency: { type: "number", description: "Check frequency in minutes", default: 30, }, }, required: ["projectSlug", "name"], }, },
  • Helper method in SentryAPIClient that sends a POST request to the Sentry API endpoint to create the alert rule.
    async createAlertRule(projectSlug: string, rule: any) { return this.request(`/projects/${this.org}/${projectSlug}/rules/`, { method: 'POST', body: JSON.stringify(rule), }); }
  • src/index.ts:484-514 (registration)
    Tool registration in the listTools response, defining name, description, and schema for discovery.
    { name: "sentry_create_alert_rule", description: "Create an alert rule for a project", inputSchema: { type: "object", properties: { projectSlug: { type: "string", description: "Project slug/identifier", }, name: { type: "string", description: "Alert rule name", }, conditions: { type: "array", description: "Alert conditions", }, actions: { type: "array", description: "Alert actions", }, frequency: { type: "number", description: "Check frequency in minutes", default: 30, }, }, required: ["projectSlug", "name"], }, },

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