Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit be0e8c2

Browse files
chore: clean up XML legacy code and native-only comments (#10900)
1 parent f6006c9 commit be0e8c2

18 files changed

Lines changed: 58 additions & 86 deletions

File tree

src/api/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export interface ApiHandlerCreateMessageMetadata {
8282
* Can be "none", "auto", "required", or a specific tool choice.
8383
*/
8484
tool_choice?: OpenAI.Chat.ChatCompletionCreateParams["tool_choice"]
85-
// Tool calling is native-only.
8685
/**
8786
* Controls whether the model can return multiple tool calls in a single response.
8887
* When true, parallel tool calls are enabled (OpenAI's parallel_tool_calls=true).

src/api/providers/__tests__/lite-llm.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ describe("LiteLLMHandler", () => {
632632
function: { name: "read_file", description: "Read a file", parameters: {} },
633633
},
634634
],
635-
// Tool calling is native-only; legacy protocol fields are not supported.
636635
}
637636

638637
const generator = handler.createMessage(systemPrompt, messages, metadata as any)
@@ -700,7 +699,6 @@ describe("LiteLLMHandler", () => {
700699
function: { name: "read_file", description: "Read a file", parameters: {} },
701700
},
702701
],
703-
// Tool calling is native-only; legacy protocol fields are not supported.
704702
}
705703

706704
const generator = handler.createMessage(systemPrompt, messages, metadata as any)

src/api/providers/fetchers/ollama.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export const parseOllamaModel = (rawModel: OllamaModelInfoResponse): ModelInfo |
4242
const contextWindow =
4343
contextKey && typeof rawModel.model_info[contextKey] === "number" ? rawModel.model_info[contextKey] : undefined
4444

45-
// Filter out models that don't support tools.
46-
// Roo Code tool calling is native-only; models without tool capability won't work.
45+
// Filter out models that don't support tools. Models without tool capability won't work.
4746
const supportsTools = rawModel.capabilities?.includes("tools") ?? false
4847
if (!supportsTools) {
4948
return null

src/api/providers/openrouter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
consolidateReasoningDetails,
2424
} from "../transform/openai-format"
2525
import { normalizeMistralToolCallId } from "../transform/mistral-format"
26-
// Tool calling is native-only.
2726
import { ApiStreamChunk } from "../transform/stream"
2827
import { convertToR1Format } from "../transform/r1-format"
2928
import { addCacheBreakpoints as addAnthropicCacheBreakpoints } from "../transform/caching/anthropic"

src/api/transform/model-params.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ export function getModelParams({
163163
format,
164164
...params,
165165
reasoning: getOpenAiReasoning({ model, reasoningBudget, reasoningEffort, settings }),
166-
// Tool calling is native-only; whether tools are included is determined
167-
// by whether the caller provided tool definitions.
166+
// Whether tools are included is determined by whether the caller provided tool definitions.
168167
}
169168
} else if (format === "gemini") {
170169
return {

src/core/condense/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import { supportPrompt } from "../../shared/support-prompt"
1212

1313
/**
1414
* Checks if a message contains tool_result blocks.
15-
* For native tools protocol, user messages with tool_result blocks require
16-
* corresponding tool_use blocks from the previous assistant turn.
15+
* User messages with tool_result blocks require corresponding tool_use blocks from the previous assistant turn.
1716
*/
1817
function hasToolResultBlocks(message: ApiMessage): boolean {
1918
if (message.role !== "user" || typeof message.content === "string") {
@@ -187,7 +186,7 @@ export type SummarizeResponse = {
187186
* @param {boolean} isAutomaticTrigger - Whether the summarization is triggered automatically
188187
* @param {string} customCondensingPrompt - Optional custom prompt to use for condensing
189188
* @param {ApiHandler} condensingApiHandler - Optional specific API handler to use for condensing
190-
* @param {boolean} useNativeTools - Whether native tools protocol is being used (requires tool_use/tool_result pairing)
189+
* @param {boolean} useNativeTools - Whether to preserve tool_use/tool_result pairing in summarization
191190
* @returns {SummarizeResponse} - The result of the summarization operation (see above)
192191
*/
193192
export async function summarizeConversation(

src/core/environment/getEnvironmentDetails.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
235235
language: language ?? formatLanguage(vscode.env.language),
236236
})
237237

238-
// Tool calling is native-only.
239238
const toolFormat = "native"
240239

241240
details += `\n\n# Current Mode\n`

src/core/prompts/__tests__/system-prompt.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ describe("SYSTEM_PROMPT", () => {
690690
expect(prompt).not.toContain("## update_todo_list")
691691
})
692692

693-
it("should include native tool instructions (native-only)", async () => {
693+
it("should include native tool instructions", async () => {
694694
const settings = {
695695
maxConcurrentFileReads: 5,
696696
todoListEnabled: true,

src/core/prompts/sections/__tests__/tool-use-guidelines.spec.ts

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,56 @@ import { getToolUseGuidelinesSection } from "../tool-use-guidelines"
22
import { EXPERIMENT_IDS } from "../../../../shared/experiments"
33

44
describe("getToolUseGuidelinesSection", () => {
5-
describe("native-only", () => {
6-
describe("with MULTIPLE_NATIVE_TOOL_CALLS disabled (default)", () => {
7-
it("should include proper numbered guidelines", () => {
8-
const guidelines = getToolUseGuidelinesSection()
5+
describe("with MULTIPLE_NATIVE_TOOL_CALLS disabled (default)", () => {
6+
it("should include proper numbered guidelines", () => {
7+
const guidelines = getToolUseGuidelinesSection()
98

10-
// Check that all numbered items are present with correct numbering
11-
expect(guidelines).toContain("1. Assess what information")
12-
expect(guidelines).toContain("2. Choose the most appropriate tool")
13-
expect(guidelines).toContain("3. If multiple actions are needed")
14-
expect(guidelines).toContain("4. After each tool use")
15-
})
9+
// Check that all numbered items are present with correct numbering
10+
expect(guidelines).toContain("1. Assess what information")
11+
expect(guidelines).toContain("2. Choose the most appropriate tool")
12+
expect(guidelines).toContain("3. If multiple actions are needed")
13+
expect(guidelines).toContain("4. After each tool use")
14+
})
1615

17-
it("should include single-tool-per-message guidance when experiment disabled", () => {
18-
const guidelines = getToolUseGuidelinesSection({})
16+
it("should include single-tool-per-message guidance when experiment disabled", () => {
17+
const guidelines = getToolUseGuidelinesSection({})
1918

20-
expect(guidelines).toContain("use one tool at a time per message")
21-
expect(guidelines).not.toContain("you may use multiple tools in a single message")
22-
expect(guidelines).not.toContain("Formulate your tool use using")
23-
expect(guidelines).toContain("ALWAYS wait for user confirmation")
24-
})
19+
expect(guidelines).toContain("use one tool at a time per message")
20+
expect(guidelines).not.toContain("you may use multiple tools in a single message")
21+
expect(guidelines).not.toContain("Formulate your tool use using")
22+
expect(guidelines).toContain("ALWAYS wait for user confirmation")
23+
})
2524

26-
it("should include simplified iterative process guidelines", () => {
27-
const guidelines = getToolUseGuidelinesSection()
25+
it("should include simplified iterative process guidelines", () => {
26+
const guidelines = getToolUseGuidelinesSection()
2827

29-
expect(guidelines).toContain("carefully considering the user's response after each tool use")
30-
expect(guidelines).toContain("It is crucial to proceed step-by-step")
31-
})
28+
expect(guidelines).toContain("carefully considering the user's response after each tool use")
29+
expect(guidelines).toContain("It is crucial to proceed step-by-step")
3230
})
31+
})
3332

34-
describe("with MULTIPLE_NATIVE_TOOL_CALLS enabled", () => {
35-
it("should include multiple-tools-per-message guidance when experiment enabled", () => {
36-
const guidelines = getToolUseGuidelinesSection({
37-
[EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true,
38-
})
39-
40-
expect(guidelines).toContain("you may use multiple tools in a single message")
41-
expect(guidelines).not.toContain("use one tool at a time per message")
42-
expect(guidelines).not.toContain("After each tool use, the user will respond")
33+
describe("with MULTIPLE_NATIVE_TOOL_CALLS enabled", () => {
34+
it("should include multiple-tools-per-message guidance when experiment enabled", () => {
35+
const guidelines = getToolUseGuidelinesSection({
36+
[EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true,
4337
})
4438

45-
it("should use simplified footer without step-by-step language", () => {
46-
const guidelines = getToolUseGuidelinesSection({
47-
[EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true,
48-
})
39+
expect(guidelines).toContain("you may use multiple tools in a single message")
40+
expect(guidelines).not.toContain("use one tool at a time per message")
41+
expect(guidelines).not.toContain("After each tool use, the user will respond")
42+
})
4943

50-
// When multiple tools per message is enabled, we don't want the
51-
// "step-by-step" or "after each tool use" language that would
52-
// contradict the ability to batch tool calls.
53-
expect(guidelines).toContain("carefully considering the user's response after tool executions")
54-
expect(guidelines).not.toContain("It is crucial to proceed step-by-step")
55-
expect(guidelines).not.toContain("ALWAYS wait for user confirmation after each tool use")
44+
it("should use simplified footer without step-by-step language", () => {
45+
const guidelines = getToolUseGuidelinesSection({
46+
[EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true,
5647
})
48+
49+
// When multiple tools per message is enabled, we don't want the
50+
// "step-by-step" or "after each tool use" language that would
51+
// contradict the ability to batch tool calls.
52+
expect(guidelines).toContain("carefully considering the user's response after tool executions")
53+
expect(guidelines).not.toContain("It is crucial to proceed step-by-step")
54+
expect(guidelines).not.toContain("ALWAYS wait for user confirmation after each tool use")
5755
})
5856
})
5957

src/core/prompts/sections/__tests__/tool-use.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ describe("getSharedToolUseSection", () => {
44
describe("native tool calling", () => {
55
it("should include one tool per message requirement when experiment is disabled", () => {
66
// No experiment flags passed (default: disabled)
7-
const section = getSharedToolUseSection("native")
7+
const section = getSharedToolUseSection()
88

99
expect(section).toContain("You must use exactly one tool call per assistant response")
1010
expect(section).toContain("Do not call zero tools or more than one tool")
1111
})
1212

1313
it("should include one tool per message requirement when experiment is explicitly disabled", () => {
14-
const section = getSharedToolUseSection("native", { multipleNativeToolCalls: false })
14+
const section = getSharedToolUseSection({ multipleNativeToolCalls: false })
1515

1616
expect(section).toContain("You must use exactly one tool call per assistant response")
1717
expect(section).toContain("Do not call zero tools or more than one tool")
1818
})
1919

2020
it("should NOT include one tool per message requirement when experiment is enabled", () => {
21-
const section = getSharedToolUseSection("native", { multipleNativeToolCalls: true })
21+
const section = getSharedToolUseSection({ multipleNativeToolCalls: true })
2222

2323
expect(section).not.toContain("You must use exactly one tool per message")
2424
expect(section).not.toContain("every assistant message must include a tool call")
@@ -27,22 +27,22 @@ describe("getSharedToolUseSection", () => {
2727
})
2828

2929
it("should include native tool-calling instructions", () => {
30-
const section = getSharedToolUseSection("native")
30+
const section = getSharedToolUseSection()
3131

3232
expect(section).toContain("provider-native tool-calling mechanism")
3333
expect(section).toContain("Do not include XML markup or examples")
3434
})
3535

3636
it("should NOT include XML formatting instructions", () => {
37-
const section = getSharedToolUseSection("native")
37+
const section = getSharedToolUseSection()
3838

3939
expect(section).not.toContain("<actual_tool_name>")
4040
expect(section).not.toContain("</actual_tool_name>")
4141
})
4242
})
4343

4444
describe("default (native-only)", () => {
45-
it("should default to native tool calling when no mode is specified", () => {
45+
it("should default to native tool calling when no arguments are provided", () => {
4646
const section = getSharedToolUseSection()
4747
expect(section).toContain("provider-native tool-calling mechanism")
4848
// No legacy XML-tag tool-calling remnants

0 commit comments

Comments
 (0)