You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Represents an exception that is thrown when an Model Context Protocol (MCP) error occurs.
5
7
/// </summary>
6
8
/// <remarks>
7
-
/// This exception is used to represent failures to do with protocol-level concerns, such as invalid JSON-RPC requests,
8
-
/// invalid parameters, or internal errors. It is not intended to be used for application-level errors.
9
-
/// <see cref="Exception.Message"/> or <see cref="ErrorCode"/> from a <see cref="McpException"/> may be
10
-
/// propagated to the remote endpoint; sensitive information should not be included. If sensitive details need
11
-
/// to be included, a different exception type should be used.
9
+
/// The <see cref="Exception.Message"/> from a <see cref="McpException"/> may be propagated to the remote
10
+
/// endpoint; sensitive information should not be included. If sensitive details need to be included,
11
+
/// a different exception type should be used.
12
+
///
13
+
/// This exception type can be thrown by MCP tools or tool call filters to propagate detailed error messages
14
+
/// from <see cref="Exception.Message"/> when a tool execution fails via a <see cref="CallToolResult"/>.
15
+
/// For non-tool calls, this exception controls the message propogated via a <see cref="JsonRpcError"/>.
16
+
///
17
+
/// <see cref="McpProtocolException"/> is a derived type that can be used to also specify the
18
+
/// <see cref="McpErrorCode"/> that should be used for the resulting <see cref="JsonRpcError"/>.
12
19
/// </remarks>
13
20
publicclassMcpException:Exception
14
21
{
@@ -28,46 +35,13 @@ public McpException(string message) : base(message)
28
35
}
29
36
30
37
/// <summary>
31
-
/// Initializes a new instance of the <see cref="McpException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
38
+
/// Initializes a new instance of the <see cref="McpException"/> class with a specified error message and
39
+
/// a reference to the inner exception that is the cause of this exception.
32
40
/// </summary>
33
41
/// <param name="message">The message that describes the error.</param>
34
-
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
42
+
/// <param name="innerException">The exception that is the cause of the current exception, or a null
43
+
/// reference if no inner exception is specified.</param>
/// Initializes a new instance of the <see cref="McpException"/> class with a specified error message, inner exception, and JSON-RPC error code.
50
-
/// </summary>
51
-
/// <param name="message">The message that describes the error.</param>
52
-
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
/// Initializes a new instance of the <see cref="McpProtocolException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
32
+
/// </summary>
33
+
/// <param name="message">The message that describes the error.</param>
34
+
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
/// Initializes a new instance of the <see cref="McpProtocolException"/> class with a specified error message, inner exception, and JSON-RPC error code.
50
+
/// </summary>
51
+
/// <param name="message">The message that describes the error.</param>
52
+
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
0 commit comments