Skip to content

Commit 65e9abb

Browse files
committed
Merge branch 'fix/tool-tab-parameters'
2 parents f04b161 + ed5017d commit 65e9abb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
CallToolResultSchema,
1111
} from "@modelcontextprotocol/sdk/types.js";
1212
import { AlertCircle, Send } from "lucide-react";
13-
import { useState } from "react";
13+
import { useEffect, useState } from "react";
1414
import ListPane from "./ListPane";
1515

1616
import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js";
@@ -31,12 +31,15 @@ const ToolsTab = ({
3131
clearTools: () => void;
3232
callTool: (name: string, params: Record<string, unknown>) => void;
3333
selectedTool: Tool | null;
34-
setSelectedTool: (tool: Tool) => void;
34+
setSelectedTool: (tool: Tool | null) => void;
3535
toolResult: CompatibilityCallToolResult | null;
3636
nextCursor: ListToolsResult["nextCursor"];
3737
error: string | null;
3838
}) => {
3939
const [params, setParams] = useState<Record<string, unknown>>({});
40+
useEffect(() => {
41+
setParams({});
42+
}, [selectedTool]);
4043

4144
const renderToolResult = () => {
4245
if (!toolResult) return null;
@@ -110,7 +113,10 @@ const ToolsTab = ({
110113
<ListPane
111114
items={tools}
112115
listItems={listTools}
113-
clearItems={clearTools}
116+
clearItems={() => {
117+
clearTools();
118+
setSelectedTool(null);
119+
}}
114120
setSelectedItem={setSelectedTool}
115121
renderItem={(tool) => (
116122
<>

0 commit comments

Comments
 (0)