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

feat: Enhance GitHub issue creation with improved label handling and error logging #716

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

Conversation

sirkitree
Copy link
Contributor

Resolves #715

  • Update CreateIssueOptionsSchema to support label objects with name and description
  • Add robust error logging in createIssue function
  • Improve label processing to handle both string and object label formats
  • Add detailed error reporting for GitHub API and request handler errors

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

  • Server: github
  • Changes to: tools (create_issue functionality)

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

  • 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

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.

…error logging

Resolves modelcontextprotocol#715

- Update CreateIssueOptionsSchema to support label objects with name and description
- Add robust error logging in createIssue function
- Improve label processing to handle both string and object label formats
- Add detailed error reporting for GitHub API and request handler errors
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.

Fix GitHub MCP server label handling for create_issue
1 participant