@@ -3,9 +3,9 @@ import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js';
3
3
import {
4
4
ListToolsRequest ,
5
5
ListToolsResultSchema ,
6
- CallToolRequest ,
7
6
CallToolResultSchema ,
8
7
LoggingMessageNotificationSchema ,
8
+ CallToolResult ,
9
9
} from '../../types.js' ;
10
10
11
11
/**
@@ -57,11 +57,11 @@ async function main(): Promise<void> {
57
57
// 2. Start multiple notification tools in parallel
58
58
console . log ( '\n=== Starting Multiple Notification Streams in Parallel ===' ) ;
59
59
const toolResults = await startParallelNotificationTools ( client ) ;
60
-
60
+
61
61
// Log the results from each tool call
62
62
for ( const [ caller , result ] of Object . entries ( toolResults ) ) {
63
63
console . log ( `\n=== Tool result for ${ caller } ===` ) ;
64
- result . content . forEach ( ( item : { type : string ; text : any ; } ) => {
64
+ result . content . forEach ( ( item : { type : string ; text ?: string ; } ) => {
65
65
if ( item . type === 'text' ) {
66
66
console . log ( ` ${ item . text } ` ) ;
67
67
} else {
@@ -113,7 +113,7 @@ async function listTools(client: Client): Promise<void> {
113
113
* Start multiple notification tools in parallel with different configurations
114
114
* Each tool call includes a caller parameter to identify its notifications
115
115
*/
116
- async function startParallelNotificationTools ( client : Client ) : Promise < Record < string , any > > {
116
+ async function startParallelNotificationTools ( client : Client ) : Promise < Record < string , CallToolResult > > {
117
117
try {
118
118
// Define multiple tool calls with different configurations
119
119
const toolCalls = [
@@ -162,7 +162,7 @@ async function startParallelNotificationTools(client: Client): Promise<Record<st
162
162
] ;
163
163
164
164
console . log ( `Starting ${ toolCalls . length } notification tools in parallel...` ) ;
165
-
165
+
166
166
// Start all tool calls in parallel
167
167
const toolPromises = toolCalls . map ( ( { caller, request } ) => {
168
168
console . log ( `Starting tool call for ${ caller } ...` ) ;
@@ -176,9 +176,9 @@ async function startParallelNotificationTools(client: Client): Promise<Record<st
176
176
177
177
// Wait for all tool calls to complete
178
178
const results = await Promise . all ( toolPromises ) ;
179
-
179
+
180
180
// Organize results by caller
181
- const resultsByTool : Record < string , any > = { } ;
181
+ const resultsByTool : Record < string , CallToolResult > = { } ;
182
182
results . forEach ( ( { caller, result } ) => {
183
183
resultsByTool [ caller ] = result ;
184
184
} ) ;
0 commit comments