Ollama/ToolCalling/AgentTool.cscsharp

Documentation

Tool calling (Version 3)

Agent-Core exposes a small tool registry for Ollama function calling. Lilith registers these tools on the chat client at boot.

| Tool | Description | |------|-------------| | get_time | Current local time | | get_date | Today's local date |

Register more tools with ToolRegistry.Register before chat starts.

namespace Agent.Core.ToolCalling;/// <summary>Built-in or custom tool the model may invoke during chat.</summary>public sealed class AgentTool{    public AgentTool(        string name,        string description,        Func<string, string> invoke,        object? parametersSchema = null,        ToolCategory category = ToolCategory.Core)    {        Name = name;        Description = description;        Invoke = invoke;        ParametersSchema = parametersSchema ?? EmptyParametersSchema;        Category = category;    }    public string Name { get; }    public string Description { get; }    public Func<string, string> Invoke { get; }    public object ParametersSchema { get; }    public ToolCategory Category { get; }    private static object EmptyParametersSchema => new    {        type = "object",        properties = new { },    };}