(permissionContext: ToolPermissionContext)
| 297 | } |
| 298 | |
| 299 | export const getTools = (permissionContext: ToolPermissionContext): Tools => { |
| 300 | // Simple mode: only Bash, Read, and Edit tools |
| 301 | if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) { |
| 302 | const simpleTools: Tool[] = [BashTool, FileReadTool, FileEditTool] |
| 303 | if (isReplModeEnabled() && REPLTool) { |
| 304 | simpleTools.push(REPLTool) |
| 305 | } |
| 306 | // When coordinator mode is also active, include AgentTool and TaskStopTool |
| 307 | // so the coordinator gets Task+TaskStop (via useMergedTools filtering) and |
| 308 | // workers get Bash/Read/Edit (via filterToolsForAgent filtering). |
| 309 | if ( |
| 310 | feature('COORDINATOR_MODE') && |
| 311 | coordinatorModeModule?.isCoordinatorMode() |
| 312 | ) { |
| 313 | simpleTools.push(AgentTool, TaskStopTool, getSendMessageTool()) |
| 314 | } |
| 315 | return sortToolsByPolicy(filterToolsByDenyRules(simpleTools, permissionContext)) |
| 316 | } |
| 317 | |
| 318 | // Get all base tools and filter out special tools that get added conditionally |
| 319 | const specialTools = new Set([ |
| 320 | ListMcpResourcesTool.name, |
| 321 | ReadMcpResourceTool.name, |
| 322 | SYNTHETIC_OUTPUT_TOOL_NAME, |
| 323 | ]) |
| 324 | |
| 325 | const tools = getAllBaseTools().filter(tool => !specialTools.has(tool.name)) |
| 326 | |
| 327 | // Filter out tools that are denied by the deny rules |
| 328 | const allowedTools = filterToolsByDenyRules(tools, permissionContext) |
| 329 | |
| 330 | const isEnabled = allowedTools.map(_ => _.isEnabled()) |
| 331 | return sortToolsByPolicy(allowedTools.filter((_, i) => isEnabled[i])) |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * Assemble the full tool pool for a given permission context and MCP tools. |
no test coverage detected