Update Alert Rule
update_alert_ruleChange an alert rule (PUT /api/reports/cost-dashboard/alerts/{id}). Provide alert_id and only what should change — any of alert_name, alert_type, frequency, analysis_period, threshold_percent, threshold_amount, integration_id (an id pins it; null = whole organization, or for tokens_per_request every OpenAI connection), cost_center_id (budget / trend only; null removes it), per / min_requests / values (tokens_per_request only), services, accounts, tags, notification_channel_ids (replaces; [] detaches all), emails (replaces; max 5; [] clears). Everything you omit is kept: the tool reads the rule and resends it with your changes. Changing alert_type drops the old thresholds (percent, money and days mean different things per type) and resets analysis_period to the new type's default unless you pass them — send the new type's threshold with it (trend/anomaly/tokens_per_request: threshold_percent; budget: threshold_amount; expiry: threshold_amount days). A cost center is kept across a budget ↔ trend change and dropped for any other type. Setting a cost center makes the rule organization-wide and clears its services / accounts / tags. Changing to tokens_per_request (OpenAI only) sets frequency daily, clears services / accounts / tags and targets every OpenAI connection — a rule pinned to a non-OpenAI connection is unpinned by the change unless you pass an OpenAI integration_id. The rule must keep a channel or an email; a rule the backend auto-paused (its channel was deleted, or every recipient unsubscribed) resumes when saved with a working recipient. To pause or resume without editing, use set_alert_rule_active. Validation errors come back verbatim. Returns the updated rule. In the app any active member can create alert rules and manage the ones they created, contributors and admins manage every rule, viewers can attach saved channels but not ad-hoc emails, and the public demo organization is read-only; over MCP every write additionally needs the admin gate below. Alert rules need a paid plan. WRITE TOOL — MCP WRITES ARE OFF BY DEFAULT FOR EVERY ORGANIZATION. This call needs ALL FOUR of: the admin:write scope, the organization switch turned on (an org admin enables it in Settings → Organization → AI agent access), an admin or super_admin org role, and confirm:true. Missing any one of them it refuses and changes nothing, and the error names which one — relay that to the user rather than retrying. Read-only cak_ API keys can never perform it. Example: { "alert_id": "…", "threshold_percent": 30, "confirm": true } changes only the threshold.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"alert_id": "<alert_id>"
},
"name": "update_alert_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| per | No | tokens_per_request only: evaluate each OpenAI API key (api_key, the default) or each model (model) on its own. | |
| tags | No | Only resources carrying ALL of these tags, e.g. [{ "key": "env", "value": "prod" }]. One value per key. [] or omitted = no tag filter. | |
| emails | No | REPLACES the ad-hoc addresses (max 5; [] clears; omit to keep). | |
| values | No | tokens_per_request only: REPLACES the key ids / model names the rule is limited to ([] = every key / model; omit to keep — changing per without values clears them). | |
| confirm | No | Set to true to actually perform this write. Required: the tool refuses the mutation unless confirm:true is present. Authorization for the change itself is your org role, checked server-side. | |
| accounts | No | Only these sub-accounts — AWS linked accounts, Azure subscriptions, GCP projects — as raw ids (get_available_linked_accounts). [] or omitted = all accounts. | |
| alert_id | Yes | The rule to change (alertId from list_alert_rules). | |
| services | No | Only these provider services (e.g. ["AmazonEC2"]; get_available_services lists them). [] or omitted = all services. | |
| frequency | No | How often the rule is evaluated, at 08:00 UTC: daily (every day) | weekly (Mondays) | monthly (the 3rd). Default weekly; tokens_per_request must be (and defaults to) daily. | |
| alert_name | No | New display name. | |
| alert_type | No | trend = total spend for the scope rose by ≥ threshold_percent vs the previous period; anomaly = per-service scan, each service vs its own baseline (average of the 4 prior windows), flagged when it rises ≥ threshold_percent AND the increase is ≥ threshold_amount (minimum impact, default 50); budget = total spend for the analysis period reached threshold_amount (a standalone spend threshold — NOT linked to budgets from create_budget); expiry = a commitment on the Commitments page in the rule's provider and connection scope (AWS Reserved Instances and Savings Plans; Azure reservations and savings plans when their end dates are available; never Google Cloud CUDs, which have no end date in Google's billing export) expires within threshold_amount days, day N included; each commitment notifies once, and services / accounts / tags do not apply; tokens_per_request = OpenAI only: the 7-day average input tokens per request (uncached + cached input tokens ÷ requests) of each OpenAI API key or model rose more than threshold_percent above its prior 28-day average on 3 consecutive days, counting only keys / models with at least min_requests requests in the 7 days (daily frequency only). | |
| min_requests | No | tokens_per_request only: a key or model needs at least this many requests in the 7-day window before it can fire (default 1000), so low-volume keys do not trip it. | |
| cost_center_id | No | budget / trend only: an id scopes the rule to that cost center (organization-wide; clears the connection pin and the services / accounts / tags filters); null removes the cost center; omit to keep it. Kept across a budget ↔ trend type change, dropped when the new type can't hold it. | |
| integration_id | No | Re-target the rule: an integration id pins it to that connection; null makes it org-wide (every provider; for tokens_per_request, every OpenAI connection); omit to keep the current target. Not allowed on a cost-center rule. | |
| analysis_period | No | The spend window evaluated, in whole UTC days of settled cost data: the last day counted is the day before yesterday for AWS, Azure and GCP and yesterday for Snowflake, OpenAI and Anthropic (an organization-wide rule follows the slowest provider it has recent data from). trend/anomaly compare it with the window before: daily (day over day) | weekly (7 days) | monthly (30 days). budget sums spend over last_24h (one day) | last_7d | last_30d | current_month (month to date; on a monthly-frequency rule, the last full calendar month). tokens_per_request takes only 7d_vs_28d (the last 7 days vs the 28 days before). Other type/period pairs are refused. expiry ignores it. Defaults: trend/anomaly weekly, budget current_month, expiry last_30d, tokens_per_request 7d_vs_28d. | |
| threshold_amount | No | budget: the spend amount (org display currency) that fires the rule, > 0. expiry: days of notice, a whole number 1-365. anomaly: optional minimum impact — the smallest increase worth flagging (default 50). Ignored by trend and tokens_per_request. | |
| threshold_percent | No | trend, anomaly and tokens_per_request: the % rise that fires the rule (must be > 0; required). For tokens_per_request the Alerts form suggests 50. Ignored by budget/expiry. | |
| notification_channel_ids | No | REPLACES the attached channels ([] detaches all; omit to keep). The rule must still have a channel or an email afterwards. |