@@ -204,7 +204,7 @@ func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool)
204204 }
205205 tool , _ = sjson .Set (tool , "name" , name )
206206 }
207- tool , _ = sjson .SetRaw (tool , "parameters" , toolResult .Get ("input_schema" ).Raw )
207+ tool , _ = sjson .SetRaw (tool , "parameters" , normalizeToolParameters ( toolResult .Get ("input_schema" ).Raw ) )
208208 tool , _ = sjson .Delete (tool , "input_schema" )
209209 tool , _ = sjson .Delete (tool , "parameters.$schema" )
210210 tool , _ = sjson .Set (tool , "strict" , false )
@@ -334,3 +334,22 @@ func buildReverseMapFromClaudeOriginalToShort(original []byte) map[string]string
334334 }
335335 return m
336336}
337+
338+ // normalizeToolParameters ensures object schemas contain at least an empty properties map.
339+ func normalizeToolParameters (raw string ) string {
340+ raw = strings .TrimSpace (raw )
341+ if raw == "" || raw == "null" || ! gjson .Valid (raw ) {
342+ return `{"type":"object","properties":{}}`
343+ }
344+ schema := raw
345+ result := gjson .Parse (raw )
346+ schemaType := result .Get ("type" ).String ()
347+ if schemaType == "" {
348+ schema , _ = sjson .Set (schema , "type" , "object" )
349+ schemaType = "object"
350+ }
351+ if schemaType == "object" && ! result .Get ("properties" ).Exists () {
352+ schema , _ = sjson .SetRaw (schema , "properties" , `{}` )
353+ }
354+ return schema
355+ }
0 commit comments