Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Closes: Part of #1428

Migrates GetLabel, ListLabels, and LabelWrite tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk.

Changes

  • Tool definitions: Converted from DSL-based mcp.NewTool() to struct-based mcp.Tool{} with explicit jsonschema.Schema definitions
  • Handler signatures: Updated from func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) to generic handlers func(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error)
  • Parameter extraction: Changed from RequiredParam[T](request, "param") to RequiredParam[T](args, "param") using passed args map
  • Result constructors: Replaced mcp.NewToolResult* with utils.NewToolResult* helpers
  • Toolsnaps: Updated to reflect property ordering changes (semantics unchanged)

Example

Before:

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

After:

func GetLabel(...) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
    tool := mcp.Tool{
        Name: "get_label",
        InputSchema: &jsonschema.Schema{
            Properties: map[string]*jsonschema.Schema{
                "owner": {Type: "string", Description: "..."},
                ...
            },
            Required: []string{"owner", "repo", "name"},
        },
    }
    handler := mcp.ToolHandlerFor[map[string]any, any](
        func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
            owner, err := RequiredParam[string](args, "owner")
            ...
            return utils.NewToolResultText(string(out)), nil, nil
        })
    return tool, handler
}
Original prompt

Migrate the labels 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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…go-sdk

Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate labels toolset to modelcontextprotocol/go-sdk Migrate labels toolset to modelcontextprotocol/go-sdk Nov 18, 2025
Copilot finished work on behalf of omgitsads November 18, 2025 11:32
Copilot AI requested a review from omgitsads November 18, 2025 11:32
@LuluBeatson LuluBeatson self-requested a review November 19, 2025 11:57
@LuluBeatson
Copy link
Contributor

image image image

@LuluBeatson LuluBeatson marked this pull request as ready for review November 19, 2025 13:06
@LuluBeatson LuluBeatson requested a review from a team as a code owner November 19, 2025 13:06
Copilot AI review requested due to automatic review settings November 19, 2025 13:06
Copilot finished reviewing on behalf of LuluBeatson November 19, 2025 13:09
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 labels toolset (GetLabel, ListLabels, LabelWrite) from the legacy mark3labs/mcp-go SDK to the new modelcontextprotocol/go-sdk, continuing the migration effort tracked in #1428.

Key changes:

  • Converted tool definitions from DSL-based to struct-based with explicit JSON schemas
  • Updated handler signatures to use generic mcp.ToolHandlerFor[map[string]any, any] type
  • Modified parameter extraction to use passed args map instead of request object
  • Updated result constructors to use utils.NewToolResult* helpers

Reviewed Changes

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

Show a summary per file
File Description
pkg/github/labels.go Migrated GetLabel, ListLabels, and LabelWrite tool definitions and handlers to new SDK patterns with struct-based schemas and generic handler types
pkg/github/labels_test.go Removed //go:build ignore directive, updated test assertions to check ReadOnlyHint annotations directly, and adapted handler invocations to new 3-return signature
pkg/github/tools.go Uncommented and re-enabled labels toolset registration in the default toolset group
pkg/github/toolsnaps/get_label.snap Reordered JSON properties and moved type before required in schema (no semantic changes)
pkg/github/toolsnaps/list_label.snap Reordered JSON properties and moved type before required in schema (no semantic changes)
pkg/github/toolsnaps/label_write.snap Reordered JSON properties, moved type before required, and removed explicit readOnlyHint: false (omitted false values per new SDK conventions)

@omgitsads omgitsads merged commit 9bf905b into omgitsads/go-sdk Nov 19, 2025
19 of 20 checks passed
@omgitsads omgitsads deleted the copilot/migrate-labels-toolset branch November 19, 2025 16:33
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