Fix JSON string parsing for UUID tool arguments
Closed
LI
3mo ago+43+43+01234567890123456789-2-2-0123456789
Fixes #1873.
Motivation and Context
This fixes JSON string pre-parsing for non-string tool argument annotations such as UUID.
Previously, pre_parse_json() skipped all JSON values parsed into primitive types, including strings. This preserved string-like annotations correctly, but caused non-string annotations such as UUID to receive the original JSON-encoded string with surrounding quotes.
How Has This Been Tested?
env -u PYTHONHOME -u PYTHONPATH uv run pytest tests/server/mcpserver/test_func_metadata.py
env -u PYTHONHOME -u PYTHONPATH uv run ruff check src/mcp/server/mcpserver/utilities/func_metadata.py tests/server/mcpserver/test_func_metadata.py
env -u PYTHONHOME -u PYTHONPATH uv run pyright src/mcp/server/mcpserver/utilities/func_metadata.py tests/server/mcpserver/test_func_metadata.py
Breaking Changes
None.
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist
- I have disclosed AI assistance and can explain the change in my own words
- I have read the MCP Documentation
- My code follows the repository's style guidelines
- New and existing tests pass locally