unity-mcp/Server/src
whatevertogo 4991d71eab
Fix: Fix vector and color parameter validation to accept JSON string inputs (#625)
* fix: change vector/color parameter types to Any to allow string inputs
* fix: add type check in manage_component to pass cursor error

The Pydantic validation in FastMCP occurs before function execution,
causing validation errors when clients pass string values like '[2, 2, 2]'
for parameters typed as `list[float] | str`. Since the code already has
normalization functions (_normalize_vector, _normalize_color) that handle
string inputs, change the type annotations to `Any` to bypass Pydantic's
strict validation.

Affected parameters:
- manage_gameobject: position, rotation, scale, offset
- manage_material: color

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: improve vector parameter validation with clear error messages

- Change parameter types from `list[float]` to `list[float] | str` to accept
  both list and JSON string inputs (consistent with read_console/run_tests)
- Modify _normalize_vector to return (value, error_message) tuple instead of
  silently returning None on invalid input
- Add detailed error messages for invalid vector values

This fixes the Pydantic validation error when clients pass string values
like "[2, 2, 2]" for scale/position/rotation parameters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Loosen the type to pass the cursor error

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com>
2026-01-26 20:35:41 -05:00
..
cli Update for CLI (#636) 2026-01-26 19:31:19 -05:00
core Publish to pypi (#466) 2025-12-19 16:43:44 -04:00
models HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
services Fix: Fix vector and color parameter validation to accept JSON string inputs (#625) 2026-01-26 20:35:41 -05:00
transport Add CLI (#606) 2026-01-21 20:53:13 -04:00
utils Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
__init__.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
main.py Update for CLI (#636) 2026-01-26 19:31:19 -05:00