MCPcopy
hub / github.com/github/github-mcp-server / ListNotifications

Function ListNotifications

pkg/github/notifications.go:29–163  ·  view source on GitHub ↗

ListNotifications creates a tool to list notifications for the current user.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

27
28// ListNotifications creates a tool to list notifications for the current user.
29func ListNotifications(t translations.TranslationHelperFunc) inventory.ServerTool {
30 return NewTool(
31 ToolsetMetadataNotifications,
32 mcp.Tool{
33 Name: "list_notifications",
34 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."),
35 Annotations: &mcp.ToolAnnotations{
36 Title: t("TOOL_LIST_NOTIFICATIONS_USER_TITLE", "List notifications"),
37 ReadOnlyHint: true,
38 },
39 InputSchema: WithPagination(&jsonschema.Schema{
40 Type: "object",
41 Properties: map[string]*jsonschema.Schema{
42 "filter": {
43 Type: "string",
44 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.",
45 Enum: []any{FilterDefault, FilterIncludeRead, FilterOnlyParticipating},
46 },
47 "since": {
48 Type: "string",
49 Description: "Only show notifications updated after the given time (ISO 8601 format)",
50 },
51 "before": {
52 Type: "string",
53 Description: "Only show notifications updated before the given time (ISO 8601 format)",
54 },
55 "owner": {
56 Type: "string",
57 Description: "Optional repository owner. If provided with repo, only notifications for this repository are listed.",
58 },
59 "repo": {
60 Type: "string",
61 Description: "Optional repository name. If provided with owner, only notifications for this repository are listed.",
62 },
63 },
64 }),
65 },
66 []scopes.Scope{scopes.Notifications},
67 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
68 client, err := deps.GetClient(ctx)
69 if err != nil {
70 return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil
71 }
72
73 filter, err := OptionalParam[string](args, "filter")
74 if err != nil {
75 return utils.NewToolResultError(err.Error()), nil, nil
76 }
77
78 since, err := OptionalParam[string](args, "since")
79 if err != nil {
80 return utils.NewToolResultError(err.Error()), nil, nil
81 }
82
83 before, err := OptionalParam[string](args, "before")
84 if err != nil {
85 return utils.NewToolResultError(err.Error()), nil, nil
86 }

Callers 2

AllToolsFunction · 0.85
Test_ListNotificationsFunction · 0.85

Calls 9

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
NewToolFunction · 0.85
WithPaginationFunction · 0.85
OptionalPaginationParamsFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1

Test_ListNotificationsFunction · 0.68