feat: changes_list and changes_get tools - #4
Merged
Merged
Conversation
The changes API (commits and changelists across git, Perforce, and Lore) had no MCP tool, so an agent holding a build's commit_hash could not find the change it came from. - changes_list: source (lore|git|perforce), identifier, updated_since, orphaned, limit, cursor. Lore and Perforce share one source type server-side and are split here by the lore- identifier prefix. - changes_get: a change id, or a commit reference (full SHA, p4-<n>, lore-<n>) resolved through the exact identifier filter. A Perforce build stores p4-<n> while its change stores <n>, so the prefix is stripped; an unmatched reference is an error, not an empty result. - A 403 naming read:changes says to run `butter auth login` again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds MCP tools for changes (commits and changelists across git, Perforce, and Lore), so an agent holding a build's
commit_hashfrombuilds_getcan find the change it came from.What
changes_list:project_id, plussource(lore|git|perforce),identifier,updated_since,orphaned,limit,cursor. Returns the API's{changes, pagination}response.changes_get:project_id,change_id. An all-digitchange_idis the change id fromchanges_list; anything else (full git SHA, a Perforce build'sp4-<n>,lore-<n>) is resolved through the API's exactidentifierfilter, then the detail (files, approvals, linked builds, latest build, task ids) is returned. An unmatched reference is an error, not an empty result.403 insufficient_scopenamingread:changesbecomes an error that says to runbutter auth loginagain.Things to look at twice
p4-prefix. A Perforce BuildRun storesp4-<n>but its change stores the bare<n>, and theidentifierfilter is exact and unvalidated, so the prefix is stripped here or the lookup silently returns nothing.source_type=Changelistserver-side;sourcefilters the page by thelore-prefix, so a filtered page can hold fewer thanlimitrows.builds_get_investigationtool or the string/UUIDbuild_idfix that the in-monorepo copy of this server got for the builds read path.builds_gethere still declaresbuild_idas a number. Worth a separate sync.Depends on
The server must allow
read:changeson CLI-issued tokens (ButterStack/butter_stack#1961). Tokens issued before that deploy needbutter auth loginagain; a hand-made token from account settings withread:changesworks asBUTTERSTACK_API_TOKENtoday.Verification
npm test: 9/9 (6 new: argument-to-query mapping, lore split, get by id, get byp4-<n>, unknown commit is an error, 403 reissue hint; the tool-count test now expects fourteen).changes_get p4-207returned the Perforce change with its linked build,changes_list source=lorereturned only the Lore changelist, and a token withoutread:changesgot the reissue error.No version bump in this PR; a release is needed to publish it.