Merge pull request #93 from hideya/fix-client-node-example

Update the node client example for anthropic-ai/sdk 0.33
This commit is contained in:
Justin Spahr-Summers 2025-01-02 15:02:20 +00:00 • committed by GitHub
commit 2d4799b979
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,7 +85,6 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import Anthropic from "@anthropic-ai/sdk";
import dotenv from "dotenv";
import { Tool } from "@anthropic-ai/sdk/resources/messages.js";
import {
CallToolResultSchema,
ListToolsResultSchema,
@ -181,7 +180,7 @@ Now add the core functionality for processing queries and handling tool calls:
ListToolsResultSchema
);
const availableTools: Tool[] = toolsResponse.tools.map((tool: any) => ({
const availableTools = toolsResponse.tools.map((tool: any) => ({
name: tool.name,
description: tool.description,
input_schema: tool.inputSchema,
@ -211,7 +210,7 @@ Now add the core functionality for processing queries and handling tool calls:
method: "tools/call",
params: {
name: toolName,
args: toolArgs,
arguments: toolArgs,
},
},
CallToolResultSchema