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 code-scanning toolset to modelcontextprotocol/go-sdk#1430

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

Conversation

Copy link
Contributor

CopilotAI commentedNov 18, 2025
edited
Loading

Closes: Part of#1428

MigratesGetCodeScanningAlert andListCodeScanningAlerts tools frommark3labs/mcp-go tomodelcontextprotocol/go-sdk.

Changes

  • Tool constructors: Return type updated to(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Handler signatures: Nowfunc(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error)
  • Schema definitions: Converted from DSL to explicitjsonschema.Schema structs
  • Parameter extraction: Uses args map passed to handler instead of extracting from request
  • Result helpers: Changed toutils.NewToolResult* functions
  • Tests: Updated to castInputSchema to*jsonschema.Schema and pass args map to handlers

Schema changes in toolsnaps are cosmetic (field ordering only) - all fields, types, enums, defaults, and descriptions remain logically equivalent.

Original prompt

Migrate thecode-scanning 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


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

Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
CopilotAI changed the title[WIP] Migrate code-scanning toolset to modelcontextprotocol/go-sdkMigrate code-scanning toolset to modelcontextprotocol/go-sdkNov 18, 2025
CopilotAI requested a review fromomgitsadsNovember 18, 2025 11:26
Copilot finished work on behalf ofomgitsadsNovember 18, 2025 11:26
@LuluBeatsonLuluBeatson self-requested a reviewNovember 18, 2025 13:33
@LuluBeatson
Copy link
Contributor

imageimage

@LuluBeatsonLuluBeatson marked this pull request as ready for reviewNovember 18, 2025 15:14
@LuluBeatsonLuluBeatson requested a review froma team as acode ownerNovember 18, 2025 15:14
CopilotAI review requested due to automatic review settingsNovember 18, 2025 15:14
@LuluBeatson
Copy link
Contributor

Ignore lint errors due to unused parameters and types. These will naturally be fixed when all tools are re-enabled.

Copilot finished reviewing on behalf ofLuluBeatsonNovember 18, 2025 15:19
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 thecode-scanning toolset (GetCodeScanningAlert andListCodeScanningAlerts tools) frommark3labs/mcp-go tomodelcontextprotocol/go-sdk. This is part of a larger migration effort tracked in PR#1428.

Key Changes:

  • Updated tool constructors to return(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])
  • Converted handler signatures to accept 3 parameters and return 3 values
  • Replaced DSL-based schemas with explicitjsonschema.Schema structs
  • Changed parameter extraction to useargs map instead ofrequest object
  • Re-enabled thecodeSecurity toolset intools.go

Reviewed Changes

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

Show a summary per file
FileDescription
pkg/github/code_scanning.goMigrated tool implementations from mark3labs/mcp-go to modelcontextprotocol/go-sdk with new schemas and handlers
pkg/github/code_scanning_test.goUpdated tests to cast InputSchema to *jsonschema.Schema and use new handler signature
pkg/github/tools.goRe-enabled codeSecurity toolset and added nolint directives to DefaultToolsetGroup and InitDynamicToolset
pkg/github/toolsnaps/*.snapCosmetic updates to field ordering in tool schema snapshots
internal/ghmcp/server.goRemoved unusedstdioServerLogPrefix constant

}
}

//nolint:unused

Choose a reason for hiding this comment

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

The//nolint:unused directive is being added toDefaultToolsetGroup andInitDynamicToolset functions, but these functions appear to be actively used in the codebase. Ininternal/ghmcp/server.go,DefaultToolsetGroup is called on line 135 andInitDynamicToolset is called on line 154. These directives should only be added if the functions are truly unused, which doesn't appear to be the case here. Consider removing these directives unless they're being added in preparation for future deprecation.

Suggested change
//nolint:unused

Copilot uses AI. Check for mistakes.

// InitDynamicToolset creates a dynamic toolset that can be used to enable other toolsets, and so requires the server and toolset group as arguments
//
//nolint:unused

Choose a reason for hiding this comment

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

The//nolint:unused directive is being added toInitDynamicToolset, but this function is actively used ininternal/ghmcp/server.go on line 154. These directives should only be added if the function is truly unused. Consider removing this directive unless it's being added in preparation for future deprecation.

Suggested change
//nolint:unused

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

Choose a reason for hiding this comment

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

Inconsistent error handling: WhengetClient(ctx) fails, the error should be returned as the third return value to match the pattern used in other migrated tools likeGetMe incontext_tools.go. The return statement should be:

returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,err

Instead of:

returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,nil
Suggested change
returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,nil
returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,err

Copilot uses AI. Check for mistakes.
resp,
err,
),nil
),nil,nil

Choose a reason for hiding this comment

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

Inconsistent error handling: When GitHub API calls fail, the error should be returned as the third return value to match the pattern used in other migrated tools. The return statement should be:

returnghErrors.NewGitHubAPIErrorResponse(ctx,"failed to get alert",resp,err,),nil,err

Instead of returningnil as the third value.

Suggested change
),nil,nil
),nil,err

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

Choose a reason for hiding this comment

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

Inconsistent error handling: WhengetClient(ctx) fails, the error should be returned as the third return value to match the pattern used in other migrated tools. The return statement should be:

returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,err

Instead of returningnil as the third value.

Suggested change
returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,nil
returnutils.NewToolResultErrorFromErr("failed to get GitHub client",err),nil,err

Copilot uses AI. Check for mistakes.
resp,
err,
),nil
),nil,nil

Choose a reason for hiding this comment

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

Inconsistent error handling: When GitHub API calls fail, the error should be returned as the third return value to match the pattern used in other migrated tools. The return statement should be:

returnghErrors.NewGitHubAPIErrorResponse(ctx,"failed to list alerts",resp,err,),nil,err

Instead of returningnil as the third value.

Suggested change
),nil,nil
),nil,err

Copilot uses AI. Check for mistakes.
@omgitsadsomgitsads merged commita405519 intoomgitsads/go-sdkNov 19, 2025
19 of 20 checks passed
@omgitsadsomgitsads deleted the copilot/migrate-code-scanning-toolset branchNovember 19, 2025 10:44
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@LuluBeatsonLuluBeatsonLuluBeatson 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

@LuluBeatson@omgitsads

[8]ページ先頭

©2009-2025 Movatter.jp