Class McpException | MCP C# SDK

Namespace
ModelContextProtocol
Assembly
ModelContextProtocol.Core.dll

Represents an exception that is thrown when a Model Context Protocol (MCP) error occurs.

public class McpException : Exception, ISerializable
Inheritance

McpException

Implements
Derived
Inherited Members

Constructors

McpException()

Initializes a new instance of the McpException class.

McpException(string)

Initializes a new instance of the McpException class with a specified error message.

public McpException(string message)

Parameters

message string

The message that describes the error.

McpException(string, Exception?)

Initializes a new instance of the McpException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public McpException(string message, Exception? innerException)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that is the cause of the current exception, or a null reference if no inner exception is specified.