feat: standardise GitHub API functions return types and improve error handling#73
Merged
feat: standardise GitHub API functions return types and improve error handling#73
Conversation
Contributor
There was a problem hiding this comment.
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
strtoDict[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
Owner
Author
|
/code pr |
saidsef
commented
Jul 22, 2025
Owner
Author
saidsef
left a comment
There was a problem hiding this comment.
🤖
- 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces significant improvements to the GitHub PR/issue analyzer functions:
Key Changes:
Benefits:
Related PR: modelcontextprotocol/python-sdk#993
resolves: #74