-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: standardise GitHub API functions return types and improve error handling #73
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR standardizes the return types of multiple async functions in the GitHub issues/PR analyzer from string-based returns to structured dictionary returns. The primary goal is to improve API consistency and enable better programmatic handling of responses by providing status information alongside messages.
- Changes function return type annotations from
str
toDict[str, Any]
- Updates function implementations to return structured dictionaries with "status" and "message" keys
- Standardizes logging format to use structured dictionaries instead of formatted strings
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
- mcp now supports structured outputs - modelcontextprotocol/python-sdk#993
/code pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖
- Good practice changing returns to dicts with status and messages for consistency.
- In get_github_pr_diff: consider returning pr_diff actual content, currently returns strified pr_diff in success dict which may limit usability.
- In get_github_pr_content: correctly return pr_info dict on success, no stringification needed.
- Update logging calls to use dicts with status and message improves log clarity.
- In update_github_pr_description and others: good to capture and return error messages as dict.
- In list_github_issues_prs: ensure "issue" param is well documented and validated ('pr' or 'issue') to avoid misusage.
- In create_github_issue and update_github_issue, labels argument kept as list[str]; confirm this matches self.gi methods signature.
- In get_ipv4_ipv6_info: combines ipv6 inside ipv4 dict under 'ipv6' key, cleanly done.
- Across: consider minor consistency in log message formats, e.g. "No changes..." logs as 'error' may be better as 'info' or 'warning' depending on intent.
- Consider adding type hints imports for Dict, Any or use what’s standard for this file.
- No visible errors flagged on modified lines, tidy and structured code improvements.
> gpt-4.1-mini [pr | 3]
This PR introduces significant improvements to the GitHub PR/issue analyzer functions:
Key Changes:
Benefits:
Related PR: modelcontextprotocol/python-sdk#993
resolves: #74