@@ -19,7 +19,7 @@ import ResourcesTab, { Resource } from "./components/ResourcesTab";
19
19
import NotificationsTab from "./components/NotificationsTab" ;
20
20
import PromptsTab , { Prompt } from "./components/PromptsTab" ;
21
21
import ToolsTab , { Tool as ToolType } from "./components/ToolsTab" ;
22
- import CommandHistory from "./components/CommandHistory" ;
22
+ import History from "./components/CommandHistory" ;
23
23
24
24
const App = ( ) => {
25
25
const [ socket , setSocket ] = useState < WebSocket | null > ( null ) ;
@@ -40,8 +40,8 @@ const App = () => {
40
40
"/Users/ashwin/code/example-servers/build/everything/index.js" ,
41
41
) ;
42
42
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 } >
45
45
> ( [ ] ) ;
46
46
47
47
useEffect ( ( ) => {
@@ -59,34 +59,28 @@ const App = () => {
59
59
if ( message . type === "resources" ) {
60
60
setResources ( message . data . resources ) ;
61
61
setError ( null ) ;
62
- updateCommandHistory ( message ) ;
63
62
} else if ( message . type === "resource" ) {
64
63
setResourceContent ( JSON . stringify ( message . data , null , 2 ) ) ;
65
64
setError ( null ) ;
66
- updateCommandHistory ( message ) ;
67
65
} else if ( message . type === "prompts" ) {
68
66
setPrompts ( message . data . prompts ) ;
69
67
setError ( null ) ;
70
- updateCommandHistory ( message ) ;
71
68
} else if ( message . type === "prompt" ) {
72
69
setPromptContent ( JSON . stringify ( message . data , null , 2 ) ) ;
73
70
setError ( null ) ;
74
- updateCommandHistory ( message ) ;
75
71
} else if ( message . type === "tools" ) {
76
72
setTools ( message . data . tools ) ;
77
73
setError ( null ) ;
78
- updateCommandHistory ( message ) ;
79
74
} else if ( message . type === "toolResult" ) {
80
75
setToolResult ( JSON . stringify ( message . data , null , 2 ) ) ;
81
76
setError ( null ) ;
82
- updateCommandHistory ( message ) ;
83
77
} else if ( message . type === "error" ) {
84
78
setError ( message . message ) ;
85
- updateCommandHistory ( message ) ;
86
79
} else if ( message . type === "connected" ) {
87
80
setMcpConnected ( true ) ;
88
- updateCommandHistory ( message ) ;
89
81
}
82
+
83
+ updateRequestHistory ( message ) ;
90
84
} ;
91
85
92
86
ws . onerror = ( ) => {
@@ -101,13 +95,13 @@ const App = () => {
101
95
return ( ) => ws . close ( ) ;
102
96
} , [ ] ) ;
103
97
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 ) {
108
102
const updatedHistory = [ ...prev ] ;
109
103
updatedHistory [ updatedHistory . length - 1 ] = {
110
- ...lastCommand ,
104
+ ...lastRequest ,
111
105
response : JSON . stringify ( response ) ,
112
106
} ;
113
107
return updatedHistory ;
@@ -120,9 +114,9 @@ const App = () => {
120
114
if ( socket ) {
121
115
console . log ( "Sending WebSocket message:" , message ) ;
122
116
socket . send ( JSON . stringify ( message ) ) ;
123
- setCommandHistory ( ( prev ) => [
117
+ setRequestHistory ( ( prev ) => [
124
118
...prev ,
125
- { command : JSON . stringify ( message ) , response : null } ,
119
+ { request : JSON . stringify ( message ) , response : null } ,
126
120
] ) ;
127
121
}
128
122
} ;
@@ -260,7 +254,7 @@ const App = () => {
260
254
</ div >
261
255
</ div >
262
256
</ div >
263
- < CommandHistory commandHistory = { commandHistory } />
257
+ < History requestHistory = { requestHistory } />
264
258
</ div >
265
259
) ;
266
260
} ;
0 commit comments