Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] feat(github): add code for listing/reviewing/getting PRs on Github #308

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0xRaduan
Copy link
Contributor

Description

Adding functionality to List, Review and Get info on Github PRs.

Pending adding functionality to get PR diffs(right now it's not returned). Will mark as ready once finishing that.

Server Details

  • Server: github
  • Changes to: tools

Motivation and Context

Thought of adding functionality to review and list PRs on private/public repos on Github.

How Has This Been Tested?

Verified manually via Claude Desktop.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

n/a

Copy link
Contributor Author

@0xRaduan 0xRaduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick self-review / todos:

@@ -706,7 +709,7 @@ async function getIssue(
"User-Agent": "github-mcp-server",
},
}
);
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove

@@ -299,7 +299,7 @@ export const GitHubPullRequestSchema = z.object({
locked: z.boolean(),
title: z.string(),
user: GitHubIssueAssigneeSchema,
body: z.string(),
body: z.string().nullable(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started noticing that body can be nullable across multiple schemas on LIST api requests for GitHub API. JFYI.

Comment on lines +717 to +722
export const GetPullRequestDiffSchema = z.object({
owner: z.string().describe("Repository owner (username or organization)"),
repo: z.string().describe("Repository name"),
pull_number: z.number().describe("Pull request number"),
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not finished yet.

Comment on lines +1167 to +1172
case "get_pull_request_diff": {
const args = GetPullRequestDiffSchema.parse(request.params.arguments);
const diff = await getPullRequestDiff(args.owner, args.repo, args.pull_number);
return { toolResult: diff };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not finished/tested yet.

export type ReviewPullRequest = z.infer<typeof ReviewPullRequestSchema>;
export type SearchCode = z.infer<typeof SearchCodeSchema>;
export type SearchIssues = z.infer<typeof SearchIssuesSchema>;
export type SearchUsers = z.infer<typeof SearchUsersSchema>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add line to the end

Comment on lines +763 to +764
export type SearchCode = z.infer<typeof SearchCodeSchema>;
export type SearchIssues = z.infer<typeof SearchIssuesSchema>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if those types are actually used, todo: verify

@jspahrsummers jspahrsummers marked this pull request as draft December 13, 2024 16:43
@jspahrsummers
Copy link
Member

Thanks! Converting this to a draft to make its status clear. Please mark as "ready for review" when you'd like us to take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants