Table of Contents

Property ResultJson

Namespace
LMKit.Agents.Tools
Assembly
LM-Kit.NET.dll

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

Remarks

The content depends on the Type:

TypeExpected Content
SuccessThe tool's return value as JSON
ErrorError details (message, code, etc.)
CanceledCancellation reason
TimeoutTimeout details (duration, etc.)

Blank or whitespace values are normalized to "null" to ensure valid JSON.