@@ -19,7 +19,7 @@ import ResourcesTab, { Resource } from "./components/ResourcesTab";
1919import NotificationsTab from "./components/NotificationsTab" ;
2020import PromptsTab , { Prompt } from "./components/PromptsTab" ;
2121import ToolsTab , { Tool as ToolType } from "./components/ToolsTab" ;
22- import CommandHistory from "./components/CommandHistory" ;
22+ import History from "./components/CommandHistory" ;
2323
2424const App = ( ) => {
2525 const [ socket , setSocket ] = useState < WebSocket | null > ( null ) ;
@@ -40,8 +40,8 @@ const App = () => {
4040 "/Users/ashwin/code/example-servers/build/everything/index.js" ,
4141 ) ;
4242 const [ mcpConnected , setMcpConnected ] = useState < boolean > ( false ) ;
43- const [ commandHistory , setCommandHistory ] = useState <
44- Array < { command : string ; response : string | null } >
43+ const [ requestHistory , setRequestHistory ] = useState <
44+ Array < { request : string ; response : string | null } >
4545 > ( [ ] ) ;
4646
4747 useEffect ( ( ) => {
@@ -59,34 +59,28 @@ const App = () => {
5959 if ( message . type === "resources" ) {
6060 setResources ( message . data . resources ) ;
6161 setError ( null ) ;
62- updateCommandHistory ( message ) ;
6362 } else if ( message . type === "resource" ) {
6463 setResourceContent ( JSON . stringify ( message . data , null , 2 ) ) ;
6564 setError ( null ) ;
66- updateCommandHistory ( message ) ;
6765 } else if ( message . type === "prompts" ) {
6866 setPrompts ( message . data . prompts ) ;
6967 setError ( null ) ;
70- updateCommandHistory ( message ) ;
7168 } else if ( message . type === "prompt" ) {
7269 setPromptContent ( JSON . stringify ( message . data , null , 2 ) ) ;
7370 setError ( null ) ;
74- updateCommandHistory ( message ) ;
7571 } else if ( message . type === "tools" ) {
7672 setTools ( message . data . tools ) ;
7773 setError ( null ) ;
78- updateCommandHistory ( message ) ;
7974 } else if ( message . type === "toolResult" ) {
8075 setToolResult ( JSON . stringify ( message . data , null , 2 ) ) ;
8176 setError ( null ) ;
82- updateCommandHistory ( message ) ;
8377 } else if ( message . type === "error" ) {
8478 setError ( message . message ) ;
85- updateCommandHistory ( message ) ;
8679 } else if ( message . type === "connected" ) {
8780 setMcpConnected ( true ) ;
88- updateCommandHistory ( message ) ;
8981 }
82+
83+ updateRequestHistory ( message ) ;
9084 } ;
9185
9286 ws . onerror = ( ) => {
@@ -101,13 +95,13 @@ const App = () => {
10195 return ( ) => ws . close ( ) ;
10296 } , [ ] ) ;
10397
104- const updateCommandHistory = ( response : unknown ) => {
105- setCommandHistory ( ( prev ) => {
106- const lastCommand = prev [ prev . length - 1 ] ;
107- if ( lastCommand && lastCommand . response === null ) {
98+ const updateRequestHistory = ( response : unknown ) => {
99+ setRequestHistory ( ( prev ) => {
100+ const lastRequest = prev [ prev . length - 1 ] ;
101+ if ( lastRequest && lastRequest . response === null ) {
108102 const updatedHistory = [ ...prev ] ;
109103 updatedHistory [ updatedHistory . length - 1 ] = {
110- ...lastCommand ,
104+ ...lastRequest ,
111105 response : JSON . stringify ( response ) ,
112106 } ;
113107 return updatedHistory ;
@@ -120,9 +114,9 @@ const App = () => {
120114 if ( socket ) {
121115 console . log ( "Sending WebSocket message:" , message ) ;
122116 socket . send ( JSON . stringify ( message ) ) ;
123- setCommandHistory ( ( prev ) => [
117+ setRequestHistory ( ( prev ) => [
124118 ...prev ,
125- { command : JSON . stringify ( message ) , response : null } ,
119+ { request : JSON . stringify ( message ) , response : null } ,
126120 ] ) ;
127121 }
128122 } ;
@@ -260,7 +254,7 @@ const App = () => {
260254 </ div >
261255 </ div >
262256 </ div >
263- < CommandHistory commandHistory = { commandHistory } />
257+ < History requestHistory = { requestHistory } />
264258 </ div >
265259 ) ;
266260} ;
0 commit comments