Class McpToolResult
The result of an MCP tool call: one or more content blocks, an optional machine-readable projection, and a flag marking tool-level failures.
[Obfuscation(Exclude = true)]
public sealed class McpToolResult
- Inheritance
-
McpToolResult
- Inherited Members
Remarks
A tool failure is reported by setting IsError on a successful JSON-RPC response, not by returning a protocol error. This lets the caller see what went wrong and correct itself, which a transport-level error would not allow.
Properties
- Content
Gets the content blocks returned to the caller.
- IsError
Gets or sets a value indicating whether the call failed. When
true, the content should explain what happened and how to proceed.
- StructuredContentJson
Gets or sets a JSON object carrying the machine-readable form of the result, mirroring the tool's output schema. Supplied alongside the textual content, never instead of it.
Methods
- Add(McpContent)
Appends a content block.
- FromError(string)
Creates a failed result. The message should state what went wrong and, where possible, the corrective action, so the caller can recover without a round trip to the user.
- FromText(string)
Creates a result carrying a single text block.