v2 switch client examples to .callTool usage (#1628)

This commit is contained in:
Konstantin Konstantinov 2026-03-05 11:25:06 +02:00 • committed by GitHub
commit 4663a26f2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
//#region prelude
import Anthropic from '@anthropic-ai/sdk';
import { Client, StdioClientTransport, type CallToolResult } from '@modelcontextprotocol/client';
import { Client, StdioClientTransport } from '@modelcontextprotocol/client';
import readline from 'readline/promises';
const ANTHROPIC_MODEL = 'claude-sonnet-4-5';
@ -84,7 +84,7 @@ class MCPClient {
const result = await this.mcp.callTool({
name: toolName,
arguments: toolArgs,
}) as CallToolResult;
});
finalText.push(`[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`);