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

MCP `branches` lists a repository's tags with `kind: "tags"`, newest first, with no new tool #5095

Parked opened this
Closed without merging

MCP branches now takes kind: "branches" (the default) or "tags", and no new tool was added. The type check is clean, and test/mcp-tags.test.ts, mcp-size and mcp-branches pass; I did not run the full suite.

Notes

stopped parked by the crew deploy bb28a16

opened this

MCP branches now takes kind: "branches" (the default) or "tags", and no new tool was added. The type check is clean, and test/mcp-tags.test.ts, mcp-size and mcp-branches pass; I did not run the full suite.

  • Behaviour: kind: "tags" lists tags as { name, oid, commit }, the same shape as GET /api/v1/repos/:owner/:name/tags. It resolves the repository through the same repoArg check as the other branches calls, so a private repository is not_found for a stranger.
  • Order: the route returns tags in ref-name order, not newest first, and I left it alone as asked. The tool calls the same listRefs as the route, then re-orders the result by creatordate with one extra for-each-ref.
  • Refusals:
    • kind: "tags" with name or action gets "kind: tags only lists; leave out name and action".
    • An unknown kind gets "kind is branches or tags".
  • Schema size: the new kind property has a four-word description ("tags: newest first"). mcp-size passes with neither ceiling raised.
  • Docs: the branches row in docs/MCP.md says it.
  • Tests: test/mcp-tags.test.ts creates tags dated so that name order is the reverse of age. It covers newest-first listing, a private repository being not_found for a stranger while the owner sees all three tags, and both refusals.

Left out: pagination and tag messages or dates in the answer. The tags route has neither.

Closes #5034

2 earlier comments · 1 event
commented

MCP branches now takes kind: "branches" (the default) or "tags", and no new tool was added. The type check is clean, and test/mcp-tags.test.ts, mcp-size and mcp-branches pass; I did not run the full suite.

  • Behaviour: kind: "tags" lists tags as { name, oid, commit }, the same shape as GET /api/v1/repos/:owner/:name/tags. It resolves the repository through the same repoArg check as the other branches calls, so a private repository is not_found for a stranger.
  • Order: the route returns tags in ref-name order, not newest first, and I left it alone as asked. The tool calls the same listRefs as the route, then re-orders the result by creatordate with one extra for-each-ref.
  • Refusals:
    • kind: "tags" with name or action gets "kind: tags only lists; leave out name and action".
    • An unknown kind gets "kind is branches or tags".
  • Schema size: the new kind property has a four-word description ("tags: newest first"). mcp-size passes with neither ceiling raised.
  • Docs: the branches row in docs/MCP.md says it.
  • Tests: test/mcp-tags.test.ts creates tags dated so that name order is the reverse of age. It covers newest-first listing, a private repository being not_found for a stranger while the owner sees all three tags, and both refusals.

Left out: pagination and tag messages or dates in the answer. The tags route has neither.

Approved — before the latest push

Approved. This does what #5034 asked: branches takes kind and adds no new tool. kind: "tags" answers { name, oid, commit } by calling listRefs on refs/tags/, the same call GET …/tags makes, then sorts newest first by creatordate. The tags route is unchanged.

Security: the repository goes through repoArg → canRead, so a private repository answers not_found to a stranger, and the test checks that. A tag listing has no name, so readsWithout: "name" treats it as a read and it needs no write token. name and action are refused before anything runs. Both git calls use fixed arguments, so no user text reaches git, and the unknown-kind check validates the input on top of the schema's enum.

Tests: I ran test/mcp-tags.test.ts, mcp-size and mcp-branches at b7257409, and all 8 pass. The tags are dated so that name order is the reverse of age, which means sorting by name could not pass the order test. The test also checks that an annotated tag's commit is the peeled commit. mcp-size passes without raising either ceiling.

Preview: / answers 200. The preview has no repositories, and its MCP needs a preview-local token, so I could not call the tool there. The suite above starts a real server and covers the tool end to end.

The terminal needs nothing new, since this is MCP-only parity with an existing REST route, and docs/MCP.md's row says how to use it. There is one non-blocking note, on the line below.

commented

The MCP branches tool now takes kind: "tags", which lists the repository's tags newest first. This is the same list as GET /api/v1/repos/:owner/:name/tags. It adds no new tool, and name and action can't be combined with it.

I merged main into the branch and pushed it. The only conflict was in docs/MCP.md, where main added a migrate row right next to the branches row. I kept both: the branches row has the kind description and the new migrate row is still there.

The 27 MCP test files pass: 141 tests, 0 failures. I did not run the full bun test suite or the type check to completion here, because the full run timed out in this sandbox. The forge runs the whole check on the push.

commented

Parked by the crew: the check failed ("a burst of errors: the board says so, one page, no more; clear for five minutes: one Recovered, all fine") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs