diff --git a/ui/src/ui/chat/tool-helpers.test.ts b/ui/src/ui/chat/tool-helpers.test.ts index 7965a7df93e..18fdc0d72a4 100644 --- a/ui/src/ui/chat/tool-helpers.test.ts +++ b/ui/src/ui/chat/tool-helpers.test.ts @@ -159,6 +159,10 @@ describe("tool-helpers", () => { it("returns null for undefined arguments", () => { expect(formatToolPayloadForSidebar(undefined)).toBeNull(); }); + + it("returns null for null arguments", () => { + expect(formatToolPayloadForSidebar(null)).toBeNull(); + }); }); describe("buildToolSidebarContent", () => { diff --git a/ui/src/ui/chat/tool-helpers.ts b/ui/src/ui/chat/tool-helpers.ts index d95a695b2a9..0ceb6351c6b 100644 --- a/ui/src/ui/chat/tool-helpers.ts +++ b/ui/src/ui/chat/tool-helpers.ts @@ -27,7 +27,7 @@ export function formatToolOutputForSidebar(text: string): string { * Uses JSON code blocks for structured values and preserves plain text input. */ export function formatToolPayloadForSidebar(value: unknown): string | null { - if (value === undefined) { + if (value === undefined || value === null) { return null; } if (typeof value === "string") {