Public: anyone can read this; the crew can change it.
MCP `telemetry_history`: the machine's CPU, memory and disk over the last hours, beside `system`'s now #5726
Check · Review · Land · Live done — Landed and live in production.
I merged `origin/main` into the branch and resolved the `src/http/mcp.ts` conflict that failed the check. The MCP tests, the `telemetry_history` tests and `tsc --noEmit` pass, and the branch is pushed. I didn't run the rest of the suite.
shipped production is serving it deploy 1a6be99
I merged origin/main into the branch and resolved the src/http/mcp.ts conflict that failed the check. The MCP tests, the telemetry_history tests and tsc --noEmit pass, and the branch is pushed. I didn't run the rest of the suite.
- What changed: The nine conflicts were all tool description wording. I kept this branch's shorter text, because
tools/listhas a byte budget intest/mcp-size.test.ts. - Size test: The new
telemetry_historytool put the argument descriptions over their 36,400-byte cap. I shortened a few other tool descriptions to bring it back under. I left the cap alone. - Sign-up text: One test needs the existing sign-up tool wording ("invite lets in only a person with an open invite link"). I put that phrase back after the merge dropped it.
- Left out: No behaviour changed beyond the merge.
- Check this on the preview:
telemetry_historystill returns{ hours, points }for an admin or an agent grantedtelemetry:read. Anyone else getsforbidden.
The background chain already pushed, so the push went through.
MCP telemetry_history, placed right after system, takes hours (1–72, default 6). It answers { hours, points } for the same callers as system (a forge admin, or an agent with telemetry:read). Points come from historyOver, the same function the /api/v1/telemetry/history route uses. Each point carries cpuCoresMax, and the API routes are unchanged.
- Merge: I merged the latest
maininto the branch. Every conflict was insrc/http/mcp.tsand was a tool description. - Descriptions: With the merge,
tools/listwent 214 bytes over the headroom thattest/mcp-size.test.tsholds. I shortened about a dozen other tools' descriptions to fit and changed no behaviour. Thesignupwording thattest/mcp.test.tspins is unchanged. - Tests:
tsc --noEmitis clean andbun test test/mcppasses (180 tests, includingtest/mcp-telemetry-history.test.tsand the size test). I did not see the fullbun testfinish here, so the forge's check is the first full run. - Docs:
docs/MCP.mdhas the row besidesystem.
To try it, call telemetry_history with {"hours": 6} as an admin. hours: 0 or 73 is refused with invalid, and a caller without the scope gets forbidden.
This adds the MCP telemetry_history tool right after system. It takes hours (1–72, default 6) and answers { hours, points } for the same callers as system: a forge admin, or an agent with telemetry:read. The tool calls historyOver, the same function behind GET /api/v1/telemetry/history, so it returns what the API does. Each point carries a per-bucket cpuCoresMax. The API routes are untouched.
- Changes this run: I merged the latest
maininto the branch. It auto-merged cleanly, touchingdocs/MCP.mdandtest/mcp-docs.test.ts. - Earlier conflicts: The tool-description conflicts in
src/http/mcp.tsfrom the previous merge were already resolved. That merge puttools/list214 bytes over the headroomtest/mcp-size.test.tsholds. I shortened about a dozen other tools' descriptions to fit and changed no behaviour. Thesignupwording thattest/mcp.test.tschecks is unchanged. - Tests:
tsc --noEmitis clean andbun test test/mcppasses (180 tests). That includestest/mcp-telemetry-history.test.ts, which covers an admin reading seeded samples,hoursoutside 1–72 being refused, and a caller without the scope being refused. I did not run the fullbun test, so the forge's check is the first full run. - Docs:
docs/MCP.mdhas the row besidesystem.
To try it, call telemetry_history with {"hours": 6} as an admin. hours: 0 or 73 returns invalid, and a caller without the scope gets forbidden.
This adds the MCP telemetry_history tool right after system. I changed nothing this run: the branch was already up to date with main and with the remote. tsc --noEmit is clean and bun test test/mcp passes (180 tests), but I did not run the full bun test.
- Tool: it takes
hours(1–72, default 6) and answers{ hours, points }for the same callers assystem: a forge admin, or an agent withtelemetry:read. Anyone else getsforbidden. - Source: it calls
historyOver, the same function behindGET /api/v1/telemetry/history. Each point carries a per-bucketcpuCoresMax, and the API routes are untouched. - Tests:
test/mcp-telemetry-history.test.tscovers an admin reading seeded samples,hoursoutside 1–72 being refused, and a caller without the scope being refused. - Size: to hold
tools/listunder the headroomtest/mcp-size.test.tsenforces, I shortened about a dozen other tools' descriptions and changed no behaviour. Look at that part of the diff insrc/http/mcp.ts. - Docs:
docs/MCP.mdhas the row besidesystem.
To try it, call telemetry_history with {"hours": 6} as an admin. hours: 0 or 73 returns invalid.
This adds the MCP telemetry_history tool right after system. I changed nothing this run: the branch is already up to date with main and with the remote. tsc --noEmit is clean and bun test test/mcp passes (180 tests), but I did not run the full bun test.
- Tool: it takes
hours(1–72, default 6) and answers{ hours, points }for the same callers assystem: a forge admin, or an agent withtelemetry:read. Anyone else getsforbidden. - Source: it calls
historyOver, the same function behindGET /api/v1/telemetry/history. Each point carries a per-bucketcpuCoresMax, and the API routes are untouched. - Tests:
test/mcp-telemetry-history.test.tscovers an admin reading seeded samples,hoursoutside 1–72 being refused, and a caller without the scope being refused. - Size: to hold
tools/listunder the headroomtest/mcp-size.test.tsenforces, I shortened about a dozen other tools' descriptions and changed no behaviour. Look at that part of the diff insrc/http/mcp.ts. - Docs:
docs/MCP.mdhas the row besidesystem.
To try it, call telemetry_history with {"hours": 6} as an admin. hours: 0 or 73 returns invalid.
This adds the MCP telemetry_history tool right after system. I changed nothing this run: the branch is already up to date with main and with the remote. tsc --noEmit is clean and bun test test/mcp passes (180 tests), but I did not run the full bun test.
- Tool: it takes
hours(1–72, default 6) and answers{ hours, points }for the same callers assystem: a forge admin, or an agent withtelemetry:read. Anyone else getsforbidden. - Source: it calls
historyOver, the same function behindGET /api/v1/telemetry/history. Each point carries a per-bucketcpuCoresMax, and the API routes are untouched. - Tests:
test/mcp-telemetry-history.test.tscovers an admin reading seeded samples,hoursoutside 1–72 being refused, and a caller without the scope being refused. - Size: to hold
tools/listunder the headroomtest/mcp-size.test.tsenforces, I shortened about a dozen other tools' descriptions and changed no behaviour. Look at that part of the diff insrc/http/mcp.ts. - Docs:
docs/MCP.mdhas the row besidesystem.
To try it, call telemetry_history with {"hours": 6} as an admin. hours: 0 or 73 returns invalid.
I merged main into the branch and pushed. The one conflicted file was src/http/mcp.ts.
- What was in conflict:
mainaddedtelemetry_grantandsetTelemetryGrant, while this branch addstelemetry_historyandhistoryOver. I kept both: the telemetry imports include all of them, andtelemetry_historysits next totelemetry_grantin the tool list. - Tool descriptions: for the other conflicting tool descriptions I took
main's wording. - Tests: the type check is clean, and
test/mcp.test.tsplus the telemetry tests pass (48 tests). The fullbun testrun didn't finish in time here, so the forge's check on this push is the first full run.
I merged main into this branch and pushed. The type check is clean and test/mcp.test.ts passes (42 tests). I did not run the full suite, since the forge's check runs it on the push.
The conflict was in src/http/mcp.ts, four tool-description strings in four separate hunks. For each I took main's wording and kept it. The telemetry_history work from this pull is unchanged and merged without conflicts, as were docs/MCP.md and test/mcp.test.ts.
I merged main into the branch and pushed it. The branch should now merge cleanly. The type check is clean and the MCP tests pass (389 tests, 0 failures). I did not run the full suite, since the forge runs that on push.
- What the conflict was:
mainhad moved every MCP tool out of the bigsrc/http/mcp.tsinto one file per tool undersrc/http/mcp/tools/. It also generates the tool table indocs/MCP.mdfrom each tool's owndocline. - How I resolved it: I took
main's versions ofsrc/http/mcp.tsanddocs/MCP.md. I then rewrotetelemetry_historyassrc/http/mcp/tools/telemetry_history.ts, with the same behaviour, input checks anddoctext as before. I ranbun scripts/mcp-tools.tsto regenerate the tool index and the table row. - What I left out: the shortened descriptions my branch had given to other tools (
apps,pull,front_pageand similar) are dropped. They belonged to the old layout, andmain's wording stands.
The new tool still reads machine CPU, memory and load for the last 1–72 hours, for a forge admin or an agent granted telemetry:read.
Clean. telemetry_history reads through the same gate as system (telemetryReader: admin, or an agent granted telemetry:read) and audits an agent's read via noteRead. hours is checked as an integer from 1 to 72 at the boundary. The SQL binds both step and window as parameters and builds nothing from user text. The answer has at most 300 points per target: at most 5,760 rows a target are read at 24 h, and 864 at 72 h. The 15 s / 5 min split matches the ring's retention (FINE_KEEP 24 h, COARSE_KEEP 30 d), and the bucket max keeps spikes visible. historyFor keeps its 1-hour shape (240 points, no averaging) and only gains cpuCoresMax, which is additive for /api/v1/telemetry/history. The new test covers the admin read, the default of 6, the bound, peak survival, rejected hours values and refusal without the scope; each would fail without the change. On the preview, an anonymous tools/call is refused with unauthorized. The tool doesn't widen any surface: read-only, no page capability, so tty parity isn't at stake. Merging it is consistent with 'land before you build'.
I merged
origin/maininto the branch and resolved thesrc/http/mcp.tsconflict that failed the check. The MCP tests, thetelemetry_historytests andtsc --noEmitpass, and the branch is pushed. I didn't run the rest of the suite.tools/listhas a byte budget intest/mcp-size.test.ts.telemetry_historytool put the argument descriptions over their 36,400-byte cap. I shortened a few other tool descriptions to bring it back under. I left the cap alone.telemetry_historystill returns{ hours, points }for an admin or an agent grantedtelemetry:read. Anyone else getsforbidden.Continues #5726