From e69d10b6c978048510eec21ca5c648336ebacb47 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Tue, 9 Sep 2025 23:25:27 -0400 Subject: [PATCH] repair tool calls when casing is wrong --- packages/opencode/src/session/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 2b49bb74..83f2d001 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -1007,6 +1007,17 @@ export namespace Session { } }, async experimental_repairToolCall(input) { + const lower = input.toolCall.toolName.toLowerCase() + if (lower !== input.toolCall.toolName && tools[lower]) { + log.info("repairing tool call", { + tool: input.toolCall.toolName, + repaired: lower, + }) + return { + ...input.toolCall, + toolName: lower, + } + } return { ...input.toolCall, input: JSON.stringify({