Skip to content

Commit 36760d8

Browse files
committed
🤖 fix: hide ask_user_question from exec mode tool list
Add optional mode parameter to getAvailableTools so ask_user_question is only advertised in plan mode, matching the runtime registration. Fixes P1 review feedback: models would otherwise invoke unavailable tool in exec mode and cause failures. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `mux`_ Change-Id: I1e2c792bee3b0606ec0c10a18a19443d990f2091
1 parent 497c8ad commit 36760d8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/utils/tools/toolDefinitions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ export function getToolSchemas(): Record<string, ToolSchema> {
401401
/**
402402
* Get which tools are available for a given model
403403
* @param modelString The model string (e.g., "anthropic:claude-opus-4-1")
404+
* @param mode Optional mode ("plan" | "exec") - ask_user_question only available in plan mode
404405
* @returns Array of tool names available for the model
405406
*/
406-
export function getAvailableTools(modelString: string): string[] {
407+
export function getAvailableTools(modelString: string, mode?: "plan" | "exec"): string[] {
407408
const [provider] = modelString.split(":");
408409

409410
// Base tools available for all models
@@ -416,7 +417,8 @@ export function getAvailableTools(modelString: string): string[] {
416417
"file_edit_replace_string",
417418
// "file_edit_replace_lines", // DISABLED: causes models to break repo state
418419
"file_edit_insert",
419-
"ask_user_question",
420+
// ask_user_question only available in plan mode
421+
...(mode === "plan" ? ["ask_user_question"] : []),
420422
"propose_plan",
421423
"todo_write",
422424
"todo_read",

0 commit comments

Comments
 (0)