Table of Contents

Class ToolCallResult

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

Represents the outcome of executing a single tool call.

Instances of ToolCallResult are created by the runtime after invoking a tool and are sent back into the chat loop so the model can produce a final answer that incorporates the tool output.

The result is correlated to its originating request via ToolCallId. The payload itself is provided as JSON in ResultJson and is classified via Type.

public sealed class ToolCallResult
Inheritance
ToolCallResult
Inherited Members

Remarks

  • Immutability: This type is immutable after construction and therefore thread-safe for concurrent readers.
  • JSON normalization: Blank or whitespace payloads are normalized to "null" to guarantee valid JSON.
  • Error/cancel semantics: Use Type to discriminate result kinds; there is no boolean ambiguity.

Properties

ResultJson

JSON-encoded result payload returned by the tool.

This string is normalized to a valid JSON value; when blank or whitespace it is set to "null". Prefer compact, structured JSON suitable for direct consumption by the model.

ToolCallId

Identifier that correlates this result with the originating tool call.

This should match the Id of the corresponding ToolCall so downstream logic (and the model) can associate the result with the correct request.

ToolName

The name of the tool that was executed.

This should match an Name registered in the tool registry. It is included for traceability and may be surfaced to the model or logs.

Type

Classifies the outcome of the tool call (e.g., Success, Error, Canceled).