@@ -26,78 +26,7 @@ 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 ))
9029
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- s .AddTool (MarkNotificationDone (getClient , t ))
98- }
99-
100- >> >> >> > dbdef79 (refactor : update notification functions to use GetClientFn . Fix conflicts )
10130 return s
10231}
10332
@@ -190,26 +119,6 @@ func OptionalParam[T any](r mcp.CallToolRequest, p string) (T, error) {
190119 return r .Params .Arguments [p ].(T ), nil
191120}
192121
193- // OptionalParam is a helper function that can be used to fetch a requested parameter from the request.
194- // It does the following checks:
195- // 1. Checks if the parameter is present in the request, if not, it returns its zero-value
196- // 2. If it is present, it checks if the parameter is of the expected type and returns it
197- func OptionalParam [T any ](r mcp.CallToolRequest , p string ) (T , error ) {
198- var zero T
199-
200- // Check if the parameter is present in the request
201- if _ , ok := r .Params .Arguments [p ]; ! ok {
202- return zero , nil
203- }
204-
205- // Check if the parameter is of the expected type
206- if _ , ok := r .Params .Arguments [p ].(T ); ! ok {
207- return zero , fmt .Errorf ("parameter %s is not of type %T, is %T" , p , zero , r .Params .Arguments [p ])
208- }
209-
210- return r .Params .Arguments [p ].(T ), nil
211- }
212-
213122// OptionalIntParam is a helper function that can be used to fetch a requested parameter from the request.
214123// It does the following checks:
215124// 1. Checks if the parameter is present in the request, if not, it returns its zero-value
0 commit comments