@@ -26,6 +26,77 @@ func NewServer(version string, opts ...server.ServerOption) *server.MCPServer {
2626 version ,
2727 opts ... ,
2828 )
29+ << << << < HEAD
30+ == == == =
31+
32+ // Add GitHub Resources
33+ s .AddResourceTemplate (GetRepositoryResourceContent (getClient , t ))
34+ s .AddResourceTemplate (GetRepositoryResourceBranchContent (getClient , t ))
35+ s .AddResourceTemplate (GetRepositoryResourceCommitContent (getClient , t ))
36+ s .AddResourceTemplate (GetRepositoryResourceTagContent (getClient , t ))
37+ s .AddResourceTemplate (GetRepositoryResourcePrContent (getClient , t ))
38+
39+ // Add GitHub tools - Issues
40+ s .AddTool (GetIssue (getClient , t ))
41+ s .AddTool (SearchIssues (getClient , t ))
42+ s .AddTool (ListIssues (getClient , t ))
43+ s .AddTool (GetIssueComments (getClient , t ))
44+ if ! readOnly {
45+ s .AddTool (CreateIssue (getClient , t ))
46+ s .AddTool (AddIssueComment (getClient , t ))
47+ s .AddTool (UpdateIssue (getClient , t ))
48+ }
49+
50+ // Add GitHub tools - Pull Requests
51+ s .AddTool (GetPullRequest (getClient , t ))
52+ s .AddTool (ListPullRequests (getClient , t ))
53+ s .AddTool (GetPullRequestFiles (getClient , t ))
54+ s .AddTool (GetPullRequestStatus (getClient , t ))
55+ s .AddTool (GetPullRequestComments (getClient , t ))
56+ s .AddTool (GetPullRequestReviews (getClient , t ))
57+ if ! readOnly {
58+ s .AddTool (MergePullRequest (getClient , t ))
59+ s .AddTool (UpdatePullRequestBranch (getClient , t ))
60+ s .AddTool (CreatePullRequestReview (getClient , t ))
61+ s .AddTool (CreatePullRequest (getClient , t ))
62+ s .AddTool (UpdatePullRequest (getClient , t ))
63+ s .AddTool (AddPullRequestReviewComment (getClient , t ))
64+ }
65+
66+ // Add GitHub tools - Repositories
67+ s .AddTool (SearchRepositories (getClient , t ))
68+ s .AddTool (GetFileContents (getClient , t ))
69+ s .AddTool (GetCommit (getClient , t ))
70+ s .AddTool (ListCommits (getClient , t ))
71+ s .AddTool (ListBranches (getClient , t ))
72+ if ! readOnly {
73+ s .AddTool (CreateOrUpdateFile (getClient , t ))
74+ s .AddTool (CreateRepository (getClient , t ))
75+ s .AddTool (ForkRepository (getClient , t ))
76+ s .AddTool (CreateBranch (getClient , t ))
77+ s .AddTool (PushFiles (getClient , t ))
78+ }
79+
80+ // Add GitHub tools - Search
81+ s .AddTool (SearchCode (getClient , t ))
82+ s .AddTool (SearchUsers (getClient , t ))
83+
84+ // Add GitHub tools - Users
85+ s .AddTool (GetMe (getClient , t ))
86+
87+ // Add GitHub tools - Code Scanning
88+ s .AddTool (GetCodeScanningAlert (getClient , t ))
89+ s .AddTool (ListCodeScanningAlerts (getClient , t ))
90+
91+ // Add GitHub tools - Notifications
92+ s .AddTool (GetNotifications (getClient , t ))
93+ s .AddTool (GetNotificationThread (getClient , t ))
94+ if ! readOnly {
95+ s .AddTool (MarkNotificationRead (getClient , t ))
96+ s .AddTool (MarkAllNotificationsRead (getClient , t ))
97+ }
98+
99+ >> >> >> > dbdef79 (refactor : update notification functions to use GetClientFn . Fix conflicts )
29100 return s
30101}
31102
@@ -163,6 +234,47 @@ func OptionalIntParamWithDefault(r mcp.CallToolRequest, p string, d int) (int, e
163234 return v , nil
164235}
165236
237+ // OptionalBoolParamWithDefault is a helper function that can be used to fetch a requested parameter from the request
238+ // similar to optionalParam, but it also takes a default value.
239+ func OptionalBoolParamWithDefault (r mcp.CallToolRequest , p string , d bool ) (bool , error ) {
240+ v , err := OptionalParam [bool ](r , p )
241+ if err != nil {
242+ return false , err
243+ }
244+ if v == false {
245+ return d , nil
246+ }
247+ return v , nil
248+ }
249+
250+ // OptionalStringParam is a helper function that can be used to fetch a requested parameter from the request.
251+ // It does the following checks:
252+ // 1. Checks if the parameter is present in the request, if not, it returns its zero-value
253+ // 2. If it is present, it checks if the parameter is of the expected type and returns it
254+ func OptionalStringParam (r mcp.CallToolRequest , p string ) (string , error ) {
255+ v , err := OptionalParam [string ](r , p )
256+ if err != nil {
257+ return "" , err
258+ }
259+ if v == "" {
260+ return "" , nil
261+ }
262+ return v , nil
263+ }
264+
265+ // OptionalStringParamWithDefault is a helper function that can be used to fetch a requested parameter from the request
266+ // similar to optionalParam, but it also takes a default value.
267+ func OptionalStringParamWithDefault (r mcp.CallToolRequest , p string , d string ) (string , error ) {
268+ v , err := OptionalParam [string ](r , p )
269+ if err != nil {
270+ return "" , err
271+ }
272+ if v == "" {
273+ return d , nil
274+ }
275+ return v , nil
276+ }
277+
166278// OptionalStringArrayParam is a helper function that can be used to fetch a requested parameter from the request.
167279// It does the following checks:
168280// 1. Checks if the parameter is present in the request, if not, it returns its zero-value
0 commit comments