Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Migrates the repos toolset (18 tools) from mark3labs/mcp-go to modelcontextprotocol/go-sdk as part of the broader SDK migration tracked in #1428.

Changes

Tool Definitions

  • Converted from mcp.NewTool() DSL to mcp.Tool{} structs with jsonschema.Schema
  • Changed tool handler signatures from (mcp.Tool, server.ToolHandlerFunc) to (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Updated handler functions to accept (ctx, *request, args) and return (result, data, error)

Before:

func GetCommit(...) (mcp.Tool, server.ToolHandlerFunc) {
    return mcp.NewTool("get_commit",
        mcp.WithString("owner", mcp.Required(), ...),
        ...
    ),
    func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
        owner, _ := RequiredParam[string](request, "owner")
        ...
        return mcp.NewToolResultText(data), nil
    }
}

After:

func GetCommit(...) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
    tool := mcp.Tool{
        Name: "get_commit",
        InputSchema: &jsonschema.Schema{
            Properties: map[string]*jsonschema.Schema{
                "owner": {Type: "string", ...},
            },
            Required: []string{"owner", ...},
        },
    }
    handler := mcp.ToolHandlerFor[map[string]any, any](
        func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
            owner, _ := RequiredParam[string](args, "owner")
            ...
            return utils.NewToolResultText(data), nil, nil
        })
    return tool, handler
}

Parameter Extraction

  • Changed from RequiredParam[T](request, "key") to RequiredParam[T](args, "key")
  • Updated optional parameter helpers to extract from args map[string]any

Result Types

  • Replaced mcp.NewToolResultText/Error/Resource with utils.NewToolResultText/Error/Resource
  • Unified mcp.TextResourceContents and mcp.BlobResourceContents into mcp.ResourceContents
  • Changed Blob field from base64 string to []byte

Test Updates

  • Updated all handler invocations to new 3-parameter, 3-return signature
  • Added schema casting: schema := tool.InputSchema.(*jsonschema.Schema)
  • Fixed resource content assertions for unified type

Toolsnaps

Updated 16 snapshot files reflecting schema format changes (property ordering, required array format).

Tools Migrated

GetCommit, ListCommits, ListBranches, CreateOrUpdateFile, CreateRepository, GetFileContents, ForkRepository, DeleteFile, CreateBranch, PushFiles, ListTags, GetTag, ListReleases, GetLatestRelease, GetReleaseByTag, ListStarredRepositories, StarRepository, UnstarRepository

Original prompt

Migrate the repos toolset to modelcontextprotocol/go-sdk.

This will be merged into the parent PR #1428, so reference that PR in the description to track the migration

Custom agent used: go-sdk-tool-migrator
Agent specializing in migrating MCP tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk


💡 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.

Copilot AI and others added 4 commits November 20, 2025 10:20
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate repos toolset to modelcontextprotocol/go-sdk Migrate repos toolset to modelcontextprotocol/go-sdk Nov 20, 2025
Copilot finished work on behalf of omgitsads November 20, 2025 10:52
Copilot AI requested a review from omgitsads November 20, 2025 10:52
@LuluBeatson
Copy link
Contributor

Holding off on reviewing the Copilot PR because of:

We will probably close this migration PR, merge the consolidation PR, then redo the migration of this toolset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants