Skip to main content
Glama

Costory: Your Finops MCP

preview_alert

Read-only

Backtest a cost-alert condition BEFORE creating it: replays the condition against the last lookbackDays (default 45) of data and reports how many times it would have fired. Takes the same queries + condition + dedup as create_alert (no notification channel needed). Window math includes lastWeekSum/lastWeekAvg/lastMonthSum/lastMonthAvg for the previous complete calendar period; averages divide by calendar days, including zero-spend days. Example: (a - lastMonthAvg(a)) / abs(lastMonthAvg(a)) > 0.1. The dedup window is per groupBy value; delivery stays one message listing newly eligible groups. Returns the evaluation window, firingDays (distinct days the condition held), firingRows (per-group fires), notificationsCount (days on which at least one newly eligible group would notify) and a sample of firing dates with per-group state. Use this to sanity-check a condition/threshold (and tune dedup) before calling create_alert. Effects: Read-only retrieval or computation; does not change saved resources or send messages. Scope: Authorized Costory workspace only. EXAMPLE: "Would 'alert if 7-day AWS spend tops $50k' have fired this month?" → { queries: [{ type: "cost", name: "a", metricId: "cost", currency: "USD", filterCel: "cos_provider in ["AWS"]" }], condition: "rollingSum(a, 7, DAY) > 50000", dedup: { kind: "CALENDAR", calendarUnit: "WEEK" }, lookbackDays: 30 }

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": {
      "queries": "<queries>",
      "condition": "<condition>"
    },
    "name": "preview_alert"
  }
}

Input Schema

NameRequiredDescriptionDefault
slugNoOrganization slug. Omit to auto-detect from your account (fails if you belong to multiple orgs).
dedupNoDeduplication config controlling how often a still-firing group notifies. The window is per groupBy value; delivery stays one message listing newly eligible groups. Either CALENDAR (kind: CALENDAR, calendarUnit: WEEK | MONTH) = at most once per current ISO week / calendar month, or ROLLING (kind: ROLLING, windowDays: N) = at most once every N days. Optional here: when provided the result also reports how many notifications would actually be sent after dedup.
contextNoOptional context used only for analytics; it does not affect tool execution. Omit it by default. Do not include conversation text, personal information, or workspace data.
queriesYesSame series objects as the `query` tool `queries` array (referenced by `condition`).
conditionYesAlerts v3 firing rule: a single boolean expression over the query names (`name` field of each query). Supports arithmetic (+ - * /), comparisons (> >= < <= == !=), logical and/or/not, parentheses, and these window functions: rollingSum(a, N, UNIT) (trailing sum over the last N units, UNIT ∈ DAY|WEEK|MONTH where MONTH is a 30-day window, not a calendar month, inclusive of today), weekToDateSum(a) (Monday-to-date), monthToDateSum(a) (1st-of-month-to-date), lastWeekSum(a)/lastMonthSum(a) (previous complete calendar period totals), lastWeekAvg(a)/lastMonthAvg(a) (period sum divided by 7 or the actual 28–31 calendar days, including zero-spend days), and timeShift(a, N, UNIT) (value shifted back N units; UNIT ∈ DAY|WEEK only — MONTH and YEAR are not supported; use timeShift(a, 30, DAY) as a 30-day approximation; may wrap a window function). Examples: `a > 1000`, `(a - lastMonthAvg(a)) / abs(lastMonthAvg(a)) > 0.1`, `rollingSum(a, 7, DAY) > 1000`, `(a - timeShift(a, 1, DAY)) / timeShift(a, 1, DAY) > 0.2`, `a > 10000 or rollingSum(a, 7, DAY) > 50000`.
llm_modelNoThe model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the server developer's analytics.
lookbackDaysNoTrailing window length in days to replay the condition over (default 45).
conversation_idNoThe conversation_id this server returned earlier in this conversation, unchanged, including after later user messages. Omit it if you have none. Recorded for the server developer's analytics.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / context / description
      Previous value: -"A few words on why you are calling this tool, for the server developer's analytics. Describe people and things by role, such as \"a customer\". Do not quote the user or include names, emails, or other personal details."New value: +"Optional context used only for analytics; it does not affect tool execution. Omit it by default. Do not include conversation text, personal information, or workspace data."
    • changedInput schema / required
      Previous value: -[
      -  "queries",
      -  "condition",
      -  "context"
      -]New value: +[
      +  "queries",
      +  "condition"
      +]
  2. Changed1 schema field changed
    • changedInput schema / properties / condition / description
      Previous value: -"Alerts v3 firing rule: a single boolean expression over the query names (`name` field of each query). Supports arithmetic (+ - * /), comparisons (> >= < <= == !=), logical and/or/not, parentheses, and these window functions: rollingSum(a, N, UNIT) (trailing sum over the last N units, UNIT ∈ DAY|WEEK|MONTH where MONTH is a 30-day window, not a calendar month, inclusive of today), weekToDateSum(a) (Monday-to-date), monthToDateSum(a) (1st-of-month-to-date), and timeShift(a, N, UNIT) (value shifted back N units; UNIT ∈ DAY|WEEK only — MONTH and YEAR are not supported; use timeShift(a, 30, DAY) as a 30-day approximation; may wrap a window function). Examples: `a > 1000`, `rollingSum(a, 7, DAY) > 1000`, `(a - timeShift(a, 1, DAY)) / timeShift(a, 1, DAY) > 0.2`, `a > 10000 or rollingSum(a, 7, DAY) > 50000`."New value: +"Alerts v3 firing rule: a single boolean expression over the query names (`name` field of each query). Supports arithmetic (+ - * /), comparisons (> >= < <= == !=), logical and/or/not, parentheses, and these window functions: rollingSum(a, N, UNIT) (trailing sum over the last N units, UNIT ∈ DAY|WEEK|MONTH where MONTH is a 30-day window, not a calendar month, inclusive of today), weekToDateSum(a) (Monday-to-date), monthToDateSum(a) (1st-of-month-to-date), lastWeekSum(a)/lastMonthSum(a) (previous complete calendar period totals), lastWeekAvg(a)/lastMonthAvg(a) (period sum divided by 7 or the actual 28–31 calendar days, including zero-spend days), and timeShift(a, N, UNIT) (value shifted back N units; UNIT ∈ DAY|WEEK only — MONTH and YEAR are not supported; use timeShift(a, 30, DAY) as a 30-day approximation; may wrap a window function). Examples: `a > 1000`, `(a - lastMonthAvg(a)) / abs(lastMonthAvg(a)) > 0.1`, `rollingSum(a, 7, DAY) > 1000`, `(a - timeShift(a, 1, DAY)) / timeShift(a, 1, DAY) > 0.2`, `a > 10000 or rollingSum(a, 7, DAY) > 50000`."
  3. Changed1 schema field changed
    • changedInput schema / properties / condition / description
      Previous value: -"Alerts v3 firing rule: a single boolean expression over the query names (`name` field of each query). Supports arithmetic (+ - * /), comparisons (> >= < <= == !=), logical and/or/not, parentheses, and these window functions: rollingSum(a, N, UNIT) (trailing sum over the last N units, UNIT ∈ DAY|WEEK|MONTH, inclusive of today), weekToDateSum(a) (Monday-to-date), monthToDateSum(a) (1st-of-month-to-date), and timeShift(a, N, UNIT) (value shifted back N units; may wrap a window function). Examples: `a > 1000`, `rollingSum(a, 7, DAY) > 1000`, `(a - timeShift(a, 1, DAY)) / timeShift(a, 1, DAY) > 0.2`, `a > 10000 or rollingSum(a, 7, DAY) > 50000`."New value: +"Alerts v3 firing rule: a single boolean expression over the query names (`name` field of each query). Supports arithmetic (+ - * /), comparisons (> >= < <= == !=), logical and/or/not, parentheses, and these window functions: rollingSum(a, N, UNIT) (trailing sum over the last N units, UNIT ∈ DAY|WEEK|MONTH where MONTH is a 30-day window, not a calendar month, inclusive of today), weekToDateSum(a) (Monday-to-date), monthToDateSum(a) (1st-of-month-to-date), and timeShift(a, N, UNIT) (value shifted back N units; UNIT ∈ DAY|WEEK only — MONTH and YEAR are not supported; use timeShift(a, 30, DAY) as a 30-day approximation; may wrap a window function). Examples: `a > 1000`, `rollingSum(a, 7, DAY) > 1000`, `(a - timeShift(a, 1, DAY)) / timeShift(a, 1, DAY) > 0.2`, `a > 10000 or rollingSum(a, 7, DAY) > 50000`."
  4. Changed2 schema fields changed
    • changedInput schema / properties / context / description
      Previous value: -"Explain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as \"a user\", \"the customer\", or \"an account\". Example: \"Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution.\""New value: +"A few words on why you are calling this tool, for the server developer's analytics. Describe people and things by role, such as \"a customer\". Do not quote the user or include names, emails, or other personal details."
    • changedInput schema / required
      Previous value: -[
      -  "queries",
      -  "condition",
      -  "context",
      -  "llm_model"
      -]New value: +[
      +  "queries",
      +  "condition",
      +  "context"
      +]
  5. Changed4 schema fields changed
    • addedInput schema / properties / context
      Added value: +{
      +  "description": "Explain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as \"a user\", \"the customer\", or \"an account\". Example: \"Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution.\"",
      +  "type": "string"
      +}
    • addedInput schema / properties / conversation_id
      Added value: +{
      +  "description": "The conversation_id this server returned earlier in this conversation, unchanged, including after later user messages. Omit it if you have none. Recorded for the server developer's analytics.",
      +  "type": "string"
      +}
    • addedInput schema / properties / llm_model
      Added value: +{
      +  "description": "The model identifier you are running as, for example \"claude-opus-4-8\" or \"gpt-5.2\". Pass \"unknown\" if you are not certain. Recorded for the server developer's analytics.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "queries",
      -  "condition"
      -]New value: +[
      +  "queries",
      +  "condition",
      +  "context",
      +  "llm_model"
      +]
  6. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[
      -  "condition"
      -]New value: +[
      +  "queries",
      +  "condition"
      +]
  7. Changed1 schema field changed
    • changedInput schema / properties / dedup / description
      Previous value: -"Deduplication config controlling how often a still-firing alert notifies. Either CALENDAR (kind: CALENDAR, calendarUnit: WEEK | MONTH) = at most once per current ISO week / calendar month, or ROLLING (kind: ROLLING, windowDays: N) = at most once every N days. Optional here: when provided the result also reports how many notifications would actually be sent after dedup."New value: +"Deduplication config controlling how often a still-firing group notifies. The window is per groupBy value; delivery stays one message listing newly eligible groups. Either CALENDAR (kind: CALENDAR, calendarUnit: WEEK | MONTH) = at most once per current ISO week / calendar month, or ROLLING (kind: ROLLING, windowDays: N) = at most once every N days. Optional here: when provided the result also reports how many notifications would actually be sent after dedup."
  8. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare read-only and non-destructive, but the description adds substantive behavior: the replay window, that averages divide by calendar days including zero-spend days, that the dedup window is per groupBy value, and that delivery stays a single message. It also restates the non-mutating effect in the Effects line, which reinforces rather than contradicts the annotations.

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?

It is front-loaded with purpose and the create_alert relationship, and the return-shape sentence is dense but useful. Some window-math detail (lastWeekSum/lastMonthAvg division semantics) is repeated from the condition schema, adding length without new meaning.

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?

With no output schema, the description compensates by enumerating the return fields — evaluation window, firingDays, firingRows, notificationsCount, and sample firing dates — plus a worked example and scope restriction. That is enough for an agent to invoke it correctly and interpret results.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description still adds value by stating the default lookbackDays of 45, explaining how dedup affects notification counting, and clarifying that queries/condition/dedup mirror create_alert. The detailed window-function grammar is largely duplicated from the schema, which caps this just above baseline.

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?

The opening clause states a specific verb and resource — 'Backtest a cost-alert condition BEFORE creating it' — and immediately positions it against the sibling create_alert. The agent can distinguish preview from creation without opening either schema.

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?

It gives an explicit when-to-use rule: 'Use this to sanity-check a condition/threshold (and tune dedup) before calling create_alert.' It also notes what is not needed (no notification channel), which further narrows the use case.

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