MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _coerce_json_arg

Function _coerce_json_arg

codewiki/src/be/caw_toolkit.py:62–71  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

60 except Exception: # noqa: BLE001, S110 — progress reporting is best-effort
61 pass
62
63
64def _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

Callers 1

str_replace_editorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected