Migrate Dependabot toolset to modelcontextprotocol/go-sdk #3
+449
−423
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: Part of SDK migration effort
Migrates
GetDependabotAlertandListDependabotAlertstools frommark3labs/mcp-gotomodelcontextprotocol/go-sdk.Changes
Tool Implementation (
pkg/github/dependabot.go)(mcp.Tool, server.ToolHandlerFunc)→(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])func(ctx, request)→func(ctx, *request, args map[string]any)jsonschema.Schemastructsmcp.NewToolResult*()→utils.NewToolResult*()[]string→[]any,string→json.RawMessageTest Updates (
pkg/github/dependabot_test.go)mcp.CallToolRequesttool.InputSchema.(any)to*jsonschema.SchemaRegistration (
pkg/github/tools.go)DefaultToolsetGroupSchema Example
Before:
After:
All tests pass. Tool snapshots unchanged (schema equivalence maintained).
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
go.googlesource.com/update-job-proxy(dns block)go.yaml.in/update-job-proxy(dns block)gopkg.in/update-job-proxy(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Migrate the Depenabot toolset from
mark3labs/mcp-gotomodelcontextprotocol/go-sdkMigration Process
You should focus on ONLY the
dependabottoolset and it's corresponding test file. You will be migrating the files located atpkg/github/dependabot.goandpkg/github/dependabot_test.go. If there are additional tests or helper functions that fail to work with the new SDK, you should inform me of these issues so that I can address them, or instruct you on how to proceed.When generating the migration guide, consider the following aspects:
github.com/mark3labs/mcp-go/mcpshould be changed togithub.com/modelcontextprotocol/go-sdk/mcpmcp.Tool, server.ToolHandlerFuncto(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]).func(ctx context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)tofunc(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error).RequiredParam,RequiredInt,RequiredBigInt,OptionalParamOK,OptionalParam,OptionalIntParam,OptionalIntParamWithDefault,OptionalBoolParamWithDefault,OptionalStringArrayParam,OptionalBigIntArrayParamandOptionalCursorPaginationParamsfunctions should be changed to use the tool arguments that are now passed as a map in the tool handler function, rather than extracting them from themcp.CallToolRequest.mcp.NewToolResultText,mcp.NewToolResultError,mcp.NewToolResultErrorFromErrandmcp.NewToolResultResourceno longer available inmodelcontextprotocol/go-sdk. There are a few helper functions available inpkg/utils/result.gothat can be used to replace these, in theutilspackage.Schema Changes
The biggest change when migrating MCP tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk is the way input and output schemas are defined and handled. In
mark3labs/mcp-go, input and output schemas were often defined using a DSL provided by the library. Inmodelcontextprotocol/go-sdk, schemas are defined usingjsonschema.Schemastructures usinggithub.com/google/jsonschema-go, which are more verbose.When migrating a tool, you will need to convert the existing schema definitions to JSON Schema format. This involves defining the properties, types, and any validation rules using the JSON Schema specification.
Example Schema Guide
If we take an example of a tool that has the following input schema in mark3labs/mcp-go:
The corresponding input schema in modelcontextprotocol/go-sdk would look like this:
Running tests
After migrating the tool code and test file, ensure that all tests pass successfully. If any tests ...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.