Skip to content

Reduce project item response size#2563

Merged
SamMorrowDrums merged 3 commits into
mainfrom
rosstarrant/reduce-project-item-output
May 28, 2026
Merged

Reduce project item response size#2563
SamMorrowDrums merged 3 commits into
mainfrom
rosstarrant/reduce-project-item-output

Conversation

@RossTarrant
Copy link
Copy Markdown
Contributor

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_items and get_project_item impractical for LLM workflows over larger boards.

Fixes #2383

Token savings measured against 5 live issue-backed project items:

Scope Before After Estimated tokens saved
5 project items ~12,875 tokens ~901 tokens ~11,974 tokens / 93.0%
Average per item ~2,575 tokens ~180 tokens ~2,395 tokens / 93.0%
Extrapolated 50 items ~128,750 tokens ~9,010 tokens ~119,740 tokens saved

What changed

  • Added minimal project item, content, and field-value response types in pkg/github/minimal_types.go
  • Converted issue, pull request, draft issue, assignee, label, repository, iteration, option, and linked PR values into compact forms
  • Updated list_project_items, get_project_item, and update_project_item to return minimal project item responses
  • Added regression tests proving bulky fields like body, _links, head, base, URL templates, statuses_url, and diff_url are omitted

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed

projects_list:list_project_items, projects_get:get_project_item, and projects_write:update_project_item now return compact item responses instead of full GitHub issue/PR payloads. Tool parameters and schemas are unchanged.

  • New tool added

Prompts tested (tool changes only)

  • "List the first 5 items in organization project 24815 owned by github"
  • "Get project item 191226814 from organization project 24815 owned by github"

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

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

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
  • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

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>
@RossTarrant RossTarrant requested a review from a team as a code owner May 28, 2026 09:25
Copilot AI review requested due to automatic review settings May 28, 2026 09:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread pkg/github/minimal_types.go Outdated
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 thread pkg/github/minimal_types.go Outdated
Comment on lines +1161 to +1166
if startDate == "" && duration == 0 {
return minimalProjectIterationValue{}, false
}
return minimalProjectIterationValue{
ID: stringFromMap(value, "id"),
Title: stringFromMap(value, "title"),
@RossTarrant RossTarrant force-pushed the rosstarrant/reduce-project-item-output branch from eca332b to 2e2d0db Compare May 28, 2026 10:38
SamMorrowDrums and others added 2 commits May 28, 2026 13:12
…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>
@SamMorrowDrums SamMorrowDrums merged commit 3b6cdaf into main May 28, 2026
19 checks passed
@SamMorrowDrums SamMorrowDrums deleted the rosstarrant/reduce-project-item-output branch May 28, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce context usage for projects_list / projects_get project item responses

3 participants