File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
10
10
CallToolResultSchema ,
11
11
} from "@modelcontextprotocol/sdk/types.js" ;
12
12
import { AlertCircle , Send } from "lucide-react" ;
13
- import { useState } from "react" ;
13
+ import { useEffect , useState } from "react" ;
14
14
import ListPane from "./ListPane" ;
15
15
16
16
import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
@@ -31,12 +31,15 @@ const ToolsTab = ({
31
31
clearTools : ( ) => void ;
32
32
callTool : ( name : string , params : Record < string , unknown > ) => void ;
33
33
selectedTool : Tool | null ;
34
- setSelectedTool : ( tool : Tool ) => void ;
34
+ setSelectedTool : ( tool : Tool | null ) => void ;
35
35
toolResult : CompatibilityCallToolResult | null ;
36
36
nextCursor : ListToolsResult [ "nextCursor" ] ;
37
37
error : string | null ;
38
38
} ) => {
39
39
const [ params , setParams ] = useState < Record < string , unknown > > ( { } ) ;
40
+ useEffect ( ( ) => {
41
+ setParams ( { } ) ;
42
+ } , [ selectedTool ] ) ;
40
43
41
44
const renderToolResult = ( ) => {
42
45
if ( ! toolResult ) return null ;
@@ -110,7 +113,10 @@ const ToolsTab = ({
110
113
< ListPane
111
114
items = { tools }
112
115
listItems = { listTools }
113
- clearItems = { clearTools }
116
+ clearItems = { ( ) => {
117
+ clearTools ( ) ;
118
+ setSelectedTool ( null ) ;
119
+ } }
114
120
setSelectedItem = { setSelectedTool }
115
121
renderItem = { ( tool ) => (
116
122
< >
You can’t perform that action at this time.
0 commit comments