Migrate Dependabot toolset to modelcontextprotocol/go-sdk #4
+488
−38
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 #<issue_number>
Migrates the Dependabot toolset from
mark3labs/mcp-gotomodelcontextprotocol/go-sdk, enabling two tools:get_dependabot_alert- Retrieves a specific Dependabot alert by numberlist_dependabot_alerts- Lists Dependabot alerts with optional state/severity filtersKey Changes
Function signatures:
Handler implementation:
func(ctx, request) (*result, error)tofunc(ctx, *request, args) (*result, any, error)args map[string]anyinstead ofmcp.CallToolRequestmcp.NewToolResult*toutils.NewToolResult*Schema definitions:
mcp.WithString(...)) to JSON Schema structures (jsonschema.Schema)json.RawMessagefor proper serializationToolsnaps:
Original prompt
Migrate the Dependabot toolset to the Go SDK.
Migration Process
You should focus on ONLY the toolset I have requested and it's corresponding test file. If, for example, you are asked to migrate the
dependabottoolset, you will be migrating the files located at.tools-to-be-migrated/dependabot.goand.tools-to-be-migrated/dependabot_test.go. The migrated version should be placed in thegithubpackage directory,pkg/github(e.g.pkg/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: