From 21d2c3aa8313cfd9bdf51f1ab1ef98d36fdae30e Mon Sep 17 00:00:00 2001 From: tin-berri Date: Sat, 6 Jun 2026 11:14:37 -0700 Subject: [PATCH] fix(ui): stop MCP playground tool calls from sending twice (#29821) --- .../components/mcp_tools/ToolTestPanel.test.tsx | 15 +++++++++++++++ .../src/components/mcp_tools/ToolTestPanel.tsx | 1 + 2 files changed, 16 insertions(+) diff --git a/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx b/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx index 08df1fbea2..4bd351216b 100644 --- a/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx +++ b/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx @@ -151,4 +151,19 @@ describe("ToolTestPanel defaults", () => { expect(screen.getByPlaceholderText("Enter input for this tool")).toBeInTheDocument(); expect(screen.queryByText("No parameters required")).not.toBeInTheDocument(); }); + + it("renders the call button as type=button so a click never also triggers native form submission", () => { + const schema: InputSchema = { + type: "object", + properties: { + message: { type: "string", description: "Prompt text" }, + }, + }; + + renderPanel(schema); + + const callButton = screen.getByRole("button", { name: "Call Tool" }); + expect(callButton.closest("form")).not.toBeNull(); + expect(callButton).toHaveAttribute("type", "button"); + }); }); diff --git a/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx b/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx index c57ea8b523..e3e84cb743 100644 --- a/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx +++ b/ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx @@ -521,6 +521,7 @@ export function ToolTestPanel({