Table of Contents

Class ToolResultContentBlock

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents the result of a tool use, provided by the user back to the assistant.

public sealed class ToolResultContentBlock : ContentBlock
Inheritance
ToolResultContentBlock
Inherited Members
Extension Methods

Properties

Content

Gets or sets the unstructured result content of the tool use.

[JsonPropertyName("content")]
public required List<ContentBlock> Content { get; set; }

Property Value

List<ContentBlock>

Remarks

This value has the same format as CallToolResult.Content and can include text, images, audio, resource links, and embedded resources.

IsError

Gets or sets a value that indicates whether the tool use resulted in an error.

[JsonPropertyName("isError")]
public bool? IsError { get; set; }

Property Value

bool?

true if the tool use resulted in an error; false if it succeeded. The default is false.

Remarks

If true, the content typically describes the error that occurred.

StructuredContent

Gets or sets an optional structured result object.

[JsonPropertyName("structuredContent")]
public JsonElement? StructuredContent { get; set; }

Property Value

JsonElement?

Remarks

If the tool defined an outputSchema, this object should conform to that schema.

ToolUseId

Gets or sets the ID of the tool use this result corresponds to.

[JsonPropertyName("toolUseId")]
public required string ToolUseId { get; set; }

Property Value

string

Remarks

This value must match the ID from a previous ToolUseContentBlock.

Type

When overridden in a derived class, gets the type of content.

public override string Type { get; }

Property Value

string

The type of content. Valid values include "image", "audio", "text", "resource", "resource_link", "tool_use", and "tool_result".

Remarks

This value determines the structure of the content object.