Skip to content

Commit 8dd04dd

Browse files
committed
fix: use proper API error response in ListReleases pagination
Fix ListReleases to use ghErrors.NewGitHubAPIErrorResponse instead of returning a raw Go error via fmt.Errorf. This ensures API errors are properly surfaced as tool result errors to the user, consistent with the pattern used in other tools like ListGists. Signed-off-by: Srikanth Patchava <spatchava@meta.com>
1 parent 724cc82 commit 8dd04dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/github/repositories.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func CreateOrUpdateFile(t translations.TranslationHelperFunc) inventory.ServerTo
357357
ToolsetMetadataRepos,
358358
mcp.Tool{
359359
Name: "create_or_update_file",
360-
Description: t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", `Create or update a single file in a GitHub repository.
360+
Description: t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", `Create or update a single file in a GitHub repository.
361361
If updating, you should provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.
362362
363363
In order to obtain the SHA of original file version before updating, use the following git command:
@@ -1714,7 +1714,7 @@ func ListReleases(t translations.TranslationHelperFunc) inventory.ServerTool {
17141714

17151715
releases, resp, err := client.Repositories.ListReleases(ctx, owner, repo, opts)
17161716
if err != nil {
1717-
return nil, nil, fmt.Errorf("failed to list releases: %w", err)
1717+
return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to list releases", resp, err), nil, nil
17181718
}
17191719
defer func() { _ = resp.Body.Close() }()
17201720

0 commit comments

Comments
 (0)