mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
15 lines
488 B
TypeScript
15 lines
488 B
TypeScript
import type { ToolName, ModeConfig } from "@roo-code/types"
|
|
|
|
import { Mode, isToolAllowedForMode } from "../../shared/modes"
|
|
|
|
export function validateToolUse(
|
|
toolName: ToolName,
|
|
mode: Mode,
|
|
customModes?: ModeConfig[],
|
|
toolRequirements?: Record<string, boolean>,
|
|
toolParams?: Record<string, unknown>,
|
|
): void {
|
|
if (!isToolAllowedForMode(toolName, mode, customModes ?? [], toolRequirements, toolParams)) {
|
|
throw new Error(`Tool "${toolName}" is not allowed in ${mode} mode.`)
|
|
}
|
|
}
|