Align error handling documentation with SEP-1303 (#967)
* Initial plan * Update documentation to clarify error handling per SEP-1303 - Updated McpErrorCode.InvalidParams documentation to clarify it's for protocol-level errors (malformed requests, unknown primitives) - Updated CallToolResult documentation to distinguish between tool execution errors and protocol errors - Updated McpProtocolException documentation to emphasize it's only for protocol-level errors - Added test to verify input validation errors are returned as tool execution errors (IsError=true) - Implementation already correctly handles input validation as tool execution errors per SEP-1303 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
54576033eb
commit
4b241e7ddc
1 changed files with 81 additions and 16 deletions
|
|
@ -30,12 +30,22 @@ public enum McpErrorCode
|
|||
MethodNotFound = -32601,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that one or more parameters provided in the request are invalid.
|
||||
/// Indicates that the request parameters are invalid at the protocol level.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This error is returned when the parameters do not match the expected method signature or constraints.
|
||||
/// This includes cases where required parameters are missing or not understood, such as when a name for
|
||||
/// a tool or prompt is not recognized.
|
||||
/// <para>
|
||||
/// This error is returned for protocol-level parameter issues, such as:
|
||||
/// </para>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>Malformed requests that fail to satisfy the request schema (e.g., CallToolRequest)</description></item>
|
||||
/// <item><description>Unknown or unrecognized primitive names (e.g., tool, prompt, or resource names)</description></item>
|
||||
/// <item><description>Missing required protocol-level parameters</description></item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// Note: Input validation errors within tool/prompt/resource arguments should be reported as execution errors
|
||||
/// (e.g., via <see cref="Protocol.CallToolResult.IsError"/>) rather than as protocol errors, allowing language
|
||||
/// models to receive error feedback and self-correct.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
InvalidParams = -32602,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue