Class ToolCallResult
What a call of a tool answers: a text for an assistant to read, and the same result as structured data where the tool has an OutputSchema.
public record ToolCallResult : IEquatable<ToolCallResult>
- Inheritance
-
ToolCallResult
- Implements
- Derived
- Inherited Members
Remarks
Text in a result that comes from the workspace (comments, strings, names) is data the code holds, and a result says it as such.
Properties
Content
What the call answers, for an assistant to read.
public IReadOnlyList<ToolContent> Content { get; init; }
Property Value
IsError
Whether the tool refused the call: Content says why.
public bool IsError { get; init; }
Property Value
StructuredContent
The result as data, as the tool's OutputSchema describes it; null for a result in text alone, and for a refusal.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public JsonObject? StructuredContent { get; init; }
Property Value
Methods
Of(string, JsonObject?)
A result in text alone.
public static ToolCallResult Of(string text, JsonObject? structured = null)
Parameters
textstringWhat the call answers.
structuredJsonObjectThe same result as data; null for none.
Returns
- ToolCallResult
The result.
Refusal(string)
A refusal: the call did nothing, for the reason given.
public static ToolCallResult Refusal(string reason)
Parameters
reasonstringWhy, for an assistant to read.
Returns
- ToolCallResult
The result.