avancement planning
This commit is contained in:
Generated
Vendored
+6
-5
@@ -25,7 +25,7 @@ async function main() {
|
||||
name: 'parallel-tool-calls-client',
|
||||
version: '1.0.0'
|
||||
});
|
||||
client.onerror = (error) => {
|
||||
client.onerror = error => {
|
||||
console.error('Client error:', error);
|
||||
};
|
||||
// Connect to the server
|
||||
@@ -33,12 +33,12 @@ async function main() {
|
||||
await client.connect(transport);
|
||||
console.log('Successfully connected to MCP server');
|
||||
// Set up notification handler with caller identification
|
||||
client.setNotificationHandler(types_js_1.LoggingMessageNotificationSchema, (notification) => {
|
||||
client.setNotificationHandler(types_js_1.LoggingMessageNotificationSchema, notification => {
|
||||
console.log(`Notification: ${notification.params.data}`);
|
||||
});
|
||||
console.log("List tools");
|
||||
console.log('List tools');
|
||||
const toolsRequest = await listTools(client);
|
||||
console.log("Tools: ", toolsRequest);
|
||||
console.log('Tools: ', toolsRequest);
|
||||
// 2. Start multiple notification tools in parallel
|
||||
console.log('\n=== Starting Multiple Notification Streams in Parallel ===');
|
||||
const toolResults = await startParallelNotificationTools(client);
|
||||
@@ -146,7 +146,8 @@ async function startParallelNotificationTools(client) {
|
||||
// Start all tool calls in parallel
|
||||
const toolPromises = toolCalls.map(({ caller, request }) => {
|
||||
console.log(`Starting tool call for ${caller}...`);
|
||||
return client.request(request, types_js_1.CallToolResultSchema)
|
||||
return client
|
||||
.request(request, types_js_1.CallToolResultSchema)
|
||||
.then(result => ({ caller, result }))
|
||||
.catch(error => {
|
||||
console.error(`Error in tool call for ${caller}:`, error);
|
||||
|
||||
Reference in New Issue
Block a user