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

@ -109,7 +109,7 @@ First, let's set up our imports and create the basic client class in `src/index.
```ts source="../examples/client-quickstart/src/index.ts#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';
@ -201,7 +201,7 @@ Now let's add the core functionality for processing queries and handling tool ca
const result = await this.mcp.callTool({
name: toolName,
arguments: toolArgs,
}) as CallToolResult;
});
finalText.push(`[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`);