diff --git a/.changeset/fluffy-pumpkins-sip.md b/.changeset/fluffy-pumpkins-sip.md new file mode 100644 index 0000000000..9b44d7950e --- /dev/null +++ b/.changeset/fluffy-pumpkins-sip.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Exclude MCP instructions from the prompt if the mode doesn't support MCP diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index 90791f6358..3147c97ae3 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -7,6 +7,7 @@ import { defaultModeSlug, ModeConfig, getModeBySlug, + getGroupName, } from "../../shared/modes" import { DiffStrategy } from "../diff/DiffStrategy" import { McpHub } from "../../services/mcp/McpHub" @@ -50,15 +51,17 @@ async function generatePrompt( // If diff is disabled, don't pass the diffStrategy const effectiveDiffStrategy = diffEnabled ? diffStrategy : undefined - const [mcpServersSection, modesSection] = await Promise.all([ - getMcpServersSection(mcpHub, effectiveDiffStrategy, enableMcpServerCreation), - getModesSection(context), - ]) - // Get the full mode config to ensure we have the role definition const modeConfig = getModeBySlug(mode, customModeConfigs) || modes.find((m) => m.slug === mode) || modes[0] const roleDefinition = promptComponent?.roleDefinition || modeConfig.roleDefinition + const [modesSection, mcpServersSection] = await Promise.all([ + getModesSection(context), + modeConfig.groups.some((groupEntry) => getGroupName(groupEntry) === "mcp") + ? getMcpServersSection(mcpHub, effectiveDiffStrategy, enableMcpServerCreation) + : Promise.resolve(""), + ]) + const basePrompt = `${roleDefinition} ${getSharedToolUseSection()}