Increase mcp scope

This commit is contained in:
Hugh Kaznowski
2026-09-06 17:34:36 +01:00
parent a810ecf396
commit 3b3ace146a
3 changed files with 795 additions and 188 deletions
+94 -46
View File
@@ -1,6 +1,6 @@
---
name: ottyl
description: Query and configure a running ottyl observability instance (logs, params, metrics, dashboards) via its MCP server.
description: Query and configure a running ottyl observability instance (logs, params, metrics, dashboards, settings, alerts, profiles) via its MCP server.
---
# ottyl
@@ -9,6 +9,11 @@ ottyl turns a piped command's stdout into a searchable log timeline plus ad-hoc
dashboards, served from a single process. This doc covers how an agent connects to and drives a
*running* instance.
Everything the web UI can do to change the running instance's state is exposed as an MCP tool —
declarations, dashboards, settings, alerts, profiles. Chart panels aren't screenshotted: use
`render_panel` / `render_dashboard` to get a chart's underlying series data back as JSON, so you
can reason about it directly instead of needing a browser.
## Find a session
Each `ottyl` process registers itself under a name (random, e.g. `comic-gazelle`, unless started
@@ -30,7 +35,8 @@ ottyl mcp --session comic-gazelle
ottyl mcp --port 51423
```
This exposes six tools, each a thin proxy onto the target instance's HTTP API.
This is a thin proxy onto the target instance's HTTP API — each tool below maps to one or more
`/api/...` routes.
## Get the latest SKILL.md
@@ -49,58 +55,100 @@ when the binary is rebuilt with a new `SKILL.md`.
## Tools
### `query_logs`
Count or read log lines matching a FilterBar query.
Most tools that operate on a profile take an optional `profile` argument; omit it to use the
instance's active profile.
```json
{ "filter": "regex(\"error\")", "count_only": true }
```
### Logs, timeline, stats
### `declare_param`
Extract a named value from matching log lines.
- **`query_logs`** — count or read log lines matching a FilterBar query, with time/sequence range
and sort options.
```json
{ "filter": "regex(\"error\")", "count_only": true }
```
- **`get_timeline`** — bucketed log-count histogram matching an optional filter (the data behind
the Log Timeline chart).
- **`get_stats`** — overall ingest stats: log count, sequence/timestamp bounds, ingest lag.
```json
{
"name": "status_code",
"message_match_regex": "status=(\\d+)",
"capture_group": "1",
"kind": "number"
}
```
### Params
### `declare_metric`
Bucket event counts/values by label, derived from matching log lines.
- **`list_params`** — list declared params (including auto-derived ones).
- **`declare_param`** — extract a named value from matching log lines.
```json
{ "name": "status_code", "message_match_regex": "status=(\\d+)", "capture_group": "1", "kind": "number" }
```
- **`clear_params`** — clear all declared params and re-derive auto params from retained logs.
```json
{
"name": "errors_total",
"message_match_regex": "level=error",
"label_params": ["status_code"]
}
```
### Metrics
### `create_dashboard`
Create an empty dashboard in a profile (defaults to the active profile).
- **`list_metrics`** — list declared metrics.
- **`declare_metric`** — bucket event counts/values by label, derived from matching log lines.
```json
{ "name": "errors_total", "message_match_regex": "level=error", "label_params": ["status_code"] }
```
- **`update_metric`** — update an existing metric declaration in place (`name` plus the same
fields as `declare_metric`).
- **`delete_metric`** — delete a declared metric by name.
- **`get_metric_bucket_values`** — read a metric's raw bucket values, optionally filtered by
label (`labels: "status_code=500"`) and time/sequence range.
```json
{ "name": "Errors" }
```
### PromQL
### `add_panel`
Add a panel to a dashboard, or update one in place by `panel_id`.
- **`run_promql_query`** — evaluate a PromQL-style query directly, returning raw series data
(`labels` + timestamped `points`) — the same evaluation dashboards use.
```json
{ "promql": "rate(errors_total[5m])" }
```
```json
{
"dashboard_id": "<id from create_dashboard>",
"title": "Errors over time",
"promql": "rate(errors_total[5m])",
"chart_type": "line"
}
```
### Dashboards & panels
### `get_dashboard`
Read a dashboard's current panels.
- **`list_dashboards`** — list dashboards saved in a profile.
- **`create_dashboard`** — create an empty dashboard.
```json
{ "name": "Errors" }
```
- **`get_dashboard`** — read a dashboard's panel definitions (promql/chart_type per panel, not
rendered data).
- **`delete_dashboard`** — delete a dashboard.
- **`add_panel`** — add a panel, or update one in place by `panel_id`.
```json
{ "dashboard_id": "<id>", "title": "Errors over time", "promql": "rate(errors_total[5m])", "chart_type": "line" }
```
- **`delete_panel`** — remove a panel from a dashboard by `panel_id`.
- **`render_panel`** — resolve one panel's promql, evaluate it, and return `{ panel, series }` as
JSON — this is how to "see" a chart without a browser.
```json
{ "dashboard_id": "<id>", "panel_id": "<id>" }
```
- **`render_dashboard`** — same as `render_panel` but for every panel in a dashboard at once,
returning `{ dashboard, panels: [{ panel, series }, ...] }`.
```json
{ "dashboard_id": "<id>" }
```
### Settings & theming
- **`get_settings`** / **`update_settings`** — read/update color scheme, active profile,
`max_logs`, custom theme, ntfy topic/server.
- **`list_css`** — list imported/linked custom CSS theme entries.
- **`import_css`** — import a CSS theme by file content.
- **`link_css`** — link an external CSS file/URL as a theme instead of importing content.
- **`remove_css`** / **`get_css_content`** — remove a CSS entry / read its raw content by id.
### Alerts
- **`list_alert_rules`** — list configured alert rules.
- **`create_alert_rule`** / **`update_alert_rule`** — `condition` is one of:
- `{"kind":"immediate","query":"..."}`
- `{"kind":"threshold","query":"...","op":"gt|lt|ge|le|eq|ne","threshold":N,"window_ms":N}`
- `{"kind":"newvalue","field_regex":"...","capture_group":"..."}`
- `{"kind":"ratio","query_a":"...","query_b":"...","op":"...","ratio":N,"window_ms":N}`
- **`delete_alert_rule`** — delete a rule by id.
- **`test_alert_notification`** — send a test ntfy notification to verify delivery config.
### Profiles
- **`list_profiles`** — list saved profiles with summary counts.
- **`create_profile`** — create a new, empty profile.
```json
{ "name": "my-service" }
```
- **`delete_profile`** — delete a profile by name.
- **`activate_profile`** — activate a profile, swapping in its declarations and dashboards as the
running instance's live state.