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 has the same format as CallToolResult.Content and can include text, images, audio, resource links, and embedded resources.

IsError

Gets or sets whether the tool use resulted in an error.

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

Property Value

bool?

Remarks

If true, the content typically describes the error that occurred. Default: false

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 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 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

Remarks

This determines the structure of the content object. Valid values include "image", "audio", "text", "resource", "resource_link", "tool_use", and "tool_result".