summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/server/src/tools/terminal.ts3
-rw-r--r--packages/server/src/tools/tools.ts4
2 files changed, 7 insertions, 0 deletions
diff --git a/packages/server/src/tools/terminal.ts b/packages/server/src/tools/terminal.ts
index 64b8e652..514ad682 100644
--- a/packages/server/src/tools/terminal.ts
+++ b/packages/server/src/tools/terminal.ts
@@ -244,6 +244,9 @@ Use this tool for running build steps (\`npm install\`, \`make\`), linters (\`es
async shouldConfirmExecute(
params: TerminalToolParams,
): Promise<ToolCallConfirmationDetails | false> {
+ if (this.validateToolParams(params)) {
+ return false; // skip confirmation, execute call will fail immediately
+ }
const rootCommand =
params.command
.trim()
diff --git a/packages/server/src/tools/tools.ts b/packages/server/src/tools/tools.ts
index 448ea206..57a388d8 100644
--- a/packages/server/src/tools/tools.ts
+++ b/packages/server/src/tools/tools.ts
@@ -36,6 +36,8 @@ export interface Tool<
/**
* Validates the parameters for the tool
+ * Should be called from both `shouldConfirmExecute` and `execute`
+ * `shouldConfirmExecute` should return false immediately if invalid
* @param params Parameters to validate
* @returns An error message string if invalid, null otherwise
*/
@@ -102,6 +104,8 @@ export abstract class BaseTool<
/**
* Validates the parameters for the tool
* This is a placeholder implementation and should be overridden
+ * Should be called from both `shouldConfirmExecute` and `execute`
+ * `shouldConfirmExecute` should return false immediately if invalid
* @param params Parameters to validate
* @returns An error message string if invalid, null otherwise
*/