diff --git a/pkg/github/__toolsnaps__/dismiss_notification.snap b/pkg/github/__toolsnaps__/dismiss_notification.snap index 80646a802..b0125ba53 100644 --- a/pkg/github/__toolsnaps__/dismiss_notification.snap +++ b/pkg/github/__toolsnaps__/dismiss_notification.snap @@ -1,28 +1,28 @@ { "annotations": { - "title": "Dismiss notification", - "readOnlyHint": false + "title": "Dismiss notification" }, "description": "Dismiss a notification by marking it as read or done", "inputSchema": { + "type": "object", + "required": [ + "threadID", + "state" + ], "properties": { "state": { + "type": "string", "description": "The new state of the notification (read/done)", "enum": [ "read", "done" - ], - "type": "string" + ] }, "threadID": { - "description": "The ID of the notification thread", - "type": "string" + "type": "string", + "description": "The ID of the notification thread" } - }, - "required": [ - "threadID" - ], - "type": "object" + } }, "name": "dismiss_notification" } \ No newline at end of file diff --git a/pkg/github/__toolsnaps__/get_notification_details.snap b/pkg/github/__toolsnaps__/get_notification_details.snap index 62bc6bf1b..de197f2b1 100644 --- a/pkg/github/__toolsnaps__/get_notification_details.snap +++ b/pkg/github/__toolsnaps__/get_notification_details.snap @@ -1,20 +1,20 @@ { "annotations": { - "title": "Get notification details", - "readOnlyHint": true + "readOnlyHint": true, + "title": "Get notification details" }, "description": "Get detailed information for a specific GitHub notification, always call this tool when the user asks for details about a specific notification, if you don't know the ID list notifications first.", "inputSchema": { - "properties": { - "notificationID": { - "description": "The ID of the notification", - "type": "string" - } - }, + "type": "object", "required": [ "notificationID" ], - "type": "object" + "properties": { + "notificationID": { + "type": "string", + "description": "The ID of the notification" + } + } }, "name": "get_notification_details" } \ No newline at end of file diff --git a/pkg/github/__toolsnaps__/list_notifications.snap b/pkg/github/__toolsnaps__/list_notifications.snap index 92f25eb4c..ae43e0f25 100644 --- a/pkg/github/__toolsnaps__/list_notifications.snap +++ b/pkg/github/__toolsnaps__/list_notifications.snap @@ -1,49 +1,49 @@ { "annotations": { - "title": "List notifications", - "readOnlyHint": true + "readOnlyHint": true, + "title": "List notifications" }, "description": "Lists all GitHub notifications for the authenticated user, including unread notifications, mentions, review requests, assignments, and updates on issues or pull requests. Use this tool whenever the user asks what to work on next, requests a summary of their GitHub activity, wants to see pending reviews, or needs to check for new updates or tasks. This tool is the primary way to discover actionable items, reminders, and outstanding work on GitHub. Always call this tool when asked what to work on next, what is pending, or what needs attention in GitHub.", "inputSchema": { + "type": "object", "properties": { "before": { - "description": "Only show notifications updated before the given time (ISO 8601 format)", - "type": "string" + "type": "string", + "description": "Only show notifications updated before the given time (ISO 8601 format)" }, "filter": { + "type": "string", "description": "Filter notifications to, use default unless specified. Read notifications are ones that have already been acknowledged by the user. Participating notifications are those that the user is directly involved in, such as issues or pull requests they have commented on or created.", "enum": [ "default", "include_read_notifications", "only_participating" - ], - "type": "string" + ] }, "owner": { - "description": "Optional repository owner. If provided with repo, only notifications for this repository are listed.", - "type": "string" + "type": "string", + "description": "Optional repository owner. If provided with repo, only notifications for this repository are listed." }, "page": { + "type": "number", "description": "Page number for pagination (min 1)", - "minimum": 1, - "type": "number" + "minimum": 1 }, "perPage": { + "type": "number", "description": "Results per page for pagination (min 1, max 100)", - "maximum": 100, "minimum": 1, - "type": "number" + "maximum": 100 }, "repo": { - "description": "Optional repository name. If provided with owner, only notifications for this repository are listed.", - "type": "string" + "type": "string", + "description": "Optional repository name. If provided with owner, only notifications for this repository are listed." }, "since": { - "description": "Only show notifications updated after the given time (ISO 8601 format)", - "type": "string" + "type": "string", + "description": "Only show notifications updated after the given time (ISO 8601 format)" } - }, - "type": "object" + } }, "name": "list_notifications" } \ No newline at end of file diff --git a/pkg/github/__toolsnaps__/manage_notification_subscription.snap b/pkg/github/__toolsnaps__/manage_notification_subscription.snap index 0f7d91201..4f0d466a0 100644 --- a/pkg/github/__toolsnaps__/manage_notification_subscription.snap +++ b/pkg/github/__toolsnaps__/manage_notification_subscription.snap @@ -1,30 +1,29 @@ { "annotations": { - "title": "Manage notification subscription", - "readOnlyHint": false + "title": "Manage notification subscription" }, "description": "Manage a notification subscription: ignore, watch, or delete a notification thread subscription.", "inputSchema": { + "type": "object", + "required": [ + "notificationID", + "action" + ], "properties": { "action": { + "type": "string", "description": "Action to perform: ignore, watch, or delete the notification subscription.", "enum": [ "ignore", "watch", "delete" - ], - "type": "string" + ] }, "notificationID": { - "description": "The ID of the notification thread.", - "type": "string" + "type": "string", + "description": "The ID of the notification thread." } - }, - "required": [ - "notificationID", - "action" - ], - "type": "object" + } }, "name": "manage_notification_subscription" } \ No newline at end of file diff --git a/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap b/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap index 9d09a5817..82ee40a89 100644 --- a/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap +++ b/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap @@ -1,35 +1,34 @@ { "annotations": { - "title": "Manage repository notification subscription", - "readOnlyHint": false + "title": "Manage repository notification subscription" }, "description": "Manage a repository notification subscription: ignore, watch, or delete repository notifications subscription for the provided repository.", "inputSchema": { + "type": "object", + "required": [ + "owner", + "repo", + "action" + ], "properties": { "action": { + "type": "string", "description": "Action to perform: ignore, watch, or delete the repository notification subscription.", "enum": [ "ignore", "watch", "delete" - ], - "type": "string" + ] }, "owner": { - "description": "The account owner of the repository.", - "type": "string" + "type": "string", + "description": "The account owner of the repository." }, "repo": { - "description": "The name of the repository.", - "type": "string" + "type": "string", + "description": "The name of the repository." } - }, - "required": [ - "owner", - "repo", - "action" - ], - "type": "object" + } }, "name": "manage_repository_notification_subscription" } \ No newline at end of file diff --git a/pkg/github/__toolsnaps__/mark_all_notifications_read.snap b/pkg/github/__toolsnaps__/mark_all_notifications_read.snap index 5a1fe24a5..2d45ed78d 100644 --- a/pkg/github/__toolsnaps__/mark_all_notifications_read.snap +++ b/pkg/github/__toolsnaps__/mark_all_notifications_read.snap @@ -1,25 +1,24 @@ { "annotations": { - "title": "Mark all notifications as read", - "readOnlyHint": false + "title": "Mark all notifications as read" }, "description": "Mark all notifications as read", "inputSchema": { + "type": "object", "properties": { "lastReadAt": { - "description": "Describes the last point that notifications were checked (optional). Default: Now", - "type": "string" + "type": "string", + "description": "Describes the last point that notifications were checked (optional). Default: Now" }, "owner": { - "description": "Optional repository owner. If provided with repo, only notifications for this repository are marked as read.", - "type": "string" + "type": "string", + "description": "Optional repository owner. If provided with repo, only notifications for this repository are marked as read." }, "repo": { - "description": "Optional repository name. If provided with owner, only notifications for this repository are marked as read.", - "type": "string" + "type": "string", + "description": "Optional repository name. If provided with owner, only notifications for this repository are marked as read." } - }, - "type": "object" + } }, "name": "mark_all_notifications_read" } \ No newline at end of file diff --git a/pkg/github/notifications.go b/pkg/github/notifications.go index ac2dcec6b..7f9e98f91 100644 --- a/pkg/github/notifications.go +++ b/pkg/github/notifications.go @@ -1,5 +1,3 @@ -//go:build ignore - package github import ( @@ -13,9 +11,10 @@ import ( ghErrors "github.com/github/github-mcp-server/pkg/errors" "github.com/github/github-mcp-server/pkg/translations" + "github.com/github/github-mcp-server/pkg/utils" "github.com/google/go-github/v79/github" - "github.com/mark3labs/mcp-go/mcp" - "github.com/mark3labs/mcp-go/server" + "github.com/google/jsonschema-go/jsonschema" + "github.com/modelcontextprotocol/go-sdk/mcp" ) const ( @@ -25,64 +24,74 @@ const ( ) // ListNotifications creates a tool to list notifications for the current user. -func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("list_notifications", - mcp.WithDescription(t("TOOL_LIST_NOTIFICATIONS_DESCRIPTION", "Lists all GitHub notifications for the authenticated user, including unread notifications, mentions, review requests, assignments, and updates on issues or pull requests. Use this tool whenever the user asks what to work on next, requests a summary of their GitHub activity, wants to see pending reviews, or needs to check for new updates or tasks. This tool is the primary way to discover actionable items, reminders, and outstanding work on GitHub. Always call this tool when asked what to work on next, what is pending, or what needs attention in GitHub.")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "list_notifications", + Description: t("TOOL_LIST_NOTIFICATIONS_DESCRIPTION", "Lists all GitHub notifications for the authenticated user, including unread notifications, mentions, review requests, assignments, and updates on issues or pull requests. Use this tool whenever the user asks what to work on next, requests a summary of their GitHub activity, wants to see pending reviews, or needs to check for new updates or tasks. This tool is the primary way to discover actionable items, reminders, and outstanding work on GitHub. Always call this tool when asked what to work on next, what is pending, or what needs attention in GitHub."), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_LIST_NOTIFICATIONS_USER_TITLE", "List notifications"), - ReadOnlyHint: ToBoolPtr(true), + ReadOnlyHint: true, + }, + InputSchema: WithPagination(&jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "filter": { + Type: "string", + Description: "Filter notifications to, use default unless specified. Read notifications are ones that have already been acknowledged by the user. Participating notifications are those that the user is directly involved in, such as issues or pull requests they have commented on or created.", + Enum: []any{FilterDefault, FilterIncludeRead, FilterOnlyParticipating}, + }, + "since": { + Type: "string", + Description: "Only show notifications updated after the given time (ISO 8601 format)", + }, + "before": { + Type: "string", + Description: "Only show notifications updated before the given time (ISO 8601 format)", + }, + "owner": { + Type: "string", + Description: "Optional repository owner. If provided with repo, only notifications for this repository are listed.", + }, + "repo": { + Type: "string", + Description: "Optional repository name. If provided with owner, only notifications for this repository are listed.", + }, + }, }), - mcp.WithString("filter", - mcp.Description("Filter notifications to, use default unless specified. Read notifications are ones that have already been acknowledged by the user. Participating notifications are those that the user is directly involved in, such as issues or pull requests they have commented on or created."), - mcp.Enum(FilterDefault, FilterIncludeRead, FilterOnlyParticipating), - ), - mcp.WithString("since", - mcp.Description("Only show notifications updated after the given time (ISO 8601 format)"), - ), - mcp.WithString("before", - mcp.Description("Only show notifications updated before the given time (ISO 8601 format)"), - ), - mcp.WithString("owner", - mcp.Description("Optional repository owner. If provided with repo, only notifications for this repository are listed."), - ), - mcp.WithString("repo", - mcp.Description("Optional repository name. If provided with owner, only notifications for this repository are listed."), - ), - WithPagination(), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getClient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - filter, err := OptionalParam[string](request, "filter") + filter, err := OptionalParam[string](args, "filter") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - since, err := OptionalParam[string](request, "since") + since, err := OptionalParam[string](args, "since") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - before, err := OptionalParam[string](request, "before") + before, err := OptionalParam[string](args, "before") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - owner, err := OptionalParam[string](request, "owner") + owner, err := OptionalParam[string](args, "owner") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - repo, err := OptionalParam[string](request, "repo") + repo, err := OptionalParam[string](args, "repo") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - paginationParams, err := OptionalPaginationParams(request) + paginationParams, err := OptionalPaginationParams(args) if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } // Build options @@ -99,7 +108,7 @@ func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFu if since != "" { sinceTime, err := time.Parse(time.RFC3339, since) if err != nil { - return mcp.NewToolResultError(fmt.Sprintf("invalid since time format, should be RFC3339/ISO8601: %v", err)), nil + return utils.NewToolResultError(fmt.Sprintf("invalid since time format, should be RFC3339/ISO8601: %v", err)), nil, nil } opts.Since = sinceTime } @@ -107,7 +116,7 @@ func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFu if before != "" { beforeTime, err := time.Parse(time.RFC3339, before) if err != nil { - return mcp.NewToolResultError(fmt.Sprintf("invalid before time format, should be RFC3339/ISO8601: %v", err)), nil + return utils.NewToolResultError(fmt.Sprintf("invalid before time format, should be RFC3339/ISO8601: %v", err)), nil, nil } opts.Before = beforeTime } @@ -125,56 +134,67 @@ func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFu "failed to list notifications", resp, err, - ), nil + ), nil, nil } defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { body, err := io.ReadAll(resp.Body) if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) + return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err } - return mcp.NewToolResultError(fmt.Sprintf("failed to get notifications: %s", string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to get notifications: %s", string(body))), nil, nil } // Marshal response to JSON r, err := json.Marshal(notifications) if err != nil { - return nil, fmt.Errorf("failed to marshal response: %w", err) + return utils.NewToolResultErrorFromErr("failed to marshal response", err), nil, err } - return mcp.NewToolResultText(string(r)), nil - } + return utils.NewToolResultText(string(r)), nil, nil + }) } // DismissNotification creates a tool to mark a notification as read/done. -func DismissNotification(getclient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("dismiss_notification", - mcp.WithDescription(t("TOOL_DISMISS_NOTIFICATION_DESCRIPTION", "Dismiss a notification by marking it as read or done")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func DismissNotification(getclient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "dismiss_notification", + Description: t("TOOL_DISMISS_NOTIFICATION_DESCRIPTION", "Dismiss a notification by marking it as read or done"), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_DISMISS_NOTIFICATION_USER_TITLE", "Dismiss notification"), - ReadOnlyHint: ToBoolPtr(false), - }), - mcp.WithString("threadID", - mcp.Required(), - mcp.Description("The ID of the notification thread"), - ), - mcp.WithString("state", mcp.Description("The new state of the notification (read/done)"), mcp.Enum("read", "done")), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + ReadOnlyHint: false, + }, + InputSchema: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "threadID": { + Type: "string", + Description: "The ID of the notification thread", + }, + "state": { + Type: "string", + Description: "The new state of the notification (read/done)", + Enum: []any{"read", "done"}, + }, + }, + Required: []string{"threadID", "state"}, + }, + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getclient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - threadID, err := RequiredParam[string](request, "threadID") + threadID, err := RequiredParam[string](args, "threadID") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - state, err := RequiredParam[string](request, "state") + state, err := RequiredParam[string](args, "state") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } var resp *github.Response @@ -184,13 +204,13 @@ func DismissNotification(getclient GetClientFn, t translations.TranslationHelper var threadIDInt int64 threadIDInt, err = strconv.ParseInt(threadID, 10, 64) if err != nil { - return mcp.NewToolResultError(fmt.Sprintf("invalid threadID format: %v", err)), nil + return utils.NewToolResultError(fmt.Sprintf("invalid threadID format: %v", err)), nil, nil } resp, err = client.Activity.MarkThreadDone(ctx, threadIDInt) case "read": resp, err = client.Activity.MarkThreadRead(ctx, threadID) default: - return mcp.NewToolResultError("Invalid state. Must be one of: read, done."), nil + return utils.NewToolResultError("Invalid state. Must be one of: read, done."), nil, nil } if err != nil { @@ -198,65 +218,74 @@ func DismissNotification(getclient GetClientFn, t translations.TranslationHelper fmt.Sprintf("failed to mark notification as %s", state), resp, err, - ), nil + ), nil, nil } defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusResetContent && resp.StatusCode != http.StatusOK { body, err := io.ReadAll(resp.Body) if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) + return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err } - return mcp.NewToolResultError(fmt.Sprintf("failed to mark notification as %s: %s", state, string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to mark notification as %s: %s", state, string(body))), nil, nil } - return mcp.NewToolResultText(fmt.Sprintf("Notification marked as %s", state)), nil - } + return utils.NewToolResultText(fmt.Sprintf("Notification marked as %s", state)), nil, nil + }) } // MarkAllNotificationsRead creates a tool to mark all notifications as read. -func MarkAllNotificationsRead(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("mark_all_notifications_read", - mcp.WithDescription(t("TOOL_MARK_ALL_NOTIFICATIONS_READ_DESCRIPTION", "Mark all notifications as read")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func MarkAllNotificationsRead(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "mark_all_notifications_read", + Description: t("TOOL_MARK_ALL_NOTIFICATIONS_READ_DESCRIPTION", "Mark all notifications as read"), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_MARK_ALL_NOTIFICATIONS_READ_USER_TITLE", "Mark all notifications as read"), - ReadOnlyHint: ToBoolPtr(false), - }), - mcp.WithString("lastReadAt", - mcp.Description("Describes the last point that notifications were checked (optional). Default: Now"), - ), - mcp.WithString("owner", - mcp.Description("Optional repository owner. If provided with repo, only notifications for this repository are marked as read."), - ), - mcp.WithString("repo", - mcp.Description("Optional repository name. If provided with owner, only notifications for this repository are marked as read."), - ), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + ReadOnlyHint: false, + }, + InputSchema: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "lastReadAt": { + Type: "string", + Description: "Describes the last point that notifications were checked (optional). Default: Now", + }, + "owner": { + Type: "string", + Description: "Optional repository owner. If provided with repo, only notifications for this repository are marked as read.", + }, + "repo": { + Type: "string", + Description: "Optional repository name. If provided with owner, only notifications for this repository are marked as read.", + }, + }, + }, + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getClient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - lastReadAt, err := OptionalParam[string](request, "lastReadAt") + lastReadAt, err := OptionalParam[string](args, "lastReadAt") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - owner, err := OptionalParam[string](request, "owner") + owner, err := OptionalParam[string](args, "owner") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - repo, err := OptionalParam[string](request, "repo") + repo, err := OptionalParam[string](args, "repo") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } var lastReadTime time.Time if lastReadAt != "" { lastReadTime, err = time.Parse(time.RFC3339, lastReadAt) if err != nil { - return mcp.NewToolResultError(fmt.Sprintf("invalid lastReadAt time format, should be RFC3339/ISO8601: %v", err)), nil + return utils.NewToolResultError(fmt.Sprintf("invalid lastReadAt time format, should be RFC3339/ISO8601: %v", err)), nil, nil } } else { lastReadTime = time.Now() @@ -277,44 +306,51 @@ func MarkAllNotificationsRead(getClient GetClientFn, t translations.TranslationH "failed to mark all notifications as read", resp, err, - ), nil + ), nil, nil } defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusResetContent && resp.StatusCode != http.StatusOK { body, err := io.ReadAll(resp.Body) if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) + return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err } - return mcp.NewToolResultError(fmt.Sprintf("failed to mark all notifications as read: %s", string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to mark all notifications as read: %s", string(body))), nil, nil } - return mcp.NewToolResultText("All notifications marked as read"), nil - } + return utils.NewToolResultText("All notifications marked as read"), nil, nil + }) } // GetNotificationDetails creates a tool to get details for a specific notification. -func GetNotificationDetails(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("get_notification_details", - mcp.WithDescription(t("TOOL_GET_NOTIFICATION_DETAILS_DESCRIPTION", "Get detailed information for a specific GitHub notification, always call this tool when the user asks for details about a specific notification, if you don't know the ID list notifications first.")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func GetNotificationDetails(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "get_notification_details", + Description: t("TOOL_GET_NOTIFICATION_DETAILS_DESCRIPTION", "Get detailed information for a specific GitHub notification, always call this tool when the user asks for details about a specific notification, if you don't know the ID list notifications first."), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_GET_NOTIFICATION_DETAILS_USER_TITLE", "Get notification details"), - ReadOnlyHint: ToBoolPtr(true), - }), - mcp.WithString("notificationID", - mcp.Required(), - mcp.Description("The ID of the notification"), - ), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + ReadOnlyHint: true, + }, + InputSchema: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "notificationID": { + Type: "string", + Description: "The ID of the notification", + }, + }, + Required: []string{"notificationID"}, + }, + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getClient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - notificationID, err := RequiredParam[string](request, "notificationID") + notificationID, err := RequiredParam[string](args, "notificationID") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } thread, resp, err := client.Activity.GetThread(ctx, notificationID) @@ -323,25 +359,25 @@ func GetNotificationDetails(getClient GetClientFn, t translations.TranslationHel fmt.Sprintf("failed to get notification details for ID '%s'", notificationID), resp, err, - ), nil + ), nil, nil } defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { body, err := io.ReadAll(resp.Body) if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) + return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, err } - return mcp.NewToolResultError(fmt.Sprintf("failed to get notification details: %s", string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to get notification details: %s", string(body))), nil, nil } r, err := json.Marshal(thread) if err != nil { - return nil, fmt.Errorf("failed to marshal response: %w", err) + return utils.NewToolResultErrorFromErr("failed to marshal response", err), nil, err } - return mcp.NewToolResultText(string(r)), nil - } + return utils.NewToolResultText(string(r)), nil, nil + }) } // Enum values for ManageNotificationSubscription action @@ -352,36 +388,43 @@ const ( ) // ManageNotificationSubscription creates a tool to manage a notification subscription (ignore, watch, delete) -func ManageNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("manage_notification_subscription", - mcp.WithDescription(t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a notification subscription: ignore, watch, or delete a notification thread subscription.")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func ManageNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "manage_notification_subscription", + Description: t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a notification subscription: ignore, watch, or delete a notification thread subscription."), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage notification subscription"), - ReadOnlyHint: ToBoolPtr(false), - }), - mcp.WithString("notificationID", - mcp.Required(), - mcp.Description("The ID of the notification thread."), - ), - mcp.WithString("action", - mcp.Required(), - mcp.Description("Action to perform: ignore, watch, or delete the notification subscription."), - mcp.Enum(NotificationActionIgnore, NotificationActionWatch, NotificationActionDelete), - ), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + ReadOnlyHint: false, + }, + InputSchema: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "notificationID": { + Type: "string", + Description: "The ID of the notification thread.", + }, + "action": { + Type: "string", + Description: "Action to perform: ignore, watch, or delete the notification subscription.", + Enum: []any{NotificationActionIgnore, NotificationActionWatch, NotificationActionDelete}, + }, + }, + Required: []string{"notificationID", "action"}, + }, + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getClient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - notificationID, err := RequiredParam[string](request, "notificationID") + notificationID, err := RequiredParam[string](args, "notificationID") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - action, err := RequiredParam[string](request, "action") + action, err := RequiredParam[string](args, "action") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } var ( @@ -400,7 +443,7 @@ func ManageNotificationSubscription(getClient GetClientFn, t translations.Transl case NotificationActionDelete: resp, apiErr = client.Activity.DeleteThreadSubscription(ctx, notificationID) default: - return mcp.NewToolResultError("Invalid action. Must be one of: ignore, watch, delete."), nil + return utils.NewToolResultError("Invalid action. Must be one of: ignore, watch, delete."), nil, nil } if apiErr != nil { @@ -408,26 +451,26 @@ func ManageNotificationSubscription(getClient GetClientFn, t translations.Transl fmt.Sprintf("failed to %s notification subscription", action), resp, apiErr, - ), nil + ), nil, nil } defer func() { _ = resp.Body.Close() }() if resp.StatusCode < 200 || resp.StatusCode >= 300 { body, _ := io.ReadAll(resp.Body) - return mcp.NewToolResultError(fmt.Sprintf("failed to %s notification subscription: %s", action, string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to %s notification subscription: %s", action, string(body))), nil, nil } if action == NotificationActionDelete { // Special case for delete as there is no response body - return mcp.NewToolResultText("Notification subscription deleted"), nil + return utils.NewToolResultText("Notification subscription deleted"), nil, nil } r, err := json.Marshal(result) if err != nil { - return nil, fmt.Errorf("failed to marshal response: %w", err) + return utils.NewToolResultErrorFromErr("failed to marshal response", err), nil, err } - return mcp.NewToolResultText(string(r)), nil - } + return utils.NewToolResultText(string(r)), nil, nil + }) } const ( @@ -437,44 +480,51 @@ const ( ) // ManageRepositoryNotificationSubscription creates a tool to manage a repository notification subscription (ignore, watch, delete) -func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { - return mcp.NewTool("manage_repository_notification_subscription", - mcp.WithDescription(t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a repository notification subscription: ignore, watch, or delete repository notifications subscription for the provided repository.")), - mcp.WithToolAnnotation(mcp.ToolAnnotation{ +func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) { + return mcp.Tool{ + Name: "manage_repository_notification_subscription", + Description: t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a repository notification subscription: ignore, watch, or delete repository notifications subscription for the provided repository."), + Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage repository notification subscription"), - ReadOnlyHint: ToBoolPtr(false), - }), - mcp.WithString("owner", - mcp.Required(), - mcp.Description("The account owner of the repository."), - ), - mcp.WithString("repo", - mcp.Required(), - mcp.Description("The name of the repository."), - ), - mcp.WithString("action", - mcp.Required(), - mcp.Description("Action to perform: ignore, watch, or delete the repository notification subscription."), - mcp.Enum(RepositorySubscriptionActionIgnore, RepositorySubscriptionActionWatch, RepositorySubscriptionActionDelete), - ), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + ReadOnlyHint: false, + }, + InputSchema: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ + "owner": { + Type: "string", + Description: "The account owner of the repository.", + }, + "repo": { + Type: "string", + Description: "The name of the repository.", + }, + "action": { + Type: "string", + Description: "Action to perform: ignore, watch, or delete the repository notification subscription.", + Enum: []any{RepositorySubscriptionActionIgnore, RepositorySubscriptionActionWatch, RepositorySubscriptionActionDelete}, + }, + }, + Required: []string{"owner", "repo", "action"}, + }, + }, + mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { client, err := getClient(ctx) if err != nil { - return nil, fmt.Errorf("failed to get GitHub client: %w", err) + return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, err } - owner, err := RequiredParam[string](request, "owner") + owner, err := RequiredParam[string](args, "owner") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - repo, err := RequiredParam[string](request, "repo") + repo, err := RequiredParam[string](args, "repo") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } - action, err := RequiredParam[string](request, "action") + action, err := RequiredParam[string](args, "action") if err != nil { - return mcp.NewToolResultError(err.Error()), nil + return utils.NewToolResultError(err.Error()), nil, nil } var ( @@ -493,7 +543,7 @@ func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translati case RepositorySubscriptionActionDelete: resp, apiErr = client.Activity.DeleteRepositorySubscription(ctx, owner, repo) default: - return mcp.NewToolResultError("Invalid action. Must be one of: ignore, watch, delete."), nil + return utils.NewToolResultError("Invalid action. Must be one of: ignore, watch, delete."), nil, nil } if apiErr != nil { @@ -501,7 +551,7 @@ func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translati fmt.Sprintf("failed to %s repository subscription", action), resp, apiErr, - ), nil + ), nil, nil } if resp != nil { defer func() { _ = resp.Body.Close() }() @@ -510,18 +560,18 @@ func ManageRepositoryNotificationSubscription(getClient GetClientFn, t translati // Handle non-2xx status codes if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) { body, _ := io.ReadAll(resp.Body) - return mcp.NewToolResultError(fmt.Sprintf("failed to %s repository subscription: %s", action, string(body))), nil + return utils.NewToolResultError(fmt.Sprintf("failed to %s repository subscription: %s", action, string(body))), nil, nil } if action == RepositorySubscriptionActionDelete { // Special case for delete as there is no response body - return mcp.NewToolResultText("Repository subscription deleted"), nil + return utils.NewToolResultText("Repository subscription deleted"), nil, nil } r, err := json.Marshal(result) if err != nil { - return nil, fmt.Errorf("failed to marshal response: %w", err) + return utils.NewToolResultErrorFromErr("failed to marshal response", err), nil, err } - return mcp.NewToolResultText(string(r)), nil - } + return utils.NewToolResultText(string(r)), nil, nil + }) } diff --git a/pkg/github/notifications_test.go b/pkg/github/notifications_test.go index 4920589e1..37135bf5c 100644 --- a/pkg/github/notifications_test.go +++ b/pkg/github/notifications_test.go @@ -1,5 +1,3 @@ -//go:build ignore - package github import ( @@ -11,6 +9,7 @@ import ( "github.com/github/github-mcp-server/internal/toolsnaps" "github.com/github/github-mcp-server/pkg/translations" "github.com/google/go-github/v79/github" + "github.com/google/jsonschema-go/jsonschema" "github.com/migueleliasweb/go-github-mock/src/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -24,16 +23,18 @@ func Test_ListNotifications(t *testing.T) { assert.Equal(t, "list_notifications", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "filter") - assert.Contains(t, tool.InputSchema.Properties, "since") - assert.Contains(t, tool.InputSchema.Properties, "before") - assert.Contains(t, tool.InputSchema.Properties, "owner") - assert.Contains(t, tool.InputSchema.Properties, "repo") - assert.Contains(t, tool.InputSchema.Properties, "page") - assert.Contains(t, tool.InputSchema.Properties, "perPage") - // All fields are optional, so Required should be empty - assert.Empty(t, tool.InputSchema.Required) + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "filter") + assert.Contains(t, schema.Properties, "since") + assert.Contains(t, schema.Properties, "before") + assert.Contains(t, schema.Properties, "owner") + assert.Contains(t, schema.Properties, "repo") + assert.Contains(t, schema.Properties, "page") + assert.Contains(t, schema.Properties, "perPage") + // All fields are optional, so Required should be empty + assert.Empty(t, schema.Required) mockNotification := &github.Notification{ ID: github.Ptr("123"), Reason: github.Ptr("mention"), @@ -126,7 +127,7 @@ func Test_ListNotifications(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := ListNotifications(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { require.NoError(t, err) @@ -159,9 +160,12 @@ func Test_ManageNotificationSubscription(t *testing.T) { assert.Equal(t, "manage_notification_subscription", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "notificationID") - assert.Contains(t, tool.InputSchema.Properties, "action") - assert.ElementsMatch(t, tool.InputSchema.Required, []string{"notificationID", "action"}) + + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "notificationID") + assert.Contains(t, schema.Properties, "action") + assert.Equal(t, []string{"notificationID", "action"}, schema.Required) mockSub := &github.Subscription{Ignored: github.Ptr(true)} mockSubWatch := &github.Subscription{Ignored: github.Ptr(false), Subscribed: github.Ptr(true)} @@ -254,7 +258,7 @@ func Test_ManageNotificationSubscription(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := ManageNotificationSubscription(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { require.NoError(t, err) @@ -297,10 +301,13 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) { assert.Equal(t, "manage_repository_notification_subscription", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "owner") - assert.Contains(t, tool.InputSchema.Properties, "repo") - assert.Contains(t, tool.InputSchema.Properties, "action") - assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo", "action"}) + + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "owner") + assert.Contains(t, schema.Properties, "repo") + assert.Contains(t, schema.Properties, "action") + assert.Equal(t, []string{"owner", "repo", "action"}, schema.Required) mockSub := &github.Subscription{Ignored: github.Ptr(true)} mockWatchSub := &github.Subscription{Ignored: github.Ptr(false), Subscribed: github.Ptr(true)} @@ -410,7 +417,7 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := ManageRepositoryNotificationSubscription(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { require.NoError(t, err) @@ -460,9 +467,12 @@ func Test_DismissNotification(t *testing.T) { assert.Equal(t, "dismiss_notification", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "threadID") - assert.Contains(t, tool.InputSchema.Properties, "state") - assert.ElementsMatch(t, tool.InputSchema.Required, []string{"threadID"}) + + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "threadID") + assert.Contains(t, schema.Properties, "state") + assert.Equal(t, []string{"threadID", "state"}, schema.Required) tests := []struct { name string @@ -546,7 +556,7 @@ func Test_DismissNotification(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := DismissNotification(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { // The tool returns a ToolResultError with a specific message @@ -592,10 +602,13 @@ func Test_MarkAllNotificationsRead(t *testing.T) { assert.Equal(t, "mark_all_notifications_read", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "lastReadAt") - assert.Contains(t, tool.InputSchema.Properties, "owner") - assert.Contains(t, tool.InputSchema.Properties, "repo") - assert.Empty(t, tool.InputSchema.Required) + + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "lastReadAt") + assert.Contains(t, schema.Properties, "owner") + assert.Contains(t, schema.Properties, "repo") + assert.Empty(t, schema.Required) tests := []struct { name string @@ -665,7 +678,7 @@ func Test_MarkAllNotificationsRead(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := MarkAllNotificationsRead(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { require.NoError(t, err) @@ -695,8 +708,11 @@ func Test_GetNotificationDetails(t *testing.T) { assert.Equal(t, "get_notification_details", tool.Name) assert.NotEmpty(t, tool.Description) - assert.Contains(t, tool.InputSchema.Properties, "notificationID") - assert.ElementsMatch(t, tool.InputSchema.Required, []string{"notificationID"}) + + schema, ok := tool.InputSchema.(*jsonschema.Schema) + require.True(t, ok, "InputSchema should be *jsonschema.Schema") + assert.Contains(t, schema.Properties, "notificationID") + assert.Equal(t, []string{"notificationID"}, schema.Required) mockThread := &github.Notification{ID: github.Ptr("123"), Reason: github.Ptr("mention")} @@ -743,7 +759,7 @@ func Test_GetNotificationDetails(t *testing.T) { client := github.NewClient(tc.mockedClient) _, handler := GetNotificationDetails(stubGetClientFn(client), translations.NullTranslationHelper) request := createMCPRequest(tc.requestArgs) - result, err := handler(context.Background(), request) + result, _, err := handler(context.Background(), &request, tc.requestArgs) if tc.expectError { require.NoError(t, err) diff --git a/pkg/github/tools.go b/pkg/github/tools.go index d80d16fd7..cd408c949 100644 --- a/pkg/github/tools.go +++ b/pkg/github/tools.go @@ -256,17 +256,17 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG toolsets.NewServerTool(ListDependabotAlerts(getClient, t)), ) - // notifications := toolsets.NewToolset(ToolsetMetadataNotifications.ID, ToolsetMetadataNotifications.Description). - // AddReadTools( - // toolsets.NewServerTool(ListNotifications(getClient, t)), - // toolsets.NewServerTool(GetNotificationDetails(getClient, t)), - // ). - // AddWriteTools( - // toolsets.NewServerTool(DismissNotification(getClient, t)), - // toolsets.NewServerTool(MarkAllNotificationsRead(getClient, t)), - // toolsets.NewServerTool(ManageNotificationSubscription(getClient, t)), - // toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)), - // ) + notifications := toolsets.NewToolset(ToolsetMetadataNotifications.ID, ToolsetMetadataNotifications.Description). + AddReadTools( + toolsets.NewServerTool(ListNotifications(getClient, t)), + toolsets.NewServerTool(GetNotificationDetails(getClient, t)), + ). + AddWriteTools( + toolsets.NewServerTool(DismissNotification(getClient, t)), + toolsets.NewServerTool(MarkAllNotificationsRead(getClient, t)), + toolsets.NewServerTool(ManageNotificationSubscription(getClient, t)), + toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)), + ) // discussions := toolsets.NewToolset(ToolsetMetadataDiscussions.ID, ToolsetMetadataDiscussions.Description). // AddReadTools( @@ -370,7 +370,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG tsg.AddToolset(codeSecurity) tsg.AddToolset(dependabot) tsg.AddToolset(secretProtection) - // tsg.AddToolset(notifications) + tsg.AddToolset(notifications) // tsg.AddToolset(experiments) // tsg.AddToolset(discussions) tsg.AddToolset(gists)