diff --git a/src/tools/builtin/http.rs b/src/tools/builtin/http.rs index cfe3fd54..88a19fec 100644 --- a/src/tools/builtin/http.rs +++ b/src/tools/builtin/http.rs @@ -231,8 +231,7 @@ impl Tool for HttpTool { } }, "body": { - "type": ["object", "array", "string", "number", "boolean", "null"], - "description": "Request body (for POST/PUT/PATCH)" + "description": "Request body (for POST/PUT/PATCH). Can be a JSON object, array, string, or other value." }, "timeout_secs": { "type": "integer", @@ -561,16 +560,19 @@ mod tests { } #[test] - fn test_http_tool_schema_body_has_type() { + fn test_http_tool_schema_body_is_freeform() { let schema = HttpTool::new().parameters_schema(); let body = schema .get("properties") .and_then(|p| p.get("body")) .expect("body schema missing"); + // Body is intentionally freeform (no "type" constraint) for OpenAI + // compatibility. OpenAI rejects union types containing "array" unless + // "items" is also specified, and body accepts any JSON value. assert!( - body.get("type").is_some(), - "body schema must include a type for OpenAI-compatible tool validation" + body.get("type").is_none(), + "body schema should not have a 'type' to be freeform for OpenAI compatibility" ); } diff --git a/src/tools/builtin/json.rs b/src/tools/builtin/json.rs index 5c077ee7..cf4c7f82 100644 --- a/src/tools/builtin/json.rs +++ b/src/tools/builtin/json.rs @@ -28,8 +28,7 @@ impl Tool for JsonTool { "description": "The JSON operation to perform" }, "data": { - "type": ["string", "object", "array", "number", "boolean", "null"], - "description": "JSON input data. Pass a string for parse, any type otherwise." + "description": "JSON input data. Pass a string for parse, or any JSON value (object, array, string, number, boolean, null) otherwise." }, "path": { "type": "string", @@ -192,16 +191,19 @@ mod tests { } #[test] - fn test_json_tool_schema_data_has_type() { + fn test_json_tool_schema_data_is_freeform() { let schema = JsonTool.parameters_schema(); let data = schema .get("properties") .and_then(|p| p.get("data")) .expect("data schema missing"); + // Data is intentionally freeform (no "type" constraint) for OpenAI + // compatibility. OpenAI rejects union types containing "array" unless + // "items" is also specified. assert!( - data.get("type").is_some(), - "data schema must include a type for OpenAI-compatible tool validation" + data.get("type").is_none(), + "data schema should not have a 'type' to be freeform for OpenAI compatibility" ); } }