Skip to content

Migrate gists toolset to modelcontextprotocol/go-sdk - #1431

Merged
omgitsads merged 9 commits into
omgitsads/go-sdkfrom
copilot/migrate-gists-toolset
Nov 19, 2025
Merged

Migrate gists toolset to modelcontextprotocol/go-sdk#1431
omgitsads merged 9 commits into
omgitsads/go-sdkfrom
copilot/migrate-gists-toolset

Conversation

CopilotAI commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

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

    // Beforemcp.NewTool("list_gists",
    mcp.WithString("username", mcp.Description("...")),
    mcp.WithString("since", mcp.Description("...")),
    WithPagination(),
    )
    // Aftertool:= 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>
CopilotAI changed the title [WIP] Migrate gists toolset to modelcontextprotocol/go-sdkMigrate gists toolset to modelcontextprotocol/go-sdkNov 18, 2025
CopilotAI requested a review from omgitsadsNovember 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 ownerNovember 18, 2025 16:55
CopilotAI review requested due to automatic review settings November 18, 2025 16:55
@LuluBeatson

Copy link
Copy Markdown
Contributor

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
pkg/github/gists.goMigrated all 4 gist tools (list, get, create, update) to new SDK with proper schema definitions and handler signatures
pkg/github/gists_test.goUpdated tests to use new handler signature (3-value returns) and added toolsnap validation for each tool
pkg/github/minimal_types.goAdded shared parseISOTimestamp utility function for ISO 8601 timestamp parsing
pkg/github/server.goFixed JSON Schema type casing in pagination helper functions (lowercase 'number' and 'string')
pkg/github/tools.goUncommented gists toolset registration to enable the migrated tools
pkg/github/toolsnaps/*.snapAdded snapshots for all 4 gist tools to document API schema changes

Comment threadpkg/github/gists.go Outdated
Comment threadpkg/github/__toolsnaps__/create_gist.snap
Comment threadpkg/github/__toolsnaps__/update_gist.snap
return t, nil
}

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

CopilotAINov 18, 2025

Copy link

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.
Comment threadpkg/github/gists.go
Comment threadpkg/github/gists.go
Comment threadpkg/github/gists.go
Comment threadpkg/github/gists.go
@omgitsads
omgitsads merged commit 6c07546 into omgitsads/go-sdkNov 19, 2025
13 of 14 checks passed
@omgitsads
omgitsads deleted the copilot/migrate-gists-toolset branch November 19, 2025 10:44
Sign up for freeto 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

@LuluBeatson@omgitsads