Skip to main content
Glama

Update Alert Rule

update_alert_rule
Idempotent

Change 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

NameRequiredDescriptionDefault
perNotokens_per_request only: evaluate each OpenAI API key (api_key, the default) or each model (model) on its own.
tagsNoOnly resources carrying ALL of these tags, e.g. [{ "key": "env", "value": "prod" }]. One value per key. [] or omitted = no tag filter.
emailsNoREPLACES the ad-hoc addresses (max 5; [] clears; omit to keep).
valuesNotokens_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).
confirmNoSet 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.
accountsNoOnly these sub-accounts — AWS linked accounts, Azure subscriptions, GCP projects — as raw ids (get_available_linked_accounts). [] or omitted = all accounts.
alert_idYesThe rule to change (alertId from list_alert_rules).
servicesNoOnly these provider services (e.g. ["AmazonEC2"]; get_available_services lists them). [] or omitted = all services.
frequencyNoHow 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_nameNoNew display name.
alert_typeNotrend = 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_requestsNotokens_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_idNobudget / 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_idNoRe-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_periodNoThe 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_amountNobudget: 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_percentNotrend, 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_idsNoREPLACES the attached channels ([] detaches all; omit to keep). The rule must still have a channel or an email afterwards.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly=false, destructive=false, idempotent=true, openWorld=true, but the description goes far beyond them: it enumerates the four-part write gate (admin:write scope, org switch, role, confirm:true) and the exact refusal behavior, plan requirements, per-role permissions, and auto-pause/resume semantics. It also explains destructive-ish side effects the annotations do not deny, such as cost-center assignment clearing services/accounts/tags and alert_type changes dropping thresholds.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense and largely front-loaded: the change-then-consequences ordering is logical and the worked example anchors the semantics. It is long and partly re-lists field meanings the schema already documents, so a few sentences do not fully earn their place, but there is no filler or marketing language.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 18-parameter, high-stakes mutation with no output schema, it covers returns ("Returns the updated rule"), validation error behavior, retry advice ("relay that to the user rather than retrying"), and permission matrix. Nothing an agent needs in order to invoke safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds cross-parameter semantics the schema cannot express: alert_type changes dropping old thresholds and resetting analysis_period, cost centers surviving budget↔trend but not other transitions, tokens_per_request forcing daily frequency and unpinning non-OpenAI integrations, and channel-or-email invariants. It also conveys replace-vs-merge intent for the array fields beyond the field-level notes.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource plus the exact endpoint (PUT /api/reports/cost-dashboard/alerts/{id}), and the closing line orients the agent: "only what should change." It is clearly separable from create_alert_rule, get_alert_rule, and set_alert_rule_active, the last of which it names explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States when to use it (partial update semantics: "Everything you omit is kept") and when not to ("To pause or resume without editing, use set_alert_rule_active"), plus gating prerequisites and the paid-plan constraint. An agent can choose correctly without inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources