Skip to content

Conversation

Copy link

Copilot AI commented Nov 17, 2025

Closes: Part of SDK migration effort

Migrates GetDependabotAlert and ListDependabotAlerts tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk.

Changes

Tool Implementation (pkg/github/dependabot.go)

  • Function signatures: (mcp.Tool, server.ToolHandlerFunc)(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Handler signature: func(ctx, request)func(ctx, *request, args map[string]any)
  • Schema: DSL-based → JSON Schema with jsonschema.Schema structs
  • Result helpers: mcp.NewToolResult*()utils.NewToolResult*()
  • Enum/default types: []string[]any, stringjson.RawMessage

Test Updates (pkg/github/dependabot_test.go)

  • Handler invocation: Pass args directly instead of wrapping in mcp.CallToolRequest
  • Schema access: Cast tool.InputSchema.(any) to *jsonschema.Schema

Registration (pkg/github/tools.go)

  • Uncommented dependabot toolset and added to DefaultToolsetGroup

Schema Example

Before:

mcp.NewTool("list_dependabot_alerts",
    mcp.WithString("state",
        mcp.DefaultString("open"),
        mcp.Enum("open", "fixed", "dismissed", "auto_dismissed"),
    ),
)

After:

mcp.Tool{
    InputSchema: &jsonschema.Schema{
        Properties: map[string]*jsonschema.Schema{
            "state": {
                Type:    "string",
                Enum:    []any{"open", "fixed", "dismissed", "auto_dismissed"},
                Default: json.RawMessage(`"open"`),
            },
        },
    },
}

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
    • Triggering command: /update-job-proxy (dns block)
  • go.yaml.in
    • Triggering command: /update-job-proxy (dns block)
  • gopkg.in
    • Triggering command: /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-go to modelcontextprotocol/go-sdk

Migration Process

You should focus on ONLY the dependabot toolset and it's corresponding test file. You will be migrating the files located at pkg/github/dependabot.go and pkg/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:

  • The initial tool file and it's corresponding test file will be fully commented out, as the tests will fail if the code is uncommented. The code should be uncommented before work begins.
  • The import for github.com/mark3labs/mcp-go/mcp should be changed to github.com/modelcontextprotocol/go-sdk/mcp
  • The return type for the tool constructor function should be updated from mcp.Tool, server.ToolHandlerFunc to (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]).
  • The tool handler function signature should be updated to use generics, changing from func(ctx context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) to func(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error).
  • The RequiredParam, RequiredInt, RequiredBigInt, OptionalParamOK, OptionalParam, OptionalIntParam, OptionalIntParamWithDefault, OptionalBoolParamWithDefault, OptionalStringArrayParam, OptionalBigIntArrayParam and OptionalCursorPaginationParams functions 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 the mcp.CallToolRequest.
  • mcp.NewToolResultText, mcp.NewToolResultError, mcp.NewToolResultErrorFromErr and mcp.NewToolResultResource no longer available in modelcontextprotocol/go-sdk. There are a few helper functions available in pkg/utils/result.go that can be used to replace these, in the utils package.

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. In modelcontextprotocol/go-sdk, schemas are defined using jsonschema.Schema structures using github.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:

...
return mcp.NewTool(
		"list_dependabot_alerts",
		mcp.WithDescription(t("TOOL_LIST_DEPENDABOT_ALERTS_DESCRIPTION", "List dependabot alerts in a GitHub repository.")),
		mcp.WithToolAnnotation(mcp.ToolAnnotation{
			Title:        t("TOOL_LIST_DEPENDABOT_ALERTS_USER_TITLE", "List dependabot alerts"),
			ReadOnlyHint: ToBoolPtr(true),
		}),
		mcp.WithString("owner",
			mcp.Required(),
			mcp.Description("The owner of the repository."),
		),
		mcp.WithString("repo",
			mcp.Required(),
			mcp.Description("The name of the repository."),
		),
		mcp.WithString("state",
			mcp.Description("Filter dependabot alerts by state. Defaults to open"),
			mcp.DefaultString("open"),
			mcp.Enum("open", "fixed", "dismissed", "auto_dismissed"),
		),
		mcp.WithString("severity",
			mcp.Description("Filter dependabot alerts by severity"),
			mcp.Enum("low", "medium", "high", "critical"),
		),
	),
...

The corresponding input schema in modelcontextprotocol/go-sdk would look like this:

...
return mcp.Tool{
  Name: "list_dependabot_alerts",
  Description: t("TOOL_LIST_DEPENDABOT_ALERTS_DESCRIPTION", "List dependabot alerts in a GitHub repository."),
  Annotations: &mcp.ToolAnnotations{
    Title: t("TOOL_LIST_DEPENDABOT_ALERTS_USER_TITLE", "List dependabot alerts"),
    ReadOnlyHint: true,
  },
  InputSchema: &jsonschema.Schema{
    Type: "object",
    Properties: map[string]*jsonschema.Schema{
      "owner": {
        Type: "string",
        Description: "The owner of the repository.",
      },
      "repo": {
        Type: "string",
        Description: "The name of the repository.",
      },
      "state": {
        Type: "string",
        Description: "Filter dependabot alerts by state. Defaults to open",
        Enum: []string{"open", "fixed", "dismissed", "auto_dismissed"},
        Default: "open",
      },
      "severity": {
        Type: "string",
        Description: "Filter dependabot alerts by severity",
        Enum: []string{"low", "medium", "high", "critical"},
      },
    },
    Required: []string{"owner", "repo"},
  },
}

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.

Copilot AI changed the title [WIP] Migrate dependabot toolset to modelcontextprotocol/gosdk Migrate Dependabot toolset to modelcontextprotocol/go-sdk Nov 17, 2025
Copilot AI requested a review from omgitsads November 17, 2025 17:26
Copilot finished work on behalf of omgitsads November 17, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants