Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Closes: Part of #1428

Description

Migrates the discussions toolset from mark3labs/mcp-go to modelcontextprotocol/go-sdk.

Changes

Tool Function Signatures

  • Return type: (mcp.Tool, server.ToolHandlerFunc)(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Handler signature: func(ctx, request) (*result, error)func(ctx, *request, args) (*result, any, error)

Schema Definitions

  • Converted from DSL to explicit JSON Schema structures:
// Before
mcp.NewTool("list_discussions",
    mcp.WithString("owner", mcp.Required(), mcp.Description("...")),
    mcp.WithString("repo", mcp.Description("...")),
)

// After  
mcp.Tool{
    Name: "list_discussions",
    InputSchema: &jsonschema.Schema{
        Type: "object",
        Properties: map[string]*jsonschema.Schema{
            "owner": {Type: "string", Description: "..."},
            "repo": {Type: "string", Description: "..."},
        },
        Required: []string{"owner"},
    },
}

Parameter Extraction

  • Changed from request.Params.Arguments to direct args map[string]any parameter
  • Result helpers moved to utils package: utils.NewToolResultError(), utils.NewToolResultText()

Test Updates

  • Handler calls: handler(ctx, req)handler(ctx, &req, reqParams)
  • Capture 3 return values: res, _, err := handler(...)
  • Added toolsnaps.Test() calls for schema validation
  • Cast InputSchema to *jsonschema.Schema for property access

Migrated Tools

  • list_discussions
  • get_discussion
  • get_discussion_comments
  • list_discussion_categories

All 4 toolsnap files created and validated.

Original prompt

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@notjoannaakl
Copy link

test

Copilot AI changed the title [WIP] Migrate discussions toolset to modelcontextprotocol/go-sdk Migrate discussions toolset to modelcontextprotocol/go-sdk Nov 20, 2025
Copilot AI requested a review from omgitsads November 20, 2025 10:30
Copilot finished work on behalf of omgitsads November 20, 2025 10:30
@LuluBeatson LuluBeatson self-requested a review November 20, 2025 15:52
@LuluBeatson
Copy link
Contributor

image image

@LuluBeatson LuluBeatson marked this pull request as ready for review November 20, 2025 16:44
@LuluBeatson LuluBeatson requested a review from a team as a code owner November 20, 2025 16:44
Copilot AI review requested due to automatic review settings November 20, 2025 16:44
Copilot finished reviewing on behalf of LuluBeatson November 20, 2025 16:46
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 successfully migrates the discussions toolset from mark3labs/mcp-go to modelcontextprotocol/go-sdk, as part of the broader SDK migration effort tracked in #1428.

Key Changes:

  • Updated function signatures to return mcp.ToolHandlerFor[map[string]any, any] instead of server.ToolHandlerFunc
  • Converted tool definitions from DSL-based to explicit JSON Schema structures
  • Modified parameter extraction to use args map[string]any directly instead of request.Params.Arguments
  • Updated all error handling and result helpers to use the utils package

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
pkg/github/discussions.go Migrated 4 discussion tools (list_discussions, get_discussion, get_discussion_comments, list_discussion_categories) to new SDK with updated signatures and schema definitions
pkg/github/discussions_test.go Updated tests to match new handler signatures, added toolsnap validation, and updated schema assertions to use *jsonschema.Schema type casting
pkg/github/tools.go Uncommented and re-enabled the discussions toolset registration in the default toolset group
pkg/github/__toolsnaps__/*.snap Added 4 new toolsnap files documenting the JSON schemas for all discussion tools

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.

4 participants