Commit Graph

2 Commits

Author SHA1 Message Date
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
Lucas Gomide
d259150d8d Enhance MCP tool resolution and related events (#4580)
* feat: enhance MCP tool resolution

* feat: emit event when MCP configuration fails

* feat: emit event when MCP tool execution has failed

* style: resolve linter issues

* refactor: use clear and natural mcp tool name resolution

* test: fix broken tests

* fix: resolve MCP connection leaks, slug validation, duplicate connections, and httpx exception handling

---------

Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
Co-authored-by: Greyson LaLonde <greyson@crewai.com>
2026-02-26 13:59:30 -08:00