Ollama/ToolCalling/BuiltInTools.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.

using System.Globalization;namespace Agent.Core.ToolCalling;/// <summary>Default Agent-Core tools: current local time and date.</summary>public static class BuiltInTools{    public const string GetTimeName = "get_time";    public const string GetDateName = "get_date";    public static void Register(ToolRegistry registry)    {        registry.Register(new AgentTool(            GetTimeName,            "Returns the current local time on this machine.",            _ => DateTime.Now.ToString("T", CultureInfo.CurrentCulture)));        registry.Register(new AgentTool(            GetDateName,            "Returns today's local date on this machine.",            _ => DateTime.Now.ToString("D", CultureInfo.CurrentCulture)));    }}