wrapMcpClient<T extends McpClientLike>(client: T, options: WrapMcpOptions = {}): T| Name | Type | Description |
|---|---|---|
client* | T | |
options | WrapMcpOptions | Default: {} |
Trace each tool call an MCP client makes.
Each callTool becomes a tool run, nested under the current trace when
there is one. The client is changed in place and returned.
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { wrapMcpClient } from "langsmith/wrappers/mcp";
const client = wrapMcpClient(new Client({ name: "app", version: "1.0.0" }), {
distributedTracing: true,
});
await client.callTool({ name: "get_weather", arguments: { city: "Paris" } });