MCPcopy
hub / github.com/github/github-mcp-server / addRawAPIErrorToContext

Function addRawAPIErrorToContext

pkg/errors/error.go:149–156  ·  view source on GitHub ↗
(ctx context.Context, err *GitHubRawAPIError)

Source from the content-addressed store, hash-verified

147}
148
149func addRawAPIErrorToContext(ctx context.Context, err *GitHubRawAPIError) (context.Context, error) {
150 if val, ok := ctx.Value(GitHubErrorKey{}).(*GitHubCtxErrors); ok {
151 val.raw = append(val.raw, err)
152 return ctx, nil
153 }
154
155 return nil, fmt.Errorf("context does not contain GitHubCtxErrors")
156}
157
158// NewGitHubAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
159func NewGitHubAPIErrorResponse(ctx context.Context, message string, resp *github.Response, err error) *mcp.CallToolResult {

Callers 2

TestGitHubErrorContextFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGitHubErrorContextFunction · 0.68