Skip to content

Fix handling nil values for optional string array parameters, #194

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

A-Georgiou
Copy link
Contributor

@A-Georgiou A-Georgiou commented Apr 9, 2025

When attempting to use Claude for MCP tooling, any optional arrays it currently submits a nil value instead of an empty array which results in a returned error. This change adjusts that to return an empty array instead of an error for nil optional arrays.

Closes: #193

nil values should be equivalent to an empty string, currently we return an error but Claude passes nil for optional values.
@Copilot Copilot AI review requested due to automatic review settings April 9, 2025 13:20
Copy link
Contributor

@Copilot Copilot AI left a 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 fixes the handling of nil optional string array parameters by returning an empty array instead of an error.

  • Updated the parameter parsing in pkg/github/server.go to treat nil values as an empty array.
  • Added a test in pkg/github/issues_test.go to verify that nil inputs no longer cause failures.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/github/server.go Added a nil case in the switch to return an empty array.
pkg/github/issues_test.go Added a test case for nil assignees to validate behavior.

Copy link
Contributor

@tonytrg tonytrg left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you 💯

@tonytrg tonytrg merged commit 86fbc85 into main Apr 9, 2025
16 checks passed
@tonytrg tonytrg deleted the FixNilOptionalValues branch April 9, 2025 16:26
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this pull request Apr 12, 2025
…#194)

* Fix handling nil values for optional string array parameters,

nil values should be equivalent to an empty string, currently we return an error but Claude passes nil for optional values.

* lint fixes
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.

Nil values for optional arrays returns error
2 participants