Add validation and error signaling guidance to MCP tool XML docs (#1275)

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:
Copilot 2026-02-17 19:45:48 -05:00 • committed by GitHub
commit ec4c732632
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,11 @@ namespace ModelContextProtocol;
///
/// This exception type can be thrown by MCP tools or tool call filters to propagate detailed error messages
/// from <see cref="Exception.Message"/> when a tool execution fails via a <see cref="CallToolResult"/>.
/// This includes input validation errors, business logic errors, or any other failure that the model should
/// be informed about. For example, if a required field is missing or a value is out of range, throwing an
/// <see cref="McpException"/> with a descriptive message allows the model to understand the issue and
/// potentially self-correct in a subsequent request.
///
/// For non-tool calls, this exception controls the message propagated via a <see cref="JsonRpcError"/>.
///
/// <see cref="McpProtocolException"/> is a derived type that can be used to also specify the