Migrate dependabot toolset to modelcontextprotocol/go-sdk#1429
Migrate dependabot toolset to modelcontextprotocol/go-sdk#1429omgitsads merged 5 commits intoomgitsads/go-sdkfrom
Conversation
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
…igrate-dependabot-toolset
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the dependabot toolset from mark3labs/mcp-go to modelcontextprotocol/go-sdk, completing the migration of another toolset to the new SDK. The migration updates function signatures, schema definitions, and error handling patterns to align with the new SDK's API.
- Migrated two dependabot tools (
get_dependabot_alertandlist_dependabot_alerts) to use the new SDK - Updated schema definitions from DSL-based to struct-based initialization with
jsonschema.Schema - Modified handler signatures to return three values
(*mcp.CallToolResult, any, error)instead of two - Re-enabled the dependabot toolset in the default toolset group
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/dependabot.go | Migrated tool implementations to new SDK with updated function signatures, schema definitions, and result helpers |
| pkg/github/dependabot_test.go | Updated tests to match new handler signatures and removed direct schema assertions in favor of toolsnap validation |
| pkg/github/tools.go | Uncommented dependabot toolset registration to re-enable it in the default toolset group |
| pkg/github/toolsnaps/get_dependabot_alert.snap | Cosmetic reordering of JSON fields (no functional changes) |
| pkg/github/toolsnaps/list_dependabot_alerts.snap | Cosmetic reordering of JSON fields (no functional changes) |
| body, err := io.ReadAll(resp.Body) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to marshal alert: %w", err) | ||
| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 77) is:
return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil |
| return mcp.NewToolResultText(string(r)), nil | ||
| r, err := json.Marshal(alert) | ||
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to marshal alert", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 84) is:
return utils.NewToolResultErrorFromErr("failed to marshal alert", err), nil, nil| return utils.NewToolResultErrorFromErr("failed to marshal alert", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to marshal alert", err), nil, nil |
| } | ||
| client, err := getClient(ctx) | ||
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 161) is:
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil |
| body, err := io.ReadAll(resp.Body) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to marshal alerts: %w", err) | ||
| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 176) is:
return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil |
| return mcp.NewToolResultText(string(r)), nil | ||
| r, err := json.Marshal(alerts) | ||
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to marshal alerts", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 183) is:
return utils.NewToolResultErrorFromErr("failed to marshal alerts", err), nil, nil| return utils.NewToolResultErrorFromErr("failed to marshal alerts", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to marshal alerts", err), nil, nil |
| } | ||
| client, err := getClient(ctx) | ||
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err |
There was a problem hiding this comment.
Inconsistent error handling pattern. When returning an error result using utils.NewToolResultErrorFromErr, the third return value should be nil, not err. The error is already embedded in the result.
The correct pattern (consistent with code_scanning.go line 61, 77, 84) is:
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nilNot:
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err | |
| return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil |
4c3d834 to
183d17a
Compare

Closes:
Migrates the
dependabottoolset frommark3labs/mcp-gotomodelcontextprotocol/go-sdk.Changes
Function signatures
(mcp.Tool, server.ToolHandlerFunc)→(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])func(ctx, request)→func(ctx, *request, args map[string]any)with 3 return valuesSchema definitions
mcp.NewTool()) to struct initialization (mcp.Tool{})InputSchemausingjsonschema.Schemawith explicit propertiesjson.RawMessage(e.g.,Default: json.RawMessage(\"open"`)`)Result helpers
mcp.NewToolResult*()→utils.NewToolResult*()Tests
args map[string]anyBefore/After
Before (mark3labs/mcp-go):
After (modelcontextprotocol/go-sdk):
Toolsnaps updated with cosmetic field reordering only—schemas remain functionally identical.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.