Public: anyone can read this; the crew can change it.

MCP reads the rows a fleet query line selects #10153

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

MCP can now preview a fleet query line: the `flow` tool takes `{ q, sort? }` and answers `{ kind, columns, items }`. It reads through `viewFleet`, the same function `/fleet` and `GET /api/v1/fleet/rows` use. I did not run the full suite or `bun scripts/design-lint.ts` (the change doesn't touch `src/web/`). `test/mcp-fleet-rows.test.ts`, `test/mcp-size.test.ts`, `test/mcp-flow-bugs.test.ts`, `test/…

shipped production is serving it deploy 432b99c

opened this

MCP can now preview a fleet query line: the flow tool takes { q, sort? } and answers { kind, columns, items }. It reads through viewFleet, the same function /fleet and GET /api/v1/fleet/rows use. I did not run the full suite or bun scripts/design-lint.ts (the change doesn't touch src/web/). test/mcp-fleet-rows.test.ts, test/mcp-size.test.ts, test/mcp-flow-bugs.test.ts, test/mcp-flow-why.test.ts, bun x tsc --noEmit and bun scripts/gate.ts pass.

  • Tool choice: no existing tool took fleet lines, so I put the action on flow rather than adding a tool. The ceilings are untouched. flow's one-line description was already near its 120-byte limit, so I shortened it. The fuller wording, which names /fleet, is in its doc.
  • Refusals: a bad line returns its parse reason, for example "cost wants a number". An unknown sort, an empty q and a q over 500 characters are refused too.
  • Visibility: rows are only those the token's user may read. A user who can't read private repositories gets public ones only.
  • Test: the new test calls flow with q and GET /fleet as the same user, on one line (repo owner:alice). Both show only the public repository, while an admin's MCP call also gets the private one. It also covers the refusals.
  • Docs: docs/features/fleet.md now lists the MCP door. I did not touch docs/MCP.md, so its "Room for a new tool" section doesn't mention this door.

To try it, call the flow tool with { "q": "run state:queued,running cost:>0.5", "sort": "-cost" }.

Closes #10132

commented

MCP can now preview a fleet query line: the flow tool takes { q, sort? } and answers { kind, columns, items }. It reads through viewFleet, the same function /fleet and GET /api/v1/fleet/rows use. I did not run the full suite or bun scripts/design-lint.ts (the change doesn't touch src/web/). test/mcp-fleet-rows.test.ts, test/mcp-size.test.ts, test/mcp-flow-bugs.test.ts, test/mcp-flow-why.test.ts, bun x tsc --noEmit and bun scripts/gate.ts pass.

  • Tool choice: no existing tool took fleet lines, so I put the action on flow rather than adding a tool. The ceilings are untouched. flow's one-line description was already near its 120-byte limit, so I shortened it. The fuller wording, which names /fleet, is in its doc.
  • Refusals: a bad line returns its parse reason, for example "cost wants a number". An unknown sort, an empty q and a q over 500 characters are refused too.
  • Visibility: rows are only those the token's user may read. A user who can't read private repositories gets public ones only.
  • Test: the new test calls flow with q and GET /fleet as the same user, on one line (repo owner:alice). Both show only the public repository, while an admin's MCP call also gets the private one. It also covers the refusals.
  • Docs: docs/features/fleet.md now lists the MCP door. I did not touch docs/MCP.md, so its "Room for a new tool" section doesn't mention this door.

To try it, call the flow tool with { "q": "run state:queued,running cost:>0.5", "sort": "-cost" }.

commented

The deploy log you pasted shows no failure, and I found nothing to fix, so I pushed nothing new. The log says ready, serving and done. The preview answers 200 on / and on /fleet?q=repo. "No tests declared, none run" only means forge.json names no test command for the preview deploy. It isn't an error.

The tests I ran before pushing all passed: bun test on the flow and MCP-size files, bun x tsc --noEmit and bun scripts/gate.ts. If the forge marked the pull red for some other reason, such as the check on the push, send me that log. I couldn't see a failing check from here.

Commit 00d34c6e is the pushed head, and the tree is clean.

commented

The MCP flow tool now accepts q, a fleet query line, and returns the rows that line selects. I pushed a new empty commit to fix the gate failure, whose message carries the required Try: line. No code changed, and I did not re-run the gate, type check or tests here. The forge's check will run them on this push.

To try it on the preview, call the MCP flow tool with q set to a fleet query line. Then compare its rows with /fleet?q= on the same preview.

Approved

Clean. flow with { q, sort? } goes through viewFleet with the caller as viewer, so row visibility and the 500-row cap are the same as /fleet. q and sort are validated at the boundary, and a bad line answers its parse reason. The test covers a non-admin and an admin, plus the refusals. The fleet doc lists the MCP door. No new dependency, no dead code. Residual nit, not blocking: the test compares /fleet by substring rather than by the full row set.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs