-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Migrate notifications toolset to modelcontextprotocol/go-sdk #1449
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: omgitsads/go-sdk
Are you sure you want to change the base?
Conversation
Co-authored-by: omgitsads <4619+omgitsads@users.noreply.github.com>
…igrate-notifications-toolset
| "type": "object", | ||
| "required": [ | ||
| "threadID", | ||
| "state" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state was not required before migration. But actually, the tool handler requires it.
This is an acceptable change in the tool schema.
There was a problem hiding this 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 6 notification tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk as part of the broader SDK migration effort (#1428). The migration updates tool definitions to use jsonschema.Schema structs instead of DSL-based builders, updates handler signatures to match the new SDK's three-return-value pattern, and adjusts parameter extraction and result creation to use the new SDK's interfaces.
Key Changes
- Tool return types changed from
(mcp.Tool, server.ToolHandlerFunc)to(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) - Schema definitions converted from DSL (
mcp.WithString(), etc.) tojsonschema.Schemastructs - Parameter extraction now uses
args map[string]anyinstead ofrequest - Result helpers updated from
mcp.NewToolResultText()toutils.NewToolResultText()
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
pkg/github/notifications.go |
Migrated 6 notification tool implementations to new SDK, including schema definitions and handler logic |
pkg/github/notifications_test.go |
Updated test invocations for new handler signatures (3 return values) and schema assertions to use *jsonschema.Schema |
pkg/github/tools.go |
Uncommented notifications toolset registration to re-enable these tools |
pkg/github/__toolsnaps__/*.snap |
Updated toolsnaps to reflect new schema serialization format (field ordering, optional false values omitted) |
| Enum: []any{"read", "done"}, | ||
| }, | ||
| }, | ||
| Required: []string{"threadID", "state"}, |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The state parameter is now marked as required, but it was optional in the original implementation (the old toolsnap shows only "threadID" in the required array). This changes the API behavior - users were previously able to omit the state parameter.
If making state required is intentional, this should be called out in the PR description as a behavior change. Otherwise, state should remain optional to maintain backward compatibility.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.
| return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
| } | ||
| func DismissNotification(getclient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.
| return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
| } | ||
| func MarkAllNotificationsRead(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.
| return mcp.NewToolResultError(err.Error()), nil | ||
| } | ||
| func GetNotificationDetails(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.
| return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
| } | ||
| func ManageNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.
| return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
| } | ||
| func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { | ||
| tool := mcp.Tool{ |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition of tool is never used.





Closes: Part of #1428
Migrates 6 notification tools from
mark3labs/mcp-gotomodelcontextprotocol/go-sdk:list_notificationsdismiss_notificationmark_all_notifications_readget_notification_detailsmanage_notification_subscriptionmanage_repository_notification_subscriptionChanges
Tool Implementation
(mcp.Tool, server.ToolHandlerFunc)→(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)→func(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error)mcp.NewTool(),mcp.WithString()) →jsonschema.SchemastructsOptionalParam[T](request, "key")→OptionalParam[T](args, "key")mcp.NewToolResultText()→utils.NewToolResultText()Test Updates
handler(ctx, request)→handler(ctx, &request, args)result, err→result, _, errExample
Toolsnaps updated to reflect new schema format while maintaining logical equivalence.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.