Skip to content

Commit 56761ec

Browse files
authored
Merge pull request #1340 from RooVetGit/exclude_mcp_from_modes_where_not_supported
Exclude MCP from system prompt if mode does not support it
2 parents dba32ef + 003cd1b commit 56761ec

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.changeset/fluffy-pumpkins-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Exclude MCP instructions from the prompt if the mode doesn't support MCP

src/core/prompts/system.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
defaultModeSlug,
88
ModeConfig,
99
getModeBySlug,
10+
getGroupName,
1011
} from "../../shared/modes"
1112
import { DiffStrategy } from "../diff/DiffStrategy"
1213
import { McpHub } from "../../services/mcp/McpHub"
@@ -50,15 +51,17 @@ async function generatePrompt(
5051
// If diff is disabled, don't pass the diffStrategy
5152
const effectiveDiffStrategy = diffEnabled ? diffStrategy : undefined
5253

53-
const [mcpServersSection, modesSection] = await Promise.all([
54-
getMcpServersSection(mcpHub, effectiveDiffStrategy, enableMcpServerCreation),
55-
getModesSection(context),
56-
])
57-
5854
// Get the full mode config to ensure we have the role definition
5955
const modeConfig = getModeBySlug(mode, customModeConfigs) || modes.find((m) => m.slug === mode) || modes[0]
6056
const roleDefinition = promptComponent?.roleDefinition || modeConfig.roleDefinition
6157

58+
const [modesSection, mcpServersSection] = await Promise.all([
59+
getModesSection(context),
60+
modeConfig.groups.some((groupEntry) => getGroupName(groupEntry) === "mcp")
61+
? getMcpServersSection(mcpHub, effectiveDiffStrategy, enableMcpServerCreation)
62+
: Promise.resolve(""),
63+
])
64+
6265
const basePrompt = `${roleDefinition}
6366
6467
${getSharedToolUseSection()}

0 commit comments

Comments
 (0)