Table of Contents

Class AfterToolInvocationEventArgs

Namespace
LMKit.TextGeneration.Events
Assembly
LM-Kit.NET.dll

Raised after a tool invocation completes (or is cancelled), providing the ToolCallResult returned to the model.

public sealed class AfterToolInvocationEventArgs : EventArgs
Inheritance
AfterToolInvocationEventArgs
Inherited Members

Examples

The following example shows how to subscribe to the AfterToolInvocation event and log the result returned by a tool call.

using LMKit.Model;
using LMKit.TextGeneration;
using LMKit.TextGeneration.Events;

LM model = LM.LoadFromModelID("gemma3:4b");
var chat = new MultiTurnConversation(model);

chat.AfterToolInvocation += (sender, e) =>
{
    Console.WriteLine($"Tool: {e.ToolCallResult.ToolName}");
    Console.WriteLine($"Status: {e.ToolCallResult.Type}");
    Console.WriteLine($"Result: {e.ToolCallResult.ResultJson}");
};

var response = chat.Submit("What is the current time?");

Properties

ToolCallResult

The result that will be (or was) sent back to the model.

Share