Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Migrates the dynamic toolset (enable_toolset, list_available_toolsets, get_toolset_tools) from mark3labs/mcp-go to modelcontextprotocol/go-sdk. Part of #1428.

Changes

Schema Migration

  • Converted DSL-based tool definitions to jsonschema.Schema structures
  • Changed ToolsetEnum() from returning mcp.PropertyOption to []any for enum values

Handler Updates

  • Return type: (tool, handler server.ToolHandlerFunc)(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Handler signature: func(ctx, request) (*mcp.CallToolResult, error)func(ctx, *request, args map[string]any) (*mcp.CallToolResult, any, error)
  • Parameter extraction now uses RequiredParam[T](args, key) instead of RequiredParam[T](request, key)

Tool Registration

Fixed EnableToolset to call RegisterFunc(s) on each ServerTool instead of non-existent s.AddTools():

// Old approach
s.AddTools(toolset.GetActiveTools()...)

// New approach  
for _, serverTool := range toolset.GetActiveTools() {
    serverTool.RegisterFunc(s)
}

Testing

  • Added dynamic_tools_test.go with comprehensive test coverage
  • Generated toolsnaps for schema validation
  • Removed //go:build ignore tag - tools now included in build
Original prompt

Migrate the dynamic 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.

This commit migrates the dynamic toolset (enable_toolset, list_available_toolsets,
get_toolset_tools) from mark3labs/mcp-go to modelcontextprotocol/go-sdk.

Changes:
- Removed //go:build ignore tag
- Updated imports to use modelcontextprotocol/go-sdk
- Migrated all tool functions to use new SDK patterns
- Updated ToolsetEnum helper to return []any instead of mcp.PropertyOption
- Converted DSL-based schema definitions to jsonschema.Schema structures
- Updated handler signatures to use map[string]any args
- Replaced old result helpers with utils package equivalents
- Fixed EnableToolset to use RegisterFunc instead of AddTools
- Created comprehensive test suite for all three tools
- Generated toolsnaps for the new tools

Related to #1428

Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate dynamic toolset to modelcontextprotocol/go-sdk Migrate dynamic toolset to modelcontextprotocol/go-sdk Nov 20, 2025
Copilot AI requested a review from omgitsads November 20, 2025 10:32
Copilot finished work on behalf of omgitsads November 20, 2025 10:32
@omgitsads omgitsads marked this pull request as ready for review November 20, 2025 15:30
@omgitsads omgitsads requested a review from a team as a code owner November 20, 2025 15:30
Copilot AI review requested due to automatic review settings November 20, 2025 15:30
@omgitsads
Copy link
Member

🚀

Screenshot 2025-11-20 at 16 30 19

Copilot finished reviewing on behalf of omgitsads November 20, 2025 15:32
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 dynamic toolset functionality (enable_toolset, list_available_toolsets, get_toolset_tools) from the mark3labs/mcp-go SDK to the modelcontextprotocol/go-sdk. The migration includes schema conversion from DSL to JSON Schema, handler signature updates, and fixing tool registration logic.

Key changes:

  • Schema definitions converted from DSL-based mcp.NewTool() calls to explicit jsonschema.Schema structures
  • Handler signatures updated to use new SDK's ToolHandlerFor[map[string]any, any] pattern
  • Tool registration fixed to use RegisterFunc() method instead of non-existent AddTools()

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/github/dynamic_tools.go Migrated three tools to new SDK with updated schemas, handlers, and tool registration logic
pkg/github/dynamic_tools_test.go Added comprehensive test coverage for all three dynamic tools with schema validation
pkg/github/__toolsnaps__/enable_toolset.snap Added schema snapshot for enable_toolset tool
pkg/github/__toolsnaps__/get_toolset_tools.snap Added schema snapshot for get_toolset_tools tool
pkg/github/__toolsnaps__/list_available_toolsets.snap Added schema snapshot for list_available_toolsets tool

@omgitsads omgitsads merged commit 42b5533 into omgitsads/go-sdk Nov 20, 2025
13 of 14 checks passed
@omgitsads omgitsads deleted the copilot/migrate-dynamic-toolset branch November 20, 2025 16:47
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