Files
crewAI/lib/crewai/tests
Devin AI c7aaf23a6f fix: handle recursive MCP schemas in sanitization and model creation (#5490)
Two issues remained after the cyclic-schema fix in #5478:

1. resolve_refs() silently degraded recursive $ref pointers to {},
   causing sanitize_tool_params_for_anthropic_strict (and the OpenAI
   variant) to produce children.items == {} for tree-shaped schemas.
   Fix: return a type-preserving stub ({"type": "object"}) instead
   of an empty dict when a circular reference is detected.

2. create_model_from_schema() called jsonref.replace_refs() which
   throws JsonRefError on circular $ref graphs. Fix: catch the error
   and fall back to _inline_top_level_ref(), which manually resolves
   the top-level $ref while preserving $defs for inner resolution.
   The existing in_progress cycle detection in _build_model_from_schema
   then handles recursive references via ForwardRef.

Tests added for both paths, including mutual-recursion scenarios.

Co-Authored-By: João <joao@crewai.com>
2026-04-16 08:34:48 +00:00
..
2025-10-20 14:10:19 -07:00
2025-12-04 16:53:19 -05:00
2025-10-20 14:10:19 -07:00
2026-03-24 19:03:35 +08:00
2026-02-13 21:34:37 -03:00
2025-12-04 13:34:29 -08:00
2025-10-20 14:10:19 -07:00
2025-12-01 18:56:56 -05:00
2025-10-20 14:10:19 -07:00
2025-10-20 14:10:19 -07:00