|
41 | 41 | assert_equals(registeredTool.description, "Search the web", "Tool description matches registered tool"); |
42 | 42 |
|
43 | 43 | assert_true(!!registeredTool.inputSchema, "inputSchema should be non-empty"); |
44 | | - const schema = JSON.parse(registeredTool.inputSchema); |
45 | | - |
46 | | - assert_equals(schema.type, "object", "Schema should be an object"); |
| 44 | + assert_equals(registeredTool.inputSchema.type, "object", "Schema should be an object"); |
47 | 45 |
|
48 | 46 | // 'query' property validation (required string) |
49 | | - assert_true("query" in schema.properties, "Schema should contain 'query' property"); |
50 | | - assert_equals(schema.properties.query.type, "string", "Query property type should be string"); |
51 | | - assert_equals(schema.properties.query.description, "The search query", "Query property description is correct"); |
52 | | - assert_array_equals(schema.required, ["query"], "Query should be a required property"); |
| 47 | + assert_true("query" in registeredTool.inputSchema.properties, "Schema should contain 'query' property"); |
| 48 | + assert_equals(registeredTool.inputSchema.properties.query.type, "string", "Query property type should be string"); |
| 49 | + assert_equals(registeredTool.inputSchema.properties.query.description, "The search query", "Query property description is correct"); |
| 50 | + assert_array_equals(registeredTool.inputSchema.required, ["query"], "Query should be a required property"); |
53 | 51 |
|
54 | 52 | // 'limit' property validation (optional number) |
55 | | - assert_true("limit" in schema.properties, "Schema should contain 'limit' property"); |
56 | | - assert_equals(schema.properties.limit.type, "number", "Limit property type should be number"); |
57 | | - assert_equals(schema.properties.limit.description, "Max results count", "Limit property description is correct"); |
| 53 | + assert_true("limit" in registeredTool.inputSchema.properties, "Schema should contain 'limit' property"); |
| 54 | + assert_equals(registeredTool.inputSchema.properties.limit.type, "number", "Limit property type should be number"); |
| 55 | + assert_equals(registeredTool.inputSchema.properties.limit.description, "Max results count", "Limit property description is correct"); |
58 | 56 |
|
59 | 57 | // 'safe_search' property validation (optional boolean) |
60 | | - assert_true("safe_search" in schema.properties, "Schema should contain 'safe_search' property"); |
61 | | - assert_equals(schema.properties.safe_search.type, "boolean", "safe_search property type should be boolean"); |
62 | | - assert_equals(schema.properties.safe_search.description, "Enable safe search filtering", "safe_search property description is correct"); |
| 58 | + assert_true("safe_search" in registeredTool.inputSchema.properties, "Schema should contain 'safe_search' property"); |
| 59 | + assert_equals(registeredTool.inputSchema.properties.safe_search.type, "boolean", "safe_search property type should be boolean"); |
| 60 | + assert_equals(registeredTool.inputSchema.properties.safe_search.description, "Enable safe search filtering", "safe_search property description is correct"); |
63 | 61 | }, "Test that getTools() returns the correct inputSchema for an imperative tool"); |
64 | 62 | </script> |
65 | 63 | </body> |
0 commit comments