From 4bd65f935aa2bfba540947651c33019ddc04a9e9 Mon Sep 17 00:00:00 2001 From: daniel-lxs Date: Tue, 18 Nov 2025 14:49:34 -0500 Subject: [PATCH] fix: exclude XML tool examples from MODES section when native protocol enabled --- src/core/prompts/sections/modes.ts | 13 +++++++++++-- src/core/prompts/system.ts | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/prompts/sections/modes.ts b/src/core/prompts/sections/modes.ts index 5a0219c7a11..1925405aa87 100644 --- a/src/core/prompts/sections/modes.ts +++ b/src/core/prompts/sections/modes.ts @@ -5,7 +5,10 @@ import type { ModeConfig } from "@roo-code/types" import { getAllModesWithPrompts } from "../../../shared/modes" import { ensureSettingsDirectoryExists } from "../../../utils/globalContext" -export async function getModesSection(context: vscode.ExtensionContext): Promise { +export async function getModesSection( + context: vscode.ExtensionContext, + skipXmlExamples: boolean = false, +): Promise { // Make sure path gets created await ensureSettingsDirectoryExists(context) @@ -31,12 +34,18 @@ ${allModes }) .join("\n")}` - modesContent += ` + if (!skipXmlExamples) { + modesContent += ` 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: create_mode ` + } else { + modesContent += ` +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. +` + } return modesContent } diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index 9230619ebdc..e72f26c51a7 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -86,7 +86,7 @@ async function generatePrompt( const effectiveProtocol = getEffectiveProtocol(settings?.toolProtocol) const [modesSection, mcpServersSection] = await Promise.all([ - getModesSection(context), + getModesSection(context, isNativeProtocol(effectiveProtocol)), shouldIncludeMcp ? getMcpServersSection( mcpHub,