Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces context/token usage for the list_releases MCP tool by returning a trimmed MinimalRelease representation instead of the full *github.RepositoryRelease payload.
Changes:
- Added
convertToMinimalRelease(*github.RepositoryRelease) MinimalReleasefor consistent minimal release serialization. - Updated
list_releasesto convert each release toMinimalReleasebefore marshalling. - Adjusted
Test_ListReleasesto unmarshal and validate the minimalized response type.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/github/repositories.go | Convert ListReleases output to []MinimalRelease before JSON marshalling. |
| pkg/github/minimal_types.go | Add convertToMinimalRelease helper that populates the existing MinimalRelease type (including RFC3339 published_at). |
| pkg/github/repositories_test.go | Update Test_ListReleases to unmarshal into []MinimalRelease and validate tag_name values. |
|
Summary
Reduces context usage for
list_releasesby adding aconvertToMinimalReleasefunction for the existingMinimalReleasetype.Field preserved
id,tag_name,name,body,html_url,published_at,prerelease,draft,author(MinimalUser)Fields dropped
node_id,url,assets_url,upload_url,zipball_url,tarball_url,target_commitish,created_at,assets(full array with nested objects),immutable, fullUserobject (->MinimalUser)Single Item Payload Diff
Before
{ "tag_name": "v19.2.4", "target_commitish": "main", "name": "19.2.4 (January 26th, 2026)", "body": "## React Server Components\r\n\r\n- Add more DoS mitigations to Server Actions, and harden Server Components ([#35632](https://github.com/facebook/react/pull/35632) by @gnoff, @lubieowoce, @sebmarkbage, @unstubbable)", "draft": false, "prerelease": false, "id": 279999398, "created_at": "2026-01-26T17:04:55Z", "published_at": "2026-01-26T18:29:43Z", "url": "https://api.github.com/repos/facebook/react/releases/279999398", "html_url": "https://github.com/facebook/react/releases/tag/v19.2.4", "assets_url": "https://api.github.com/repos/facebook/react/releases/279999398/assets", "upload_url": "https://uploads.github.com/repos/facebook/react/releases/279999398/assets{?name,label}", "zipball_url": "https://api.github.com/repos/facebook/react/zipball/v19.2.4", "tarball_url": "https://api.github.com/repos/facebook/react/tarball/v19.2.4", "author": { "login": "eps1lon", "id": 12292047, "node_id": "MDQ6VXNlcjEyMjkyMDQ3", "avatar_url": "https://avatars.githubusercontent.com/u/12292047?v=4", "html_url": "https://github.com/eps1lon", "gravatar_id": "", "type": "User", "site_admin": false, "url": "https://api.github.com/users/eps1lon", "events_url": "https://api.github.com/users/eps1lon/events{/privacy}", "following_url": "https://api.github.com/users/eps1lon/following{/other_user}", "followers_url": "https://api.github.com/users/eps1lon/followers", "gists_url": "https://api.github.com/users/eps1lon/gists{/gist_id}", "organizations_url": "https://api.github.com/users/eps1lon/orgs", "received_events_url": "https://api.github.com/users/eps1lon/received_events", "repos_url": "https://api.github.com/users/eps1lon/repos", "starred_url": "https://api.github.com/users/eps1lon/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/eps1lon/subscriptions" }, "node_id": "RE_kwDOAJy2Ks4QsHOm", "immutable": false }After
{ "id": 279999398, "tag_name": "v19.2.4", "name": "19.2.4 (January 26th, 2026)", "body": "## React Server Components\r\n\r\n- Add more DoS mitigations to Server Actions, and harden Server Components ([#35632](https://github.com/facebook/react/pull/35632) by @gnoff, @lubieowoce, @sebmarkbage, @unstubbable)", "html_url": "https://github.com/facebook/react/releases/tag/v19.2.4", "published_at": "2026-01-26T18:29:43Z", "prerelease": false, "draft": false, "author": { "login": "eps1lon", "id": 12292047, "profile_url": "https://github.com/eps1lon", "avatar_url": "https://avatars.githubusercontent.com/u/12292047?v=4" } }Token Reduction
Measured using a script that makes use of OAI's
tiktokenlibrary (o200k_base) at 2 and 25 items.Why
list_releaseswas returning raw*github.RepositoryReleaseobjects with ~20+ fields including nested assets arrays, API URLs, and full user objects. Most of this is noise not useful for model reasoning. Details are available viaget_latest_releaseorget_release_by_tag.What changed
convertToMinimalReleaseconversion functionconvertToMinimalReleaseinlist_releasesMCP impact
Prompts tested (tool changes only)
List the last 2 releases in facebook/reactList the last 25 releases in facebook/reactSecurity / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testDocs