Skip to content

Use minimal response types for tool results - #3055

Merged
tommaso-moro merged 1 commit into
mainfrom
tommaso-moro-minimize-response-types
Aug 12, 2026
Merged

Use minimal response types for tool results#3055
tommaso-moro merged 1 commit into
mainfrom
tommaso-moro-minimize-response-types

Conversation

@tommaso-moro

@tommaso-morotommaso-moro commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Return compact successful responses for pull request statuses, pull request review comment replies, and individual Actions workflow runs while preserving identifiers, diagnostics, and human-facing links needed for follow-up work.

Why

Several successful tool responses include SDK transport metadata and nested objects that are not needed for diagnosis or supported follow-up calls. Focused contracts reduce response payload size without changing input schemas.

What changed

  • Added minimal combined-status and repository-status types for pull_request_read.get_status.
  • Returned the existing MinimalResponse contract for newly created pull request review comment replies in body-only and body-plus-reaction modes.
  • Reused MinimalWorkflowRun for actions_get.get_workflow_run so singular and list responses stay aligned.
  • Added serialization coverage for retained fields, omitted metadata, empty status lists, and all reply modes.

Response contracts and estimated size

The estimates below compare minified JSON generated from representative SDK and test fixtures before and after this change. Exact savings vary with populated optional fields and content length.

MethodRepresentative fixtureBeforeAfterEstimated reduction
pull_request_read.get_statusNo individual statuses216 B98 B54.6%
pull_request_read.get_statusTwo individual statuses1,129 B596 B47.2%
add_reply_to_pull_request_commentPopulated reply comment2,375 B102 B95.7%
actions_get.get_workflow_runExisting representative workflow-run fixture4,342 B1,015 B76.6%

pull_request_read.get_status

Retained combined-status fields:state, sha, total_count, and statuses.

Dropped combined-status fields:name, commit_url, and repository_url.

Retained fields for each status:state, context, description, target_url, created_at, and updated_at.

Dropped fields for each status:id, node_id, url, avatar_url, and creator. The human-facing target_url remains available; only the REST transport url is removed.

add_reply_to_pull_request_comment

Retained output fields for a newly created reply:id as a string and url populated from the comment's human-facing html_url. The reaction-only path was already minimal and is unchanged; body-plus-reaction responses now contain minimal comment and reaction objects.

Dropped reply-comment fields:node_id, in_reply_to_id, body, path, diff_hunk, pull_request_review_id, position, original_position, start_line, line, original_line, original_start_line, side, start_side, commit_id, original_commit_id, user, reactions, created_at, updated_at, author_association, the REST transport url, pull_request_url, and subject_type. The source html_url key is replaced by the minimal response's url key rather than losing its value.

actions_get.get_workflow_run

Retained fields:id, name, display_title, workflow_id, run_number, run_attempt, event, status, conclusion, head_branch, head_sha, path, html_url, created_at, updated_at, and run_started_at.

Retained nested data:head_commit.message; pull request numbers in pull_requests; compact actor and triggering_actor values containing login, id, profile_url, and avatar_url; and referenced workflow path, sha, and ref values.

Dropped fields:node_id, check_suite_id, check_suite_node_id, url, jobs_url, logs_url, check_suite_url, artifacts_url, cancel_url, rerun_url, previous_attempt_url, workflow_url, full repository and head_repository objects, all pull request fields except number, actor fields outside the compact identity above, and all head-commit fields except message.

MCP impact

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

Successful response bodies for the three methods above are smaller. Their input schemas and error behavior are unchanged.

Prompts tested (tool changes only)

  • Not tested through an interactive client; handler tests cover requests to get a pull request status, reply or react to a review comment, and get an Actions workflow run.

Security / limits

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

Responses intentionally omit unused metadata while retaining identifiers needed by supported follow-up operations.

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

Note: 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

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

Docs

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

Return compact response shapes for pull request statuses, review comment replies, and individual workflow runs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d6786153-698a-4563-97ad-a8221c40e306
@tommaso-moro
tommaso-moro marked this pull request as ready for review August 12, 2026 10:58
@tommaso-moro
tommaso-moro requested a review from a team as a code ownerAugust 12, 2026 10:58
CopilotAI balanced review requested due to automatic review settings August 12, 2026 10:58

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Reduces tool response payloads while retaining identifiers, diagnostics, and follow-up links.

Changes:

  • Introduces compact pull request status responses.
  • Minimizes review-comment reply results.
  • Aligns singular workflow-run responses with existing minimal list types.
Show a summary per file
FileDescription
pkg/github/pullrequests.goReturns minimal status and reply responses.
pkg/github/pullrequests_test.goVerifies compact status and reply serialization.
pkg/github/minimal_types.goAdds minimal commit-status types and converters.
pkg/github/actions.goUses the minimal workflow-run response.
pkg/github/actions_test.goVerifies compact workflow-run serialization.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@tommaso-moro
tommaso-moro merged commit ff15f68 into mainAug 12, 2026
20 checks passed
@tommaso-moro
tommaso-moro deleted the tommaso-moro-minimize-response-types branch August 12, 2026 11:33
Sign up for freeto 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.

3 participants

@tommaso-moro@kerobbi