Skip to content

Commit f99e234

Browse files
docs(skills): adopt create_or_update_*_monitor tools and preview-then-confirm flow (#85)
## Summary - Renames every `create_*_monitor_mac` reference in skill docs to the new `create_or_update_{table,metric,validation,sql,comparison}_monitor` tools introduced in [ai-agent#998](monte-carlo-data/ai-agent#998). - Documents the **two-call preview-then-confirm flow** that those tools enforce: `dry_run=True` (the default) returns rendered MaC YAML in `result.yaml`; `dry_run=False` actually creates/updates the monitor and returns `result.monitor_uuid` + a deep link in `result.instructions` (with `result.yaml=None` by design). - Documents `monitor_uuid` for **update-in-place**, `is_draft` for draft mode, and the parity params (`schedule_type`, `interval_minutes`, `audiences`, `failure_audiences`, `notes`, `priority`, `tags`, plus per-type extras like `aggregate_time_sql`/`segment_sql`/`sensitivity`/`collection_lag_hours` on metric, `query_result_type`/`custom_sampling_sql`/`variable_definitions` on SQL). - Migrates the **tune-monitor** skill off the now-extended-only direct-GraphQL `create_metric_monitor` / `create_custom_sql_monitor` / `create_validation_monitor` tools (hidden from the public default toolset) onto `create_or_update_*_monitor` with `monitor_uuid` for in-place updates. - Updates `plugins/claude-code/evals/{monitoring-advisor,prevent}/live-evals-*.yaml` and the eval README example to assert the new tool names in `must_call` / `must_not_call`. - Bumps `monitoring-advisor` to **2.1.0** and `tune-monitor` to **1.1.0**. Plugin-level CHANGELOGs are left for the next release cut (no Unreleased section convention in this repo). ## Test plan - [ ] Spot-check the rendered skill docs to confirm tool names + preview/confirm flow read coherently end-to-end. - [ ] Run the `monitoring-advisor` live evals (`plugins/claude-code/evals/monitoring-advisor/live-evals-{dev,prod}.yaml`) against the updated dev MCP server — confirms the new tool names match what the server actually exposes in the default toolset. - [ ] Run the `prevent` live eval (`live-04-monitor-delegation`) and confirm the turn-2 trace shows one of the new `create_or_update_*_monitor` calls. - [ ] Manually exercise the tune-monitor apply step against a sandbox monitor: `dry_run=True` returns YAML, `dry_run=False` updates in place and returns the deep link. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 0607542 commit f99e234

16 files changed

Lines changed: 219 additions & 82 deletions

plugins/claude-code/evals/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Edit `<skill>/live-evals-<env>.yaml`. All cases use the `turns` format:
9999
- prompt: "Your prompt here"
100100
criteria:
101101
must_call: [get_warehouses]
102-
must_not_call: [create_table_monitor_mac]
102+
must_not_call: [create_or_update_table_monitor]
103103
output_must_not_contain: ["MCON++"]
104104
criteria:
105105
judge_rubric: |

plugins/claude-code/evals/monitoring-advisor/live-evals-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cases:
44
- prompt: "What warehouses do I have access to?"
55
criteria:
66
must_call: [get_warehouses]
7-
must_not_call: [create_table_monitor_mac, create_metric_monitor_mac]
7+
must_not_call: [create_or_update_table_monitor, create_or_update_metric_monitor]
88
output_must_not_contain: ["MCON++"]
99
criteria:
1010
judge_rubric: |

plugins/claude-code/evals/monitoring-advisor/live-evals-prod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cases:
44
- prompt: "What warehouses do I have access to?"
55
criteria:
66
must_call: [get_warehouses]
7-
must_not_call: [create_table_monitor_mac, create_metric_monitor_mac]
7+
must_not_call: [create_or_update_table_monitor, create_or_update_metric_monitor]
88
output_must_not_contain: ["MCON++"]
99
criteria:
1010
judge_rubric: |

plugins/claude-code/evals/prevent/live-evals-dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ cases:
7474
monitor generation to the monitoring-advisor skill — not generate
7575
monitor YAML inline as part of prevent. The handoff is observable
7676
via the monitoring-advisor's MCP calls (one of:
77-
get_validation_predicates, create_validation_monitor_mac,
78-
create_metric_monitor_mac, create_comparison_monitor_mac,
79-
create_custom_sql_monitor_mac) appearing in the turn 2 trace.
77+
get_validation_predicates, create_or_update_validation_monitor,
78+
create_or_update_metric_monitor, create_or_update_comparison_monitor,
79+
create_or_update_sql_monitor) appearing in the turn 2 trace.
8080
8181
The output should include monitor YAML (or describe the YAML) that
8282
targets the is_active column specifically — for example a validation

skills/monitoring-advisor/SKILL.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: monte-carlo-monitoring-advisor
33
description: Analyze data coverage, create monitors for warehouse tables and AI agents. Covers coverage gaps, use-case analysis, data monitor creation, and agent observability.
44
bucket: Monitoring
5-
version: 2.0.0
5+
version: 2.1.1
66
---
77

88
# Monte Carlo Monitoring Advisor Skill
@@ -82,13 +82,15 @@ All tools are available via the `monte-carlo` MCP server.
8282

8383
### Data monitor creation tools
8484

85+
All five tools follow a **two-call preview-then-confirm pattern**: the first call (with the default `dry_run=True`) returns rendered MaC YAML for review; the second call (`dry_run=False`) deploys the monitor live and returns a deep link to it. Pass `monitor_uuid` on either call to update an existing monitor in place instead of creating a new one. See `references/data-monitor-creation.md` for the full flow.
86+
8587
| Tool | Purpose |
8688
| --- | --- |
87-
| `create_table_monitor_mac` | Generate table monitor YAML (dry-run) |
88-
| `create_metric_monitor_mac` | Generate metric monitor YAML (dry-run) |
89-
| `create_validation_monitor_mac` | Generate validation monitor YAML (dry-run) |
90-
| `create_custom_sql_monitor_mac` | Generate custom SQL monitor YAML (dry-run) |
91-
| `create_comparison_monitor_mac` | Generate comparison monitor YAML (dry-run) |
89+
| `create_or_update_table_monitor` | Create or update a table monitor (preview YAML on `dry_run=True`, deploy on `dry_run=False`) |
90+
| `create_or_update_metric_monitor` | Create or update a metric monitor (preview YAML on `dry_run=True`, deploy on `dry_run=False`) |
91+
| `create_or_update_validation_monitor` | Create or update a validation monitor (preview YAML on `dry_run=True`, deploy on `dry_run=False`) |
92+
| `create_or_update_sql_monitor` | Create or update a custom SQL monitor (preview YAML on `dry_run=True`, deploy on `dry_run=False`) |
93+
| `create_or_update_comparison_monitor` | Create or update a comparison monitor (preview YAML on `dry_run=True`, deploy on `dry_run=False`) |
9294

9395
### Agent monitoring tools
9496

@@ -210,7 +212,7 @@ When coverage analysis leads to monitor creation, gather this context before rea
210212

211213
### Use-case tag monitors
212214

213-
The most common output of coverage analysis is a **table monitor scoped by use-case tags** via `create_table_monitor_mac`. The `asset_selection` parameter uses this structure:
215+
The most common output of coverage analysis is a **table monitor scoped by use-case tags** via `create_or_update_table_monitor`. The `asset_selection` parameter uses this structure:
214216

215217
```json
216218
{

skills/monitoring-advisor/references/data-comparison-monitor.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Comparison Monitor Reference
22

3-
Detailed reference for building `create_comparison_monitor_mac` tool calls.
3+
Detailed reference for building `create_or_update_comparison_monitor` tool calls. The tool follows the **two-call preview-then-confirm pattern** — see `data-monitor-creation.md` for the full flow.
44

55
## Critical Constraints
66

@@ -49,6 +49,16 @@ Before constructing alert conditions, you MUST verify that both tables exist and
4949
| `target_warehouse` | string | Warehouse name or UUID for the target table. Required if `target_table` is not an MCON. |
5050
| `segment_fields` | array of string | Fields to segment the comparison by. Must exist in BOTH tables with the same name. |
5151
| `domain_uuids` | array of string (uuid) | Domain UUIDs (use `get_domains` to list). Data monitors accept exactly one UUID in the list. |
52+
| `schedule_type` | string | Schedule type: `"fixed"` (default), `"dynamic"`, `"manual"`. |
53+
| `interval_minutes` | int | Schedule interval in minutes (only for `schedule_type="fixed"`). |
54+
| `audiences` | array of string | Notification audience **names** (not UUIDs) to alert when the monitor triggers. |
55+
| `failure_audiences` | array of string | Notification audience names to alert on query execution failures. |
56+
| `notes` | string | Free-text notes shown in the UI (separate from `description`). |
57+
| `priority` | string | Monitor priority (e.g. `"P1"`, `"P2"`). |
58+
| `tags` | array of `{name, value}` | Key-value tags to attach. |
59+
| `is_draft` | bool | When `True`, saves the monitor as a draft (not active). Default `False`. |
60+
| `monitor_uuid` | string (uuid) | UUID of an existing monitor to update in place. Omit to create a new monitor. **PUT semantics:** the call fully replaces the monitor's configuration — fields you omit revert to tool defaults, they are NOT left untouched. Before editing, read the current config with `get_monitors(monitor_ids=[<uuid>], include_fields=["config"])` and re-pass every field you want to keep. See `data-monitor-creation.md` (Step 7) for the safe-edit workflow. |
61+
| `dry_run` | bool | Default `True`. Preview mode. When omitted or `True`, returns YAML preview in `result.yaml`. When `False`, actually creates/updates the monitor and returns `result.monitor_uuid` + a deep link in `result.instructions`. See `data-monitor-creation.md`. |
5262

5363
---
5464

skills/monitoring-advisor/references/data-custom-sql-monitor.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom SQL Monitor Reference
22

3-
Detailed reference for building `create_custom_sql_monitor_mac` tool calls.
3+
Detailed reference for building `create_or_update_sql_monitor` tool calls. The tool follows the **two-call preview-then-confirm pattern** — see `data-monitor-creation.md` for the full flow.
44

55
## Critical Constraints
66

@@ -48,6 +48,19 @@ If you find yourself contorting another monitor type to fit the user's intent, s
4848
| Parameter | Type | Description |
4949
|-----------|------|-------------|
5050
| `domain_uuids` | array of string (uuid) | Domain UUIDs (use `get_domains` to list). Data monitors accept exactly one UUID in the list. |
51+
| `query_result_type` | string | What the SQL query returns — see the tool's enum for accepted values (single numeric is the most common). |
52+
| `custom_sampling_sql` | string | Optional SQL used to sample rows that contributed to the result (shown in alert detail). |
53+
| `variable_definitions` | object | Named variables that can be referenced in `sql` / `custom_sampling_sql`. |
54+
| `schedule_type` | string | Schedule type: `"fixed"` (default), `"dynamic"`, `"manual"`. |
55+
| `interval_minutes` | int | Schedule interval in minutes (only for `schedule_type="fixed"`). |
56+
| `audiences` | array of string | Notification audience **names** (not UUIDs) to alert when the monitor triggers. |
57+
| `failure_audiences` | array of string | Notification audience names to alert on query execution failures. |
58+
| `notes` | string | Free-text notes shown in the UI (separate from `description`). |
59+
| `priority` | string | Monitor priority (e.g. `"P1"`, `"P2"`). |
60+
| `tags` | array of `{name, value}` | Key-value tags to attach. |
61+
| `is_draft` | bool | When `True`, saves the monitor as a draft (not active). Default `False`. |
62+
| `monitor_uuid` | string (uuid) | UUID of an existing monitor to update in place. Omit to create a new monitor. **PUT semantics:** the call fully replaces the monitor's configuration — fields you omit revert to tool defaults, they are NOT left untouched. Before editing, read the current config with `get_monitors(monitor_ids=[<uuid>], include_fields=["config"])` and re-pass every field you want to keep. See `data-monitor-creation.md` (Step 7) for the safe-edit workflow. |
63+
| `dry_run` | bool | Default `True`. Preview mode. When omitted or `True`, returns YAML preview in `result.yaml`. When `False`, actually creates/updates the monitor and returns `result.monitor_uuid` + a deep link in `result.instructions`. See `data-monitor-creation.md`. |
5164

5265
---
5366

skills/monitoring-advisor/references/data-metric-monitor.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Metric Monitor Reference
22

3-
Detailed reference for building `create_metric_monitor_mac` tool calls.
3+
Detailed reference for building `create_or_update_metric_monitor` tool calls. The tool follows the **two-call preview-then-confirm pattern** — see `data-monitor-creation.md` for the full flow.
44

55
## Critical Constraints
66

@@ -35,12 +35,25 @@ Use a metric monitor when the user wants to:
3535
| Parameter | Type | Default | Description |
3636
|-----------|------|---------|-------------|
3737
| `aggregate_time_field` | string | none | Timestamp/datetime column for time-windowed aggregation. **When provided, MUST be a real column from the table — NEVER guess this value.** When omitted, the monitor queries all rows on each run (whole-table scan). Omit for tables without a suitable timestamp column. |
38+
| `aggregate_time_sql` | string | none | SQL expression that produces the timestamp for bucketing (e.g. `CAST(payload:event_time AS TIMESTAMP)`). Use when the timestamp is embedded in a variant/object column or needs transformation. Mutually exclusive with `aggregate_time_field`. |
3839
| `warehouse` | string | auto-resolved | Warehouse name or UUID. Required if `table` is not an MCON. |
3940
| `segment_fields` | array of string | none | Fields to group/segment metrics by (e.g., `["country", "status"]`). |
41+
| `segment_sql` | array of string | none | SQL expressions to segment by (e.g. `["CASE WHEN amount > 100 THEN 'high' ELSE 'low' END"]`). |
4042
| `aggregate_by` | string | `"day"` | Time interval: `"hour"`, `"day"`, `"week"`, `"month"`. |
4143
| `where_condition` | string | none | SQL WHERE clause (without `WHERE` keyword) to filter rows before computing metrics. |
44+
| `sensitivity` | string | none | Anomaly detection sensitivity for AUTO operators: `"low"`, `"medium"`, `"high"`. |
45+
| `collection_lag_hours` | int | none | Hours to wait after expected data arrival before running the monitor. |
46+
| `schedule_type` | string | `"fixed"` | Schedule type: `"fixed"`, `"dynamic"`, `"manual"`. |
4247
| `interval_minutes` | int | auto | Schedule interval in minutes. Must be compatible with `aggregate_by` (see note below). If not specified, the tool defaults to the minimum valid interval for the chosen `aggregate_by`. |
4348
| `domain_uuids` | array of string (uuid) | none | Domain UUIDs (use `get_domains` to list). Data monitors accept exactly one UUID in the list. |
49+
| `audiences` | array of string | none | Notification audience **names** (not UUIDs) to alert when the monitor triggers. |
50+
| `failure_audiences` | array of string | none | Notification audience names to alert on query execution failures. |
51+
| `notes` | string | none | Free-text notes shown in the UI (separate from `description`). |
52+
| `priority` | string | none | Monitor priority (e.g. `"P1"`, `"P2"`). |
53+
| `tags` | array of `{name, value}` | none | Key-value tags to attach. |
54+
| `is_draft` | bool | `False` | When `True`, saves the monitor as a draft (not active). |
55+
| `monitor_uuid` | string (uuid) | none | UUID of an existing monitor to update in place. Omit to create a new monitor. **PUT semantics:** the call fully replaces the monitor's configuration — fields you omit revert to tool defaults, they are NOT left untouched. Before editing, read the current config with `get_monitors(monitor_ids=[<uuid>], include_fields=["config"])` and re-pass every field you want to keep. See `data-monitor-creation.md` (Step 7) for the safe-edit workflow. |
56+
| `dry_run` | bool | `True` | Preview mode. When omitted or `True`, returns YAML preview in `result.yaml`. When `False`, actually creates/updates the monitor and returns `result.monitor_uuid` + a deep link in `result.instructions`. See `data-monitor-creation.md`. |
4457

4558
---
4659

0 commit comments

Comments
 (0)