|
5 | 5 | "fmt" |
6 | 6 | "net/http" |
7 | 7 |
|
8 | | - "github.com/github/github-mcp-server/pkg/utils" |
| 8 | + "github.com/github/github-mcp-server/pkg/mcpresult" |
9 | 9 | "github.com/google/go-github/v79/github" |
10 | 10 | "github.com/modelcontextprotocol/go-sdk/mcp" |
11 | 11 | ) |
@@ -153,31 +153,31 @@ func addRawAPIErrorToContext(ctx context.Context, err *GitHubRawAPIError) (conte |
153 | 153 | return nil, fmt.Errorf("context does not contain GitHubCtxErrors") |
154 | 154 | } |
155 | 155 |
|
156 | | -// NewGitHubAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware |
| 156 | +// NewGitHubAPIErrorResponse returns an mcp.CallToolResult and retains the error in the context for access via middleware |
157 | 157 | func NewGitHubAPIErrorResponse(ctx context.Context, message string, resp *github.Response, err error) *mcp.CallToolResult { |
158 | 158 | apiErr := newGitHubAPIError(message, resp, err) |
159 | 159 | if ctx != nil { |
160 | 160 | _, _ = addGitHubAPIErrorToContext(ctx, apiErr) // Explicitly ignore error for graceful handling |
161 | 161 | } |
162 | | - return utils.NewToolResultErrorFromErr(message, err) |
| 162 | + return mcpresult.NewErrorFromErr(message, err) |
163 | 163 | } |
164 | 164 |
|
165 | | -// NewGitHubGraphQLErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware |
| 165 | +// NewGitHubGraphQLErrorResponse returns an mcp.CallToolResult and retains the error in the context for access via middleware |
166 | 166 | func NewGitHubGraphQLErrorResponse(ctx context.Context, message string, err error) *mcp.CallToolResult { |
167 | 167 | graphQLErr := newGitHubGraphQLError(message, err) |
168 | 168 | if ctx != nil { |
169 | 169 | _, _ = addGitHubGraphQLErrorToContext(ctx, graphQLErr) // Explicitly ignore error for graceful handling |
170 | 170 | } |
171 | | - return utils.NewToolResultErrorFromErr(message, err) |
| 171 | + return mcpresult.NewErrorFromErr(message, err) |
172 | 172 | } |
173 | 173 |
|
174 | | -// NewGitHubRawAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware |
| 174 | +// NewGitHubRawAPIErrorResponse returns an mcp.CallToolResult and retains the error in the context for access via middleware |
175 | 175 | func NewGitHubRawAPIErrorResponse(ctx context.Context, message string, resp *http.Response, err error) *mcp.CallToolResult { |
176 | 176 | rawErr := newGitHubRawAPIError(message, resp, err) |
177 | 177 | if ctx != nil { |
178 | 178 | _, _ = addRawAPIErrorToContext(ctx, rawErr) // Explicitly ignore error for graceful handling |
179 | 179 | } |
180 | | - return utils.NewToolResultErrorFromErr(message, err) |
| 180 | + return mcpresult.NewErrorFromErr(message, err) |
181 | 181 | } |
182 | 182 |
|
183 | 183 | // NewGitHubAPIStatusErrorResponse handles cases where the API call succeeds (err == nil) |
|
0 commit comments