@@ -149,6 +149,51 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
149
149
name : "get_issue" ,
150
150
description : "Get details of a specific issue in a GitHub repository." ,
151
151
inputSchema : zodToJsonSchema ( issues . GetIssueSchema )
152
+ } ,
153
+ {
154
+ name : "get_pull_request" ,
155
+ description : "Get details of a specific pull request" ,
156
+ inputSchema : zodToJsonSchema ( pulls . GetPullRequestSchema )
157
+ } ,
158
+ {
159
+ name : "list_pull_requests" ,
160
+ description : "List and filter repository pull requests" ,
161
+ inputSchema : zodToJsonSchema ( pulls . ListPullRequestsSchema )
162
+ } ,
163
+ {
164
+ name : "create_pull_request_review" ,
165
+ description : "Create a review on a pull request" ,
166
+ inputSchema : zodToJsonSchema ( pulls . CreatePullRequestReviewSchema )
167
+ } ,
168
+ {
169
+ name : "merge_pull_request" ,
170
+ description : "Merge a pull request" ,
171
+ inputSchema : zodToJsonSchema ( pulls . MergePullRequestSchema )
172
+ } ,
173
+ {
174
+ name : "get_pull_request_files" ,
175
+ description : "Get the list of files changed in a pull request" ,
176
+ inputSchema : zodToJsonSchema ( pulls . GetPullRequestFilesSchema )
177
+ } ,
178
+ {
179
+ name : "get_pull_request_status" ,
180
+ description : "Get the combined status of all status checks for a pull request" ,
181
+ inputSchema : zodToJsonSchema ( pulls . GetPullRequestStatusSchema )
182
+ } ,
183
+ {
184
+ name : "update_pull_request_branch" ,
185
+ description : "Update a pull request branch with the latest changes from the base branch" ,
186
+ inputSchema : zodToJsonSchema ( pulls . UpdatePullRequestBranchSchema )
187
+ } ,
188
+ {
189
+ name : "get_pull_request_comments" ,
190
+ description : "Get the review comments on a pull request" ,
191
+ inputSchema : zodToJsonSchema ( pulls . GetPullRequestCommentsSchema )
192
+ } ,
193
+ {
194
+ name : "get_pull_request_reviews" ,
195
+ description : "Get the reviews on a pull request" ,
196
+ inputSchema : zodToJsonSchema ( pulls . GetPullRequestReviewsSchema )
152
197
}
153
198
] ,
154
199
} ;
@@ -335,6 +380,82 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
335
380
} ;
336
381
}
337
382
383
+ case "get_pull_request" : {
384
+ const args = pulls . GetPullRequestSchema . parse ( request . params . arguments ) ;
385
+ const pullRequest = await pulls . getPullRequest ( args . owner , args . repo , args . pull_number ) ;
386
+ return {
387
+ content : [ { type : "text" , text : JSON . stringify ( pullRequest , null , 2 ) } ] ,
388
+ } ;
389
+ }
390
+
391
+ case "list_pull_requests" : {
392
+ const args = pulls . ListPullRequestsSchema . parse ( request . params . arguments ) ;
393
+ const { owner, repo, ...options } = args ;
394
+ const pullRequests = await pulls . listPullRequests ( owner , repo , options ) ;
395
+ return {
396
+ content : [ { type : "text" , text : JSON . stringify ( pullRequests , null , 2 ) } ] ,
397
+ } ;
398
+ }
399
+
400
+ case "create_pull_request_review" : {
401
+ const args = pulls . CreatePullRequestReviewSchema . parse ( request . params . arguments ) ;
402
+ const { owner, repo, pull_number, ...options } = args ;
403
+ const review = await pulls . createPullRequestReview ( owner , repo , pull_number , options ) ;
404
+ return {
405
+ content : [ { type : "text" , text : JSON . stringify ( review , null , 2 ) } ] ,
406
+ } ;
407
+ }
408
+
409
+ case "merge_pull_request" : {
410
+ const args = pulls . MergePullRequestSchema . parse ( request . params . arguments ) ;
411
+ const { owner, repo, pull_number, ...options } = args ;
412
+ const result = await pulls . mergePullRequest ( owner , repo , pull_number , options ) ;
413
+ return {
414
+ content : [ { type : "text" , text : JSON . stringify ( result , null , 2 ) } ] ,
415
+ } ;
416
+ }
417
+
418
+ case "get_pull_request_files" : {
419
+ const args = pulls . GetPullRequestFilesSchema . parse ( request . params . arguments ) ;
420
+ const files = await pulls . getPullRequestFiles ( args . owner , args . repo , args . pull_number ) ;
421
+ return {
422
+ content : [ { type : "text" , text : JSON . stringify ( files , null , 2 ) } ] ,
423
+ } ;
424
+ }
425
+
426
+ case "get_pull_request_status" : {
427
+ const args = pulls . GetPullRequestStatusSchema . parse ( request . params . arguments ) ;
428
+ const status = await pulls . getPullRequestStatus ( args . owner , args . repo , args . pull_number ) ;
429
+ return {
430
+ content : [ { type : "text" , text : JSON . stringify ( status , null , 2 ) } ] ,
431
+ } ;
432
+ }
433
+
434
+ case "update_pull_request_branch" : {
435
+ const args = pulls . UpdatePullRequestBranchSchema . parse ( request . params . arguments ) ;
436
+ const { owner, repo, pull_number, expected_head_sha } = args ;
437
+ await pulls . updatePullRequestBranch ( owner , repo , pull_number , expected_head_sha ) ;
438
+ return {
439
+ content : [ { type : "text" , text : JSON . stringify ( { success : true } , null , 2 ) } ] ,
440
+ } ;
441
+ }
442
+
443
+ case "get_pull_request_comments" : {
444
+ const args = pulls . GetPullRequestCommentsSchema . parse ( request . params . arguments ) ;
445
+ const comments = await pulls . getPullRequestComments ( args . owner , args . repo , args . pull_number ) ;
446
+ return {
447
+ content : [ { type : "text" , text : JSON . stringify ( comments , null , 2 ) } ] ,
448
+ } ;
449
+ }
450
+
451
+ case "get_pull_request_reviews" : {
452
+ const args = pulls . GetPullRequestReviewsSchema . parse ( request . params . arguments ) ;
453
+ const reviews = await pulls . getPullRequestReviews ( args . owner , args . repo , args . pull_number ) ;
454
+ return {
455
+ content : [ { type : "text" , text : JSON . stringify ( reviews , null , 2 ) } ] ,
456
+ } ;
457
+ }
458
+
338
459
default :
339
460
throw new Error ( `Unknown tool: ${ request . params . name } ` ) ;
340
461
}
0 commit comments