From 23e1c6f9d1013d8d0a4d6b868f0cf63c62f60686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Gla=CC=88ser?= Date: Sun, 27 Sep 2026 08:50:20 +0200 Subject: [PATCH] Fix MCP schema test --- scripts/tests/market_management_mcp_tools_list_test.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/tests/market_management_mcp_tools_list_test.php b/scripts/tests/market_management_mcp_tools_list_test.php index 4f30674..6e416a7 100644 --- a/scripts/tests/market_management_mcp_tools_list_test.php +++ b/scripts/tests/market_management_mcp_tools_list_test.php @@ -19,7 +19,7 @@ function assert_test(bool $condition, string $message): void function assert_schema_objects(array $schema, string $path = 'inputSchema'): void { assert_test(($schema['type'] ?? null) === 'object', $path . '.type must be object'); - assert_test(isset($schema['properties']) && is_object($schema['properties']), $path . '.properties must be an object'); + assert_test(isset($schema['properties']) && (is_array($schema['properties']) || is_object($schema['properties'])), $path . '.properties must be an object-compatible map'); if (isset($schema['required'])) { assert_test(is_array($schema['required']), $path . '.required must be an array'); @@ -28,7 +28,10 @@ function assert_schema_objects(array $schema, string $path = 'inputSchema'): voi } } - foreach (get_object_vars($schema['properties']) as $propertyName => $propertySchema) { + $properties = is_object($schema['properties']) + ? get_object_vars($schema['properties']) + : $schema['properties']; + foreach ($properties as $propertyName => $propertySchema) { assert_test(is_array($propertySchema), $path . '.properties.' . $propertyName . ' must be an object schema'); if (($propertySchema['type'] ?? null) === 'array' && isset($propertySchema['items'])) { assert_test(is_array($propertySchema['items']), $path . '.properties.' . $propertyName . '.items must be an object schema');