Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate issues toolset to modelcontextprotocol/go-sdk#1440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
omgitsads merged 13 commits intoomgitsads/go-sdkfromcopilot/migrate-issues-toolset
Nov 20, 2025

Conversation

Copy link
Contributor

CopilotAI commentedNov 18, 2025
edited
Loading

Closes: Part of#1428

Migrates theissues toolset frommark3labs/mcp-go tomodelcontextprotocol/go-sdk.

Changes

Tools migrated (8):

  • IssueRead - Read issue details, comments, sub-issues, or labels
  • ListIssueTypes - List available issue types for an organization
  • AddIssueComment - Add comments to issues
  • SubIssueWrite - Add, remove, or reprioritize sub-issues
  • SearchIssues - Search issues with GitHub search syntax
  • IssueWrite - Create or update issues
  • ListIssues - List and filter repository issues
  • AssignCopilotToIssue - Assign Copilot to issues

Prompts migrated (1):

  • AssignCodingAgentPrompt - Multi-issue Copilot assignment workflow

Key schema changes:

  • Tool definitions: Builder pattern (mcp.NewTool()) → struct format withjsonschema.Schema
  • Handler signatures:(ctx, request) (*CallToolResult, error)(ctx, *request, args) (*CallToolResult, any, error)
  • Parameter extraction: Fromrequest object →args map[string]any
  • Result constructors:mcp.NewToolResult*()utils.NewToolResult*()
  • Prompt handler: Generic type parameter removed,Arguments nowmap[string]string

Before/After:

// Before (mark3labs/mcp-go)funcListIssueTypes(...) (mcp.Tool, server.ToolHandlerFunc) {returnmcp.NewTool("list_issue_types",mcp.WithString("owner",mcp.Required(),...),    ),func(ctx context.Context,request mcp.CallToolRequest) (*mcp.CallToolResult,error) {owner,err:=RequiredParam[string](request,"owner")returnmcp.NewToolResultText(result),nil    }}// After (modelcontextprotocol/go-sdk)funcListIssueTypes(...) (mcp.Tool, mcp.ToolHandlerFor[map[string]any,any]) {return mcp.Tool{Name:"list_issue_types",InputSchema:&jsonschema.Schema{Properties:map[string]*jsonschema.Schema{"owner": {Type:"string",...},            },Required: []string{"owner"},        },    },func(ctx context.Context,_*mcp.CallToolRequest,argsmap[string]any) (*mcp.CallToolResult,any,error) {owner,err:=RequiredParam[string](args,"owner")returnutils.NewToolResultText(result),nil,nil    }}

Files modified:

  • pkg/github/issues.go - Tool implementations
  • pkg/github/issues_test.go - Test assertions updated for new signatures
  • pkg/github/search_utils.go - Search helper migrated
  • pkg/github/__toolsnaps__/*.snap - Schema snapshots regenerated
Original prompt

Migrate theissues toolset tomodelcontextprotocol/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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

CopilotAIand others added7 commitsNovember 18, 2025 13:55
…functions)Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
…ngAgentPromptCo-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
CopilotAI changed the title[WIP] Migrate issues toolset to modelcontextprotocol/go-sdkMigrate issues toolset to modelcontextprotocol/go-sdkNov 18, 2025
CopilotAI requested a review fromomgitsadsNovember 18, 2025 14:40
Copilot finished work on behalf ofomgitsadsNovember 18, 2025 14:40
@omgitsadsomgitsads marked this pull request as ready for reviewNovember 19, 2025 16:47
@omgitsadsomgitsads requested a review froma team as acode ownerNovember 19, 2025 16:47
CopilotAI review requested due to automatic review settingsNovember 19, 2025 16:47
Copilot finished reviewing on behalf ofomgitsadsNovember 19, 2025 16:51
Copy link
Contributor

CopilotAI 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 theissues toolset frommark3labs/mcp-go tomodelcontextprotocol/go-sdk, completing part of the broader migration effort (#1428).

Key changes:

  • Updated 8 tools with new schema definitions and handler signatures (3-value returns)
  • Migrated 1 prompt (AssignCodingAgentPrompt) to new struct format
  • Changed handler parameter extraction fromrequest object toargs map[string]any
  • Updated all error handling to useutils.NewToolResult*() constructors
  • Regenerated tool snapshots reflecting schema structure changes

Reviewed Changes

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

Show a summary per file
FileDescription
pkg/github/issues.goMigrated 8 issue tools to new SDK with schema structs and 3-value handler returns
pkg/github/issues_test.goUpdated test assertions to castInputSchema to*jsonschema.Schema and added third nil return value to handler calls
pkg/github/search_utils.goMigrated search helper function to acceptargs map[string]any instead of request object
pkg/github/workflow_prompts.goConverted 2 prompts from builder pattern to struct format with new message content wrapping
pkg/github/tools.goRe-enabled issues toolset registration (uncommented lines)
pkg/github/minimal_types.goMovedparseISOTimestamp function to issues.go (only used there)
pkg/github/toolsnaps/*.snapRegenerated snapshots with new JSON schema structure (type/required/properties ordering)

err:=client.Query(ctx,&query,variables)
iferr!=nil {
returnnil,err
returnnil,nil,err

Choose a reason for hiding this comment

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

Incorrect error handling in GraphQL query. Whenclient.Query() fails, the function returnsnil, nil, err which will return a Go error to the handler caller. This is inconsistent with the SDK pattern where API errors should be returned as tool result errors.

This should be:

iferr:=client.Query(ctx,&query,variables);err!=nil {returnutils.NewToolResultErrorFromErr("failed to query suggested actors",err),nil,nil}

This error is within the pagination loop, so the error context should clarify which page failed if relevant.

Suggested change
returnnil,nil,err
pageInfo:=""
ifvariables["endCursor"]!=nil {
pageInfo=fmt.Sprintf(" (endCursor: %v)",variables["endCursor"])
}
return utils.NewToolResultErrorFromErr(
fmt.Sprintf("failed to query suggested actors%s",pageInfo),
err,
),nil,nil

Copilot uses AI. Check for mistakes.
nil,
);err!=nil {
returnnil,fmt.Errorf("failed to replace actors for assignable: %w",err)
returnnil,nil,fmt.Errorf("failed to replace actors for assignable: %w",err)

Choose a reason for hiding this comment

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

Incorrect error handling in GraphQL mutation. Whenclient.Mutate() fails, the function returnsnil, nil, err which will return a Go error to the handler caller. This is inconsistent with the SDK pattern where API errors should be returned as tool result errors.

This should be:

iferr:= client.Mutate(...);err!=nil {returnutils.NewToolResultErrorFromErr("failed to assign copilot to issue",err),nil,nil}
Suggested change
returnnil,nil,fmt.Errorf("failed toreplace actors for assignable: %w",err)
returnutils.NewToolResultErrorFromErr("failed toassign copilot to issue",err),nil,nil

Copilot uses AI. Check for mistakes.
client,err:=getGQLClient(ctx)
iferr!=nil {
returnnil,fmt.Errorf("failed to get GitHub client: %w",err)
returnnil,nil,fmt.Errorf("failed to get GitHub client: %w",err)

Choose a reason for hiding this comment

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

Incorrect error handling when getting GitHub client. The function returnsnil, nil, fmt.Errorf(...) which will return a Go error to the handler caller. This is inconsistent with the SDK migration pattern where all errors should be returned as tool result errors.

This should be:

iferr!=nil {returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,nil}

This same pattern appears at line 1571 and should be fixed there as well.

Suggested change
returnnil,nil,fmt.Errorf("failed to get GitHub client: %w",err)
returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,nil

Copilot uses AI. Check for mistakes.
paginationParams,err:=pagination.ToGraphQLParams()
iferr!=nil {
returnnil,err
returnnil,nil,err

Choose a reason for hiding this comment

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

Incorrect error handling in pagination parameter conversion. WhenToGraphQLParams() fails, the function returnsnil, nil, err which will return a Go error to the handler caller. This is inconsistent with the SDK pattern where validation/client errors should be returned as tool result errors.

This should be:

iferr!=nil {returnutils.NewToolResultErrorFromErr("failed to convert pagination parameters",err),nil,nil}

The same pattern is used correctly throughout the rest of the function for other client errors.

Suggested change
returnnil,nil,err
returnutils.NewToolResultErrorFromErr("failed to convert pagination parameters",err),nil,nil

Copilot uses AI. Check for mistakes.
out,err:=json.Marshal(response)
iferr!=nil {
returnnil,fmt.Errorf("failed to marshal issues: %w",err)
returnnil,nil,fmt.Errorf("failed to marshal issues: %w",err)

Choose a reason for hiding this comment

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

Incorrect error handling in query execution. Whenclient.Query() fails, the function returnsnil, nil, err which will return a Go error to the handler caller. This is inconsistent with the SDK pattern where API errors should be returned as tool result errors.

This should be:

iferr:=client.Query(ctx,issueQuery,vars);err!=nil {returnutils.NewToolResultErrorFromErr("failed to list issues",err),nil,nil}

Compare with line 1450 where query errors are correctly wrapped as tool result errors usingutils.NewToolResultError(err.Error()).

Suggested change
returnnil,nil,fmt.Errorf("failed to marshal issues: %w",err)
returnutils.NewToolResultErrorFromErr("failed to marshal issues",err),nil,nil

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrums left a comment

Choose a reason for hiding this comment

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

Still generally looking great. Didn't check the lint fail, but the tool and prompt refactoring looks correct.

"description":"Repository owner",
"type":"string"
"type":"string",
"description":"Repository owner"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these toolsnap ordering changes deterministic? As long as this is a one-off churn it's all good.

Copy link
Member

Choose a reason for hiding this comment

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

Will take a look and confirm!

@omgitsadsomgitsads merged commit726c683 intoomgitsads/go-sdkNov 20, 2025
20 of 21 checks passed
@omgitsadsomgitsads deleted the copilot/migrate-issues-toolset branchNovember 20, 2025 10:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@SamMorrowDrumsSamMorrowDrumsSamMorrowDrums approved these changes

@omgitsadsomgitsadsAwaiting requested review from omgitsads

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@omgitsads@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp