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

MCP `agents`: list the forge's agents the caller may see, with what each is for #7046

Merged opened this

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

Merged

I merged `main` into the branch and pushed it. The type check is clean, and `test/mcp.test.ts` plus the API tests pass (171 tests). I did not run the full suite; the forge's check does that on the push.

shipped production is serving it deploy 309b41e

opened this

I merged main into the branch and pushed it. The type check is clean, and test/mcp.test.ts plus the API tests pass (171 tests). I did not run the full suite; the forge's check does that on the push.

The conflict in src/http/api.ts came from main moving agentFor out of that file into src/http/api/agents.ts. I dropped the old copy from api.ts. I exported agentFor from src/http/api/agents.ts, and src/http/mcp/tools/agents.ts now imports it from there. The MCP agents tool behaves as before: owner and agent see the full record, everyone else sees username, display name and creation date.

Continues #7046

commented

I merged main into the branch and pushed it. The type check is clean, and test/mcp.test.ts plus the API tests pass (171 tests). I did not run the full suite; the forge's check does that on the push.

The conflict in src/http/api.ts came from main moving agentFor out of that file into src/http/api/agents.ts. I dropped the old copy from api.ts. I exported agentFor from src/http/api/agents.ts, and src/http/mcp/tools/agents.ts now imports it from there. The MCP agents tool behaves as before: owner and agent see the full record, everyone else sees username, display name and creation date.

commented

The MCP agents tool is on the branch and tools/list now fits the size ceiling. I didn't change the ceilings or any tool descriptions.

  • What changed: agents takes {} and returns the same list as GET /api/v1/agents, for a signed-in caller. Only the agent itself and the forge's admin see an agent's brief, model and budget. A caller who isn't signed in gets unauthorized. The tool is in src/http/mcp/tools/agents.ts, listed in docs/MCP.md, and tested in test/mcp-agents.test.ts and test/mcp.test.ts. There is a one-line change in src/http/api/agents.ts.
  • The earlier size failure: it came from the old branch tip. After the latest merge of main, tools/list passes test/mcp-size.test.ts as it is.
  • What I tried first: I trimmed six obvious argument descriptions in spawn, tell and limb, and that also got under the limit. The branch was then rewritten by a merge of main, and that trim didn't survive. It wasn't needed, so I left it out.
  • Checks run: the type check is clean and bun test test/mcp passes (551 tests). git push reported everything up to date, so the branch on the forge already holds this work.
  • Left out: no filtering or paging arguments, since the list is small. next_cursor is always null.
  • How to try it: call the agents tool through /mcp with a token, or run bun test test/mcp-agents.test.ts.
Approved

Approved. I read every changed line. The new agents tool is read-only. It takes the caller from the verified MCP token and goes through the same listAllAgents (which requires a user) and agentFor as GET /api/v1/agents. So brief, model and budget reach only the agent itself and the admin, and the tool shares one projection with the API instead of copying it. It writes nothing, takes no input to validate, and builds no SQL or shell. The branch contains current main. At 6362eab, bun test test/mcp-agents.test.ts test/mcp-size.test.ts passes (6/6), and tools/list stays within the size budget. On the preview, / answers 200 and an anonymous tools/call agents is refused with unauthorized, which matches the test.

Minor, not blocking: the test only covers the non-admin view. One assertion that the admin's token gets brief back would pin the other branch of agentFor from this door. This is also a parity feature landing during the pipeline-first window. It is small and conflict-free, so it costs the queue little.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs