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 dependabot toolset to modelcontextprotocol/go-sdk#1429

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:

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

Changes

Function signatures

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

Schema definitions

  • Converted from DSL (mcp.NewTool()) to struct initialization (mcp.Tool{})
  • BuiltInputSchema usingjsonschema.Schema with explicit properties
  • Default values usejson.RawMessage (e.g.,Default: json.RawMessage(\"open"`)`)

Result helpers

  • mcp.NewToolResult*()utils.NewToolResult*()

Tests

  • Handler invocations updated to passargs map[string]any
  • Removed direct schema property assertions (no longer exposed)
  • Maintained toolsnap validation

Before/After

Before (mark3labs/mcp-go):

funcGetDependabotAlert(...) (tool mcp.Tool,handler server.ToolHandlerFunc) {returnmcp.NewTool("get_dependabot_alert",mcp.WithString("owner",mcp.Required(),...),...    ),func(ctx context.Context,request mcp.CallToolRequest) (*mcp.CallToolResult,error) {owner,_:=RequiredParam[string](request,"owner")...returnmcp.NewToolResultText(string(r)),nil    }}

After (modelcontextprotocol/go-sdk):

funcGetDependabotAlert(...) (mcp.Tool, mcp.ToolHandlerFor[map[string]any,any]) {tool:= mcp.Tool{Name:"get_dependabot_alert",InputSchema:&jsonschema.Schema{Properties:map[string]*jsonschema.Schema{"owner": {Type:"string",...},...            },        },    }handler:= mcp.ToolHandlerFor[map[string]any,any](func(ctx context.Context,_*mcp.CallToolRequest,argsmap[string]any) (*mcp.CallToolResult,any,error) {owner,_:=RequiredParam[string](args,"owner")...returnutils.NewToolResultText(string(r)),nil,nil        })returntool,handler}

Toolsnaps updated with cosmetic field reordering only—schemas remain functionally identical.

Original prompt

Migrate thedependabot toolset tomodelcontextprotocol/go-sdk

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.

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

image

@LuluBeatsonLuluBeatson marked this pull request as ready for reviewNovember 19, 2025 15:28
@LuluBeatsonLuluBeatson requested a review froma team as acode ownerNovember 19, 2025 15:28
CopilotAI review requested due to automatic review settingsNovember 19, 2025 15:28
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 thedependabot toolset frommark3labs/mcp-go tomodelcontextprotocol/go-sdk, completing the migration of another toolset to the new SDK. The migration updates function signatures, schema definitions, and error handling patterns to align with the new SDK's API.

  • Migrated two dependabot tools (get_dependabot_alert andlist_dependabot_alerts) to use the new SDK
  • Updated schema definitions from DSL-based to struct-based initialization withjsonschema.Schema
  • Modified handler signatures to return three values(*mcp.CallToolResult, any, error) instead of two
  • Re-enabled the dependabot toolset in the default toolset group

Reviewed Changes

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

Show a summary per file
FileDescription
pkg/github/dependabot.goMigrated tool implementations to new SDK with updated function signatures, schema definitions, and result helpers
pkg/github/dependabot_test.goUpdated tests to match new handler signatures and removed direct schema assertions in favor of toolsnap validation
pkg/github/tools.goUncommented dependabot toolset registration to re-enable it in the default toolset group
pkg/github/toolsnaps/get_dependabot_alert.snapCosmetic reordering of JSON fields (no functional changes)
pkg/github/toolsnaps/list_dependabot_alerts.snapCosmetic reordering of JSON fields (no functional changes)

body,err:=io.ReadAll(resp.Body)
iferr!=nil {
returnnil,fmt.Errorf("failed tomarshal alert: %w",err)
returnutils.NewToolResultErrorFromErr("failed toread response body",err),nil,err

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 77) is:

returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,nil
Suggested change
returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,err
returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,nil

Copilot uses AI. Check for mistakes.
returnmcp.NewToolResultText(string(r)),nil
r,err:=json.Marshal(alert)
iferr!=nil {
returnutils.NewToolResultErrorFromErr("failed to marshal alert",err),nil,err

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 84) is:

returnutils.NewToolResultErrorFromErr("failed to marshal alert",err),nil,nil
Suggested change
returnutils.NewToolResultErrorFromErr("failed to marshal alert",err),nil,err
returnutils.NewToolResultErrorFromErr("failed to marshal alert",err),nil,nil

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

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 161) is:

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

Copilot uses AI. Check for mistakes.
body,err:=io.ReadAll(resp.Body)
iferr!=nil {
returnnil,fmt.Errorf("failed tomarshal alerts: %w",err)
returnutils.NewToolResultErrorFromErr("failed toread response body",err),nil,err

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 176) is:

returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,nil
Suggested change
returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,err
returnutils.NewToolResultErrorFromErr("failed to read response body",err),nil,nil

Copilot uses AI. Check for mistakes.
returnmcp.NewToolResultText(string(r)),nil
r,err:=json.Marshal(alerts)
iferr!=nil {
returnutils.NewToolResultErrorFromErr("failed to marshal alerts",err),nil,err

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 183) is:

returnutils.NewToolResultErrorFromErr("failed to marshal alerts",err),nil,nil
Suggested change
returnutils.NewToolResultErrorFromErr("failed to marshal alerts",err),nil,err
returnutils.NewToolResultErrorFromErr("failed to marshal alerts",err),nil,nil

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

Choose a reason for hiding this comment

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

Inconsistent error handling pattern. When returning an error result usingutils.NewToolResultErrorFromErr, the third return value should benil, noterr. The error is already embedded in the result.

The correct pattern (consistent withcode_scanning.go line 61, 77, 84) is:

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

Not:

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

Copilot uses AI. Check for mistakes.
@omgitsadsomgitsadsforce-pushed thecopilot/migrate-dependabot-toolset branch from4c3d834 to183d17aCompareNovember 19, 2025 16:39
@omgitsadsomgitsads merged commit1b769a5 intoomgitsads/go-sdkNov 20, 2025
13 of 14 checks passed
@omgitsadsomgitsads deleted the copilot/migrate-dependabot-toolset branchNovember 20, 2025 10:18
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

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

4 participants

@LuluBeatson@SamMorrowDrums@omgitsads

[8]ページ先頭

©2009-2025 Movatter.jp