Skip to content

McpClient

Namespace: Vercel.AI.Mcp

public static class McpClient

Lists MCP tools and adapts them to Tool.

Inheritance: object

View source

ConnectAsync(IMcpTransport, CancellationToken)

Section titled “ConnectAsync(IMcpTransport, CancellationToken)”
public static Task<IReadOnlyList<Tool>> ConnectAsync(IMcpTransport transport, CancellationToken cancellationToken = default)

Calls initialize, then tools/list.

Parameters

Name Type Description
transport IMcpTransport
cancellationToken CancellationToken

Returns: Task<IReadOnlyList<Tool>>

View source

ListToolsAsync(IMcpTransport, CancellationToken)

Section titled “ListToolsAsync(IMcpTransport, CancellationToken)”
public static Task<IReadOnlyList<Tool>> ListToolsAsync(IMcpTransport transport, CancellationToken cancellationToken = default)

Maps tools/list onto SDK tools. Execution calls tools/call.

Parameters

Name Type Description
transport IMcpTransport
cancellationToken CancellationToken

Returns: Task<IReadOnlyList<Tool>>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product