Attempt to fix common array schema issues. Returns: Fixed parameters schema
(parameters: dict[str, Any])
| 122 | |
| 123 | @staticmethod |
| 124 | def fix_array_schemas(parameters: dict[str, Any]) -> dict[str, Any]: |
| 125 | """ |
| 126 | Attempt to fix common array schema issues. |
| 127 | |
| 128 | Returns: |
| 129 | Fixed parameters schema |
| 130 | """ |
| 131 | # parameters is already typed as Dict, no need to check |
| 132 | # if not isinstance(parameters, dict): |
| 133 | # return parameters |
| 134 | |
| 135 | fixed = json.loads(json.dumps(parameters)) # Deep copy |
| 136 | ToolSchemaValidator._fix_array_schemas_recursive(fixed) |
| 137 | return cast(dict[str, Any], fixed) |
| 138 | |
| 139 | @staticmethod |
| 140 | def _fix_array_schemas_recursive(obj: Any) -> None: |