-
Notifications
You must be signed in to change notification settings - Fork 705
Expand file tree
/
Copy pathMcpServerToolException.cs
More file actions
37 lines (34 loc) · 1.69 KB
/
McpServerToolException.cs
File metadata and controls
37 lines (34 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace ModelContextProtocol;
/// <summary>
/// Represents an exception that is thrown by an MCP tool to communicate detailed error information.
/// </summary>
/// <remarks>
/// This exception is used by MCP tools to provide detailed error messages when a tool execution fails.
/// Unlike <see cref="McpException"/>, this exception is intended for application-level errors within tool calls.
/// and does not include JSON-RPC error codes. The <see cref="Exception.Message"/> from this exception
/// will be propagated to the remote endpoint to inform the caller about the tool execution failure.
/// </remarks>
public class McpServerToolException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="McpServerToolException"/> class.
/// </summary>
public McpServerToolException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="McpServerToolException"/> class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public McpServerToolException(string message) : base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="McpServerToolException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
public McpServerToolException(string message, Exception? innerException) : base(message, innerException)
{
}
}