Reduce project item response size#2563
Merged
Merged
Conversation
Return compact project item content and field values from project item tools to avoid verbose issue and pull request payloads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces token-heavy GitHub Projects item responses by converting item-returning project tools to compact response shapes.
Changes:
- Adds minimal project item, content, and field-value types/converters.
- Updates list/get/update project item handlers to marshal minimal item responses.
- Expands tests to validate verbose PR payload fields are omitted.
Show a summary per file
| File | Description |
|---|---|
pkg/github/projects.go |
Routes project item responses through minimal conversion before JSON marshalling. |
pkg/github/minimal_types.go |
Adds compact project item response types and conversion helpers. |
pkg/github/projects_test.go |
Adds regression fixtures and assertions for trimmed project item output. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
Comment on lines
+1146
to
+1154
| name := stringFromMap(value, "name") | ||
| color := stringFromMap(value, "color") | ||
| if name == "" && color == "" { | ||
| return minimalProjectOptionValue{}, false | ||
| } | ||
| return minimalProjectOptionValue{ | ||
| ID: stringFromMap(value, "id"), | ||
| Name: name, | ||
| Color: color, |
Comment on lines
+1161
to
+1166
| if startDate == "" && duration == 0 { | ||
| return minimalProjectIterationValue{}, false | ||
| } | ||
| return minimalProjectIterationValue{ | ||
| ID: stringFromMap(value, "id"), | ||
| Title: stringFromMap(value, "title"), |
eca332b to
2e2d0db
Compare
…path The generic map decoding path for project field values treated 'name' (ProjectV2FieldOption) and 'title' (ProjectV2FieldIteration) as plain strings, but the GitHub API returns them as ProjectV2TextContent objects with raw/html fields. As a result, single-select option names and iteration titles could be returned empty when values reached the minimal converter as map[string]any instead of typed structs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 GitHub Projects item responses by returning minimal project item, content, and field-value shapes from item returning project tools.
Why
Project item responses currently include verbose issue/PR content such as bodies, full repository objects, expanded users, URL templates, and link metadata, which can make
list_project_itemsandget_project_itemimpractical for LLM workflows over larger boards.Fixes #2383
Token savings measured against 5 live issue-backed project items:
What changed
pkg/github/minimal_types.golist_project_items,get_project_item, andupdate_project_itemto return minimal project item responsesbody,_links,head,base, URL templates,statuses_url, anddiff_urlare omittedMCP impact
projects_list:list_project_items,projects_get:get_project_item, andprojects_write:update_project_itemnow return compact item responses instead of full GitHub issue/PR payloads. Tool parameters and schemas are unchanged.Prompts tested (tool changes only)
Security / limits
Responses now intentionally omit verbose issue/PR bodies, expanded users, repository URL templates, and link metadata to reduce context usage and avoid returning unnecessary data by default.
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint./script/testDocs