continuedev / continuedev/continue

Agent tool calls fail when OpenAI-compatible models return XML-like function.arguments

Open
#11,453 3 comments 2 reactions 1 assignee View on GitHub

@RomneyDa is already working on this.

Since Mar 15, 2026.

area:tools kind:bug stale
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

  1. Configure Continue model with OpenAI-compatible endpoint using a model that emits XML-like args (example: local Qwen OpenAI-compatible endpoint).
  2. Send a tool-heavy request (e.g., deep-dive / repository exploration).
  3. Observe returned tool call shape from model:
    • tool_calls[].function.name = "ls"
    • tool_calls[].function.arguments = "<tool_call>...<parameter=dirPath>src</parameter>..."
  4. 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.ts
  • core/tools/parseArgs.vitest.ts
  • gui/src/util/toolCallState.ts
  • gui/src/util/toolCallState.test.ts
  • extensions/cli/src/stream/streamChatResponse.helpers.ts
  • extensions/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, commit c89c2d170
  • release-based branch: fix/Tool_Parsing, commit 5840ed876

(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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.