fix(ui): stop MCP playground tool calls from sending twice (#29821)

This commit is contained in:
tin-berri 2026-06-06 11:14:37 -07:00 committed by GitHub
parent b3297fc2ea
commit 21d2c3aa83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View File

@ -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");
});
});

View File

@ -521,6 +521,7 @@ export function ToolTestPanel({
<div className="pt-3 border-t border-gray-100">
<Button
type="button"
onClick={() => form.submit()}
disabled={isLoading}
variant="primary"