(value)
| 60 | except Exception: # noqa: BLE001, S110 — progress reporting is best-effort |
| 61 | pass |
| 62 | |
| 63 | |
| 64 | def _coerce_json_arg(value): |
| 65 | # Some MCP/CLI bridges emit list/int tool args as JSON-encoded strings |
| 66 | # (e.g. ``"[1, 50]"`` instead of ``[1, 50]``). Parity with the |
| 67 | # pydantic-ai tool path; see _coerce_json_string in str_replace_editor.py. |
| 68 | if isinstance(value, str): |
| 69 | try: |
| 70 | return json.loads(value) |
| 71 | except ValueError: |
| 72 | pass |
| 73 | return value |
| 74 |