MCPClientError
Namespace: Vercel.AI.Mcp
public class MCPClientError : AiSdkException, ISerializableAn MCP call failed. Carries the JSON-RPC and HTTP details when the transport has them.
Inheritance: object → Exception → AiSdkException
Implements: ISerializable
Constructors
Section titled “Constructors”MCPClientError(string, int?, int?, string?, string?, JsonElement?, Exception?)
Section titled “MCPClientError(string, int?, int?, string?, string?, JsonElement?, Exception?)”public MCPClientError(string message, int? code = null, int? statusCode = null, string? url = null, string? responseBody = null, JsonElement? data = null, Exception? cause = null)Creates the error with optional MCP error metadata.
Parameters
| Name | Type | Description |
|---|---|---|
message |
string | |
code |
int? | |
statusCode |
int? | |
url |
string | |
responseBody |
string | |
data |
JsonElement? | |
cause |
Exception |
Properties
Section titled “Properties”public int? Code { get; }JSON-RPC error.code. This is not the HTTP status.
Value: int?
public JsonElement? Data { get; }JSON-RPC error.data, when the server sent it.
Value: JsonElement?
ResponseBody
Section titled “ResponseBody”public string? ResponseBody { get; }Raw response text.
Value: string
StatusCode
Section titled “StatusCode”public int? StatusCode { get; }HTTP status, when the failure came from an HTTP transport.
Value: int?
public string? Url { get; }MCP endpoint URL.
Value: string
Methods
Section titled “Methods”IsInstance(Exception?)
Section titled “IsInstance(Exception?)”public static bool IsInstance(Exception? error)Returns whether <code class=“paramref”>error</code> is an MCPClientError.
Parameters
| Name | Type | Description |
|---|---|---|
error |
Exception |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product