Skip to content

Commit b0c254c

Browse files
authored
fix: exclude XML tool examples from MODES section when native protocol enabled (#9367)
1 parent 045c2d6 commit b0c254c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/core/prompts/sections/modes.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import type { ModeConfig } from "@roo-code/types"
55
import { getAllModesWithPrompts } from "../../../shared/modes"
66
import { ensureSettingsDirectoryExists } from "../../../utils/globalContext"
77

8-
export async function getModesSection(context: vscode.ExtensionContext): Promise<string> {
8+
export async function getModesSection(
9+
context: vscode.ExtensionContext,
10+
skipXmlExamples: boolean = false,
11+
): Promise<string> {
912
// Make sure path gets created
1013
await ensureSettingsDirectoryExists(context)
1114

@@ -31,12 +34,18 @@ ${allModes
3134
})
3235
.join("\n")}`
3336

34-
modesContent += `
37+
if (!skipXmlExamples) {
38+
modesContent += `
3539
If the user asks you to create or edit a new mode for this project, you should read the instructions by using the fetch_instructions tool, like this:
3640
<fetch_instructions>
3741
<task>create_mode</task>
3842
</fetch_instructions>
3943
`
44+
} else {
45+
modesContent += `
46+
If the user asks you to create or edit a new mode for this project, you should read the instructions by using the fetch_instructions tool.
47+
`
48+
}
4049

4150
return modesContent
4251
}

src/core/prompts/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async function generatePrompt(
8686
const effectiveProtocol = getEffectiveProtocol(settings?.toolProtocol)
8787

8888
const [modesSection, mcpServersSection] = await Promise.all([
89-
getModesSection(context),
89+
getModesSection(context, isNativeProtocol(effectiveProtocol)),
9090
shouldIncludeMcp
9191
? getMcpServersSection(
9292
mcpHub,

0 commit comments

Comments
 (0)