mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(policy): centralize plan mode tool visibility in policy engine (#20178)
Co-authored-by: Mahima Shanware <mshanware@google.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import {
|
||||
import { CodebaseInvestigatorAgent } from '../agents/codebase-investigator.js';
|
||||
import { isGitRepository } from '../utils/gitUtils.js';
|
||||
import {
|
||||
PLAN_MODE_TOOLS,
|
||||
WRITE_TODOS_TOOL_NAME,
|
||||
READ_FILE_TOOL_NAME,
|
||||
ENTER_PLAN_MODE_TOOL_NAME,
|
||||
@@ -67,25 +66,17 @@ export class PromptProvider {
|
||||
const contextFilenames = getAllGeminiMdFilenames();
|
||||
|
||||
// --- Context Gathering ---
|
||||
let planModeToolsList = PLAN_MODE_TOOLS.filter((t) =>
|
||||
enabledToolNames.has(t),
|
||||
)
|
||||
.map((t) => ` <tool>\`${t}\`</tool>`)
|
||||
.join('\n');
|
||||
|
||||
// Add read-only MCP tools to the list
|
||||
let planModeToolsList = '';
|
||||
if (isPlanMode) {
|
||||
const allTools = config.getToolRegistry().getAllTools();
|
||||
const readOnlyMcpTools = allTools.filter(
|
||||
(t): t is DiscoveredMCPTool =>
|
||||
t instanceof DiscoveredMCPTool && !!t.isReadOnly,
|
||||
);
|
||||
if (readOnlyMcpTools.length > 0) {
|
||||
const mcpToolsList = readOnlyMcpTools
|
||||
.map((t) => ` <tool>\`${t.name}\` (${t.serverName})</tool>`)
|
||||
.join('\n');
|
||||
planModeToolsList += `\n${mcpToolsList}`;
|
||||
}
|
||||
planModeToolsList = allTools
|
||||
.map((t) => {
|
||||
if (t instanceof DiscoveredMCPTool) {
|
||||
return ` <tool>\`${t.name}\` (${t.serverName})</tool>`;
|
||||
}
|
||||
return ` <tool>\`${t.name}\`</tool>`;
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
let basePrompt: string;
|
||||
|
||||
Reference in New Issue
Block a user