Property ResultJson
ResultJson
Gets the JSON payload returned by the tool or describing the outcome.
public string ResultJson { get; }
Property Value
- string
A valid JSON string containing the tool's output or error information.
Examples
Example: Processing result based on type
switch (toolResult.Type)
{
case ToolCallResultType.Success:
var data = JsonSerializer.Deserialize<SearchResults>(toolResult.ResultJson);
Console.WriteLine($"Found {data.TotalResults} results");
break;
case ToolCallResultType.Error:
Console.WriteLine($"Tool error: {toolResult.ResultJson}");
break;
case ToolCallResultType.Timeout:
Console.WriteLine("Tool timed out, retrying...");
break;
}