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

Function NewGitHubGraphQLErrorResponse

pkg/errors/error.go:197–203  ·  view source on GitHub ↗

NewGitHubGraphQLErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware

(ctx context.Context, message string, err error)

Source from the content-addressed store, hash-verified

195
196// NewGitHubGraphQLErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
197func NewGitHubGraphQLErrorResponse(ctx context.Context, message string, err error) *mcp.CallToolResult {
198 graphQLErr := newGitHubGraphQLError(message, err)
199 if ctx != nil {
200 _, _ = addGitHubGraphQLErrorToContext(ctx, graphQLErr) // Explicitly ignore error for graceful handling
201 }
202 return utils.NewToolResultErrorFromErr(message, err)
203}
204
205// NewGitHubRawAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
206func NewGitHubRawAPIErrorResponse(ctx context.Context, message string, resp *http.Response, err error) *mcp.CallToolResult {

Callers 1

TestGitHubErrorContextFunction · 0.85

Calls 3

newGitHubGraphQLErrorFunction · 0.85

Tested by 1

TestGitHubErrorContextFunction · 0.68