Skip to content

Handle lightweight tags in get_tag#2400

Merged
kerobbi merged 2 commits into
mainfrom
kerobbi/get_tag_handle_lightweight_tags
May 11, 2026
Merged

Handle lightweight tags in get_tag#2400
kerobbi merged 2 commits into
mainfrom
kerobbi/get_tag_handle_lightweight_tags

Conversation

@kerobbi

@kerobbi kerobbi commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Add lightweight tag handling to get_tag by returning the ref directly when the tag points to a commit instead of trying to fetch a tag object that doesn't exist.

Why

Fixes #2297

get_tag does two API calls: resolve the ref, then fetch the tag object. However, while this is fine for annotated tags, lightweight ones point directly to a commit and have no tag object, so the second call always returns a 404.

What changed

  • Added a type check after resolving the tag ref (if the tag is lightweight, return the ref directly instead of attempting to fetch a non-existent tag object)
  • Updated existing tests and added test case for lightweight tag retrieval

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed - get_tag now handles lightweight tags instead of returning a 404
  • New tool added

Prompts tested (tool changes only)

  • "Get tag X from Z repo" - annotated works as before
  • "Get tag Y from Z repo" - lightweight now returns ref data instead of a 404

Security / limits

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

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)
Copilot AI review requested due to automatic review settings April 28, 2026 18:52
@kerobbi kerobbi requested a review from a team as a code owner April 28, 2026 18:52

Copilot AI 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

Adds support for lightweight tags in the get_tag tool by returning the resolved tag ref directly when the ref points to a commit (instead of attempting to fetch a non-existent tag object and returning 404s).

Changes:

  • Added a lightweight-vs-annotated tag type check after resolving the tag ref in get_tag.
  • Updated Test_GetTag to cover both annotated tag (tag object) and lightweight tag (ref-only) responses.
Show a summary per file
File Description
pkg/github/repositories.go Adds early return path for lightweight tags based on resolved ref object type.
pkg/github/repositories_test.go Extends get_tag tests to validate lightweight tag behavior and adjusts assertions accordingly.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
Comment thread pkg/github/repositories.go
Comment thread pkg/github/repositories_test.go
@kerobbi kerobbi merged commit c3dedbe into main May 11, 2026
20 of 21 checks passed
@kerobbi kerobbi deleted the kerobbi/get_tag_handle_lightweight_tags branch May 11, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants