feat: Enhance GitHub issue creation with improved label handling and error logging #716
+44
−6
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.
Resolves #715
Description
This PR fixes an issue with the GitHub MCP server where the labels parameter in the create_issue tool wasn't properly handling the different formats accepted by GitHub's API. The GitHub API allows labels to be specified as either an array of strings or an array of objects with name and description properties. The MCP server was only handling the string format, causing issues when label objects were provided.
Server Details
Motivation and Context
GitHub's API accepts labels in multiple formats, but our MCP server was only handling string labels. This caused errors when attempting to create issues with structured label objects. This change ensures compatibility with all GitHub API label formats while maintaining a clean interface for MCP clients.
How Has This Been Tested?
Tested by creating GitHub issues with both string labels and object labels through the MCP interface. Verified that both formats are correctly processed and issues are created with the specified labels.
Breaking Changes
No breaking changes. This is a backward-compatible enhancement that still accepts the existing input format (arrays of strings) while adding support for the object format.
Types of changes
Checklist
Additional context
The fix involves modifying the schema validation to properly handle both label formats and ensuring the GitHub API receives properly formatted data. Additional logging was added to help diagnose any future issues with label formatting.