- Namespace
- ModelContextProtocol
- Assembly
- ModelContextProtocol.Core.dll
Represents an exception that is thrown when a Model Context Protocol (MCP) protocol-level error occurs.
public class McpProtocolException : McpException, ISerializable
- Inheritance
-
McpProtocolException
- Implements
- Derived
- Inherited Members
Constructors
McpProtocolException()
public McpProtocolException()
McpProtocolException(string)
Initializes a new instance of the McpProtocolException class with a specified error message.
public McpProtocolException(string message)
Parameters
messagestringThe message that describes the error.
McpProtocolException(string, McpErrorCode)
Initializes a new instance of the McpProtocolException class with a specified error message and JSON-RPC error code.
public McpProtocolException(string message, McpErrorCode errorCode)
Parameters
messagestringThe message that describes the error.
errorCodeMcpErrorCodeAn McpErrorCode.
McpProtocolException(string, Exception?)
Initializes a new instance of the McpProtocolException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public McpProtocolException(string message, Exception? innerException)
Parameters
messagestringThe message that describes the error.
innerExceptionExceptionThe exception that is the cause of the current exception, or a null reference if no inner exception is specified.
McpProtocolException(string, Exception?, McpErrorCode)
Initializes a new instance of the McpProtocolException class with a specified error message, inner exception, and JSON-RPC error code.
public McpProtocolException(string message, Exception? innerException, McpErrorCode errorCode)
Parameters
messagestringThe message that describes the error.
innerExceptionExceptionThe exception that is the cause of the current exception, or a null reference if no inner exception is specified.
errorCodeMcpErrorCodeAn McpErrorCode.
Properties
ErrorCode
Gets the error code associated with this exception.
public McpErrorCode ErrorCode { get; }