Skip to main content
Glama

sentry_create_alert_rule

Create custom alert rules for Sentry projects to monitor errors and performance issues, enabling automated notifications and actions based on defined conditions.

Instructions

Create an alert rule for a project

Input Schema

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

Implementation Reference

  • MCP tool handler for 'sentry_create_alert_rule'. Extracts arguments, constructs alert rule with defaults, 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 and registration for the 'sentry_create_alert_rule' tool in the MCP server's tool list.
    { 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"], }, },
  • SentryAPIClient helper method that sends POST request to 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), }); }

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