MCP schema conversion collapses array items.oneOf(object) to string[]
Open 💬 2 comments Opened May 1, 2026 by attila-kun
Summary
Codex appears to lose MCP tool input schema fidelity when an array's items schema is expressed via oneOf.
In practice, this causes object-array parameters from MCP tools to be exposed to the model as string[] instead of an array of structured objects.
Expected behavior
Given a schema like:
{
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"id": { "type": "string" }
},
"required": ["id"]
}
]
}
}
Codex should preserve the nested union/object shape, or at least normalize it to an equivalent supported union form.
Actual behavior
Codex parses the items schema as string, which effectively turns the overall parameter type into string[].
Minimal repro
I added a failing regression test on my fork here:
https://github.com/attila-kun/codex/commit/86258a13e12873823d072d977d1aabdcc73eb328
The test is:
json_schema::tests::parse_tool_input_schema_preserves_array_item_one_of_object_shape
Run:
cd codex-rs
cargo test -p codex-tools parse_tool_input_schema_preserves_array_item_one_of_object_shape
Failing output
running 1 test
test json_schema::tests::parse_tool_input_schema_preserves_array_item_one_of_object_shape ... FAILED
Diff < left / right > :
JsonSchema {
schema_type: Some(
Single(
Array,
),
),
...
items: Some(
JsonSchema {
< schema_type: Some(
< Single(
< String,
< ),
< ),
> schema_type: None,
...
< any_of: None,
> any_of: Some(
> [
> JsonSchema {
> schema_type: Some(
> Single(
> Object,
> ),
> ),
> ...
> },
> ],
> ),
},
),
...
}This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗