helpers/extract_tools.py.dox.md
extract_tools.py helper module.extract_tools.py because this directory is intentionally flat.extract_tools.py owns the runtime implementation.extract_tools.py.dox.md owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.json_parse_dirty(json: str) -> dict[str, Any] | Noneextract_tool_request(content: str) -> dict[str, Any] | Noneis_misformatted_tool_request(content: str) -> boolnormalize_tool_request(tool_request: Any) -> tuple[str, dict]extract_json_root_string(content: str) -> str | Noneextract_json_root_strings(content: str) -> list[str]extract_json_object_string(content)extract_json_string(content)fix_json_string(json_string)tool_name/tool_args, legacy tool/args, native type="function" name/parameters, and a single-item actions wrapper; malformed or multi-action wrappers are rejected.extract_tool_request is the execution boundary: it accepts a request only when the complete trimmed content is one valid tool object. Plain text, ordinary JSON, and tool-shaped JSON embedded in prose remain final text.extract_tool_request rejects content that does not have complete object boundaries before invoking the dirty root scanner. This keeps incomplete streaming prefixes cheap without changing which complete canonical tool objects are accepted.is_misformatted_tool_request identifies a tool request wrapped in a JSON code fence, concatenated complete roots containing tool intent, or a complete Agent Zero envelope that starts with thoughts and whose dirty parser has absorbed headline, tool_name, and tool_args into that list. It routes that output to the existing repair prompt without executing it.extract_tool_request; the permissive root helpers remain available for repair and legacy callers, not tool execution.parallel cannot stop early on the first nested tool_calls item.dirty_json, helpers.modules, re, regex, typing.extract_json_object_string, content.find, DirtyJson, content.rfind, regex.search, re.sub, json.strip, ValueError, tool_name.split, parser.parse, match.group, match.group.replace, DirtyJson.parse_string.tests/test_stream_tool_early_stop.pytests/test_tool_request_normalization.pyNo child DOX files.