Roo-Code/src/core/tools/validateToolUse.ts
Roo Code 11e4f6933b feat: implement Phase 3 of mode-to-agent renaming
- Updated all function names from mode to agent terminology
- Updated all variable names throughout the codebase
- Updated property names in objects and interfaces
- Updated event names (TaskModeSwitched → TaskAgentSwitched)
- Maintained backward compatibility with aliases for all renamed functions
- Preserved "mode" terminology in marketplace-related code and .roomodes files
- Fixed test expectations to maintain backward compatibility
- Fixed enum duplicate value lint error
- All tests passing (3044 passed, 48 skipped)
2025-07-28 18:35:39 +00:00

15 lines
498 B
TypeScript

import type { ToolName, ModeConfig } from "@roo-code/types"
import { Agent, isToolAllowedForAgent } from "../../shared/agents"
export function validateToolUse(
toolName: ToolName,
agent: Agent,
customAgents?: ModeConfig[],
toolRequirements?: Record<string, boolean>,
toolParams?: Record<string, unknown>,
): void {
if (!isToolAllowedForAgent(toolName, agent, customAgents ?? [], toolRequirements, toolParams)) {
throw new Error(`Tool "${toolName}" is not allowed in ${agent} mode.`)
}
}