Merged
Conversation
Some models (e.g. OpenAI gpt-5.2-pro) send explicit null for optional parameters, but MCP servers like gopls reject them because null is not a valid value for the declared parameter type (e.g. string). Strip nil values from the arguments map before forwarding to the MCP server, since omitting the key is semantically equivalent for optional params. Assisted-By: cagent
There was a problem hiding this comment.
Review Summary
✅ No bugs found in the changed code.
This PR correctly addresses the issue where some LLM models (like gpt-5.2-pro) send explicit null values for optional parameters that MCP servers reject.
Key Changes Reviewed:
-
Null-stripping logic (mcp.go:224-230): The code safely removes null values from the arguments map before forwarding to the MCP server. Deleting from a map during iteration is explicitly safe in Go.
-
Test coverage (mcp_test.go): Comprehensive test cases verify that:
- All null values are stripped
- Only null values are stripped (non-null values preserved)
- Empty arguments remain empty
The implementation is sound, well-tested, and follows Go idioms correctly.
trungutt
approved these changes
Feb 11, 2026
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.
Some models (e.g. OpenAI gpt-5.2-pro) send explicit null for optional parameters, but MCP servers like gopls reject them because null is not a valid value for the declared parameter type (e.g. string). Strip nil values from the arguments map before forwarding to the MCP server, since omitting the key is semantically equivalent for optional params.
Assisted-By: cagent