Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces token usage for the list_tags tool by introducing a new MinimalTag type that preserves only the essential fields (name and sha) and drops unnecessary fields like nested commit objects and download URLs. The implementation follows the established minimal types pattern used for other list operations (e.g., MinimalBranch, MinimalCommit). Token reduction measurements show approximately 73% fewer tokens with this change.
Changes:
- Added
MinimalTagtype withnameandshafields - Added
convertToMinimalTag()conversion function to transform GitHub API responses - Updated
list_tagstool to return minimal tags instead of full repository tag objects - Updated tests to validate the new minimal type structure
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/github/minimal_types.go | Added MinimalTag type definition and convertToMinimalTag() conversion function |
| pkg/github/repositories.go | Updated ListTags handler to convert tags to minimal format before marshaling |
| pkg/github/repositories_test.go | Updated test expectations to use MinimalTag instead of *github.RepositoryTag |
tommaso-moro
approved these changes
Feb 25, 2026
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.
Summary
Reduces context usage for
list_tagsby introducing a newMinimalTagtype.Fields preserved
name,sha(flattened from nestedcommit.sha)Fields dropped
commit(nested object with multiple sub-fields),zipball_url,tarball_urlSingle Item Payload Diff
Before
{ "name": "v25.7.0", "commit": { "sha": "e7f5e71f3b71fba07bd94f758909fde4e58dc9e3", "url": "https://api.github.com/repos/nodejs/node/commits/e7f5e71f3b71fba07bd94f758909fde4e58dc9e3" }, "zipball_url": "https://api.github.com/repos/nodejs/node/zipball/refs/tags/v25.7.0", "tarball_url": "https://api.github.com/repos/nodejs/node/tarball/refs/tags/v25.7.0" }After
{ "name": "v25.7.0", "sha": "e7f5e71f3b71fba07bd94f758909fde4e58dc9e3" }Token Reduction
Measured using a script that makes use of OAI's
tiktokenlibrary (o200k_base) at 2 and 100 items. The web version can be found here.Why
list_tagswas returning raw*github.RepositoryTagobjects including a nestedCommitobject and download URLs. Only the tag name and commit SHA are useful for model reasoning, everything else is available viaget_tag.What changed
MinimalTagtype andconvertToMinimalTagconversion functionconvertToMinimalTaginlist_tagsMCP impact
Prompts tested (tool changes only)
List the last 2 tags in nodejs/nodeList the last 100 tags in nodejs/nodeSecurity / 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