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

This comment was marked as outdated.

@LuluBeatson LuluBeatson self-requested a review November 24, 2025 10:48
@LuluBeatson LuluBeatson marked this pull request as ready for review November 24, 2025 11:40
@LuluBeatson LuluBeatson requested a review from a team as a code owner November 24, 2025 11:40
Copilot AI review requested due to automatic review settings November 24, 2025 11:40
Copilot finished reviewing on behalf of LuluBeatson November 24, 2025 11:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the repos toolset (18 tools) from mark3labs/mcp-go to modelcontextprotocol/go-sdk as part of the broader SDK migration effort tracked in #1428. The migration updates tool definitions, handler signatures, parameter extraction, and result types to align with the new SDK's API.

Key changes:

  • Tool definitions converted from DSL-based mcp.NewTool() to struct-based mcp.Tool{} with jsonschema.Schema
  • Handler signatures changed from 2-parameter/2-return to 3-parameter/3-return pattern
  • Result helpers migrated from mcp.NewToolResult* to utils.NewToolResult*

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/github/tools.go Uncommented repos and stargazers toolset registration to enable migrated tools
pkg/github/repositories.go Migrated 18 repository tools to new SDK (GetCommit, ListCommits, CreateRepository, etc.)
pkg/github/repositories_test.go Updated all tests to new handler signatures and schema casting patterns
pkg/github/helper_test.go Consolidated resource result helpers into unified getResourceResult function
pkg/github/toolsnaps/*.snap Updated 16 snapshots reflecting new schema format (property ordering, required array format)

@LuluBeatson
Copy link
Contributor

Screenshots Screenshot 2025-11-24 at 11 52 55 image Screenshot 2025-11-24 at 11 53 55 image image image image image image image

@omgitsads omgitsads merged commit 001e0a1 into omgitsads/go-sdk Nov 24, 2025
13 of 14 checks passed
@omgitsads omgitsads deleted the copilot/migrate-repos-toolset-to-go-sdk branch November 24, 2025 14:28
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