continuedev / continuedev/continue
Agent tool calls fail when OpenAI-compatible models return XML-like function.arguments
@RomneyDa is already working on this.
Since Mar 15, 2026.
- Dominant language
- TypeScript
- Stars
- 36k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Summary
OpenAI-compatible chat models can return tool_calls[].function.arguments as XML-like payloads (e.g. <tool_call><function=...><parameter=...>). Continue currently assumes JSON-only arguments in multiple paths, which causes tool-call parsing/execution failures in Agent mode (seen as malformed fragmented tool calls and downstream index/list errors).
Reproduction
- Configure Continue model with OpenAI-compatible endpoint using a model that emits XML-like args (example: local Qwen OpenAI-compatible endpoint).
- Send a tool-heavy request (e.g., deep-dive / repository exploration).
- Observe returned tool call shape from model:
tool_calls[].function.name = "ls"tool_calls[].function.arguments = "<tool_call>...<parameter=dirPath>src</parameter>..."
- Agent flow fails to parse/execute correctly because JSON parse returns
{}.
Direct API sample observed
function.arguments returned by model:
<tool_call>
<function=ls>
<parameter=dirPath>
src
</parameter>
<parameter=recursive>
True
</parameter>
</function>
</tool_call>
Root cause
Argument parsing assumes JSON-only payloads in shared and streaming paths. When XML-like payloads are returned, parsed args become empty and required-arg validation fails.
Proposed fix
Normalize XML-like argument payloads into structured args in shared parser and use that in both GUI and CLI streaming paths.
Files changed locally
core/tools/parseArgs.tscore/tools/parseArgs.vitest.tsgui/src/util/toolCallState.tsgui/src/util/toolCallState.test.tsextensions/cli/src/stream/streamChatResponse.helpers.tsextensions/cli/src/stream/streamChatResponse.test.ts
Behavior after fix
- Keep existing JSON parse path unchanged.
- If JSON parse fails, parse
<parameter=name>value</parameter>entries. - Scalar coercion supported:
true/false-> boolean- numeric strings -> number
- JSON-looking scalar/array/object values -> parsed when valid
- otherwise string
Validation added
Regression tests added for XML-style tool argument parsing in core, GUI tool-call state assembly, and CLI stream processing.
Local commit refs (not yet pushed)
- main-based branch:
fix/Tool_Parsing-main, commitc89c2d170 - release-based branch:
fix/Tool_Parsing, commit5840ed876
(Unable to push from this environment due 403 on continuedev/continue.git; creating issue with full details so maintainers can apply/cherry-pick.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.