File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ interface ServerConnection {
1616 actions : AgentActionDefinition [ ] ;
1717}
1818
19+ type MCPToolResult = Awaited < ReturnType < Client [ "callTool" ] > > ;
20+
1921const MCPToolActionParams = z . object ( {
2022 params : z
2123 . union ( [ z . string ( ) , z . record ( z . string ( ) , z . unknown ( ) ) ] )
@@ -93,8 +95,10 @@ class MCPClient {
9395 : undefined
9496 ) ;
9597
96- transport . onerror = ( error : any ) => {
97- console . error ( `SSE error: ${ error . message } ` ) ;
98+ transport . onerror = ( error : unknown ) => {
99+ const message =
100+ error instanceof Error ? error . message : String ( error ) ;
101+ console . error ( `SSE error: ${ message } ` ) ;
98102 } ;
99103 } else {
100104 if ( ! serverConfig . command ) {
@@ -206,9 +210,9 @@ class MCPClient {
206210 */
207211 async executeTool (
208212 toolName : string ,
209- parameters : Record < string , any > ,
213+ parameters : Record < string , unknown > ,
210214 serverId ?: string
211- ) : Promise < any > {
215+ ) : Promise < MCPToolResult > {
212216 // If no server ID provided and only one server exists, use that one
213217 if ( ! serverId && this . servers . size === 1 ) {
214218 serverId = [ ...this . servers . keys ( ) ] [ 0 ] ;
You can’t perform that action at this time.
0 commit comments