Skip to main content
Utility functions for parsing MCP tool calls from model output.

extract_tool_calls_from_text

Extract tool call dictionaries from raw text output.

_collect_tool_calls

Collect valid tool call dictionaries from parsed payloads.

_try_parse_json_like

Parse a JSON or JSON-like snippet into Python data.

_find_json_candidate

Locate a balanced JSON-like segment starting at __INLINE_CODE_0__.

_truncate_snippet

Return a truncated representation suitable for logging.