Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Part of #1428 - migrates the gists toolset from mark3labs/mcp-go to modelcontextprotocol/go-sdk.

Changes

  • Tool definitions: Converted from DSL to jsonschema.Schema format

    // Before
    mcp.NewTool("list_gists",
        mcp.WithString("username", mcp.Description("...")),
        mcp.WithString("since", mcp.Description("...")),
        WithPagination(),
    )
    
    // After
    tool := mcp.Tool{
        Name: "list_gists",
        InputSchema: WithPagination(&jsonschema.Schema{
            Type: "object",
            Properties: map[string]*jsonschema.Schema{
                "username": {Type: "string", Description: "..."},
                "since": {Type: "string", Description: "..."},
            },
        }),
    }
  • Handler signatures: Updated to use generics mcp.ToolHandlerFor[map[string]any, any] with 3-value returns (*mcp.CallToolResult, any, error)

  • Parameter extraction: Migrated from OptionalParam[T](request, "key") to OptionalParam[T](args, "key") using passed map

  • Result helpers: Replaced mcp.NewToolResultText/Error with utils.NewToolResultText/Error

  • Utilities: Added parseISOTimestamp to minimal_types.go (shared utility, extracted from pending-migration issues.go)

Tools Migrated

  • list_gists - List user's gists with pagination and filtering
  • get_gist - Retrieve specific gist content
  • create_gist - Create new gist
  • update_gist - Update existing gist

All tests passing, toolsnaps updated.

Original prompt

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

- Remove //go:build ignore tags from gists.go and gists_test.go
- Update imports to use modelcontextprotocol/go-sdk instead of mark3labs/mcp-go
- Migrate all 4 tools (ListGists, GetGist, CreateGist, UpdateGist):
  - Updated tool definitions to use jsonschema.Schema for InputSchema
  - Changed handler signatures to new SDK format with generics
  - Updated parameter extraction to use args map instead of request object
  - Replaced result helpers with utils package equivalents
- Updated all tests to match new handler signatures
- Added toolsnap tests for all 4 tools
- Added parseISOTimestamp utility function to minimal_types.go
- Created toolsnaps for all 4 tools

Related to #1428

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

Copilot finished reviewing on behalf of LuluBeatson November 18, 2025 16:59
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 gists toolset from mark3labs/mcp-go to modelcontextprotocol/go-sdk as part of the broader SDK migration effort (#1428). The migration updates tool definitions, handler signatures, and test infrastructure while maintaining backward compatibility.

Key Changes

  • Tool definitions converted from DSL-style builders to explicit jsonschema.Schema structures
  • Handler signatures updated to use generics (mcp.ToolHandlerFor[map[string]any, any]) with 3-value returns
  • Parameter extraction migrated from request-based to args-based helper functions
  • Result helpers replaced with utils package equivalents
  • Added shared parseISOTimestamp utility function to minimal_types.go
  • Fixed JSON Schema type casing in pagination helpers (Number→number, String→string)
  • Toolset registration for gists uncommented in tools.go

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pkg/github/gists.go Migrated all 4 gist tools (list, get, create, update) to new SDK with proper schema definitions and handler signatures
pkg/github/gists_test.go Updated tests to use new handler signature (3-value returns) and added toolsnap validation for each tool
pkg/github/minimal_types.go Added shared parseISOTimestamp utility function for ISO 8601 timestamp parsing
pkg/github/server.go Fixed JSON Schema type casing in pagination helper functions (lowercase 'number' and 'string')
pkg/github/tools.go Uncommented gists toolset registration to enable the migrated tools
pkg/github/toolsnaps/*.snap Added snapshots for all 4 gist tools to document API schema changes

return t, nil
}

return time.Time{}, fmt.Errorf("invalid timestamp format: %s", timestamp)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Error message in parseISOTimestamp could be more helpful. The current error message is generic:

return time.Time{}, fmt.Errorf("invalid timestamp format: %s", timestamp)

Consider using a more descriptive error message that includes the supported formats, similar to the version in issues.go (line 1623):

return time.Time{}, fmt.Errorf("invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD)", timestamp)

This provides better guidance to users when they provide an incorrectly formatted timestamp.

Suggested change
return time.Time{}, fmt.Errorf("invalid timestamp format: %s", timestamp)
return time.Time{}, fmt.Errorf("invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD)", timestamp)

Copilot uses AI. Check for mistakes.
@omgitsads omgitsads merged commit 6c07546 into omgitsads/go-sdk Nov 19, 2025
13 of 14 checks passed
@omgitsads omgitsads deleted the copilot/migrate-gists-toolset branch November 19, 2025 10:44
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