Solutions · AI agents · Tools & function calling

Agents that do things.

A model that can only talk is a chat box. An agent earns its name when it can call functions, query databases, parse PDFs, search the web, and write to disk. LM-Kit.NET ships 70+ built-in tools across 8 categories, a typed ITool interface, and [LMFunction] attribute binding so any C# method becomes callable in seconds. All on-device.

70+ built-in tools 8 categories Atomic, composable, secured

Custom tools

Implement ITool or annotate any method with [LMFunction]. Schemas are inferred from your types.

Built-in tools

HTTP, file system, web search, PDF, OCR, calculator, regex, JSON, SQL, and more, ready to register.

Secured by default

Every tool ships with metadata: category, side-effect, risk level, idempotence. Drives ToolPermissionPolicy.

Problem statement

Hand-rolled function calling is a tarpit.

A naive function-calling agent looks easy until you ship it. The hard parts hit later: schema generation, argument validation, permission gates, error recovery, observability, and grammar-constrained decoding so the model cannot emit malformed JSON. LM-Kit handles each one.

Schemas inferred

Method parameters become a JSON Schema automatically. No hand-written tool definitions, no drift between your code and the prompt.

Grammar-constrained decoding

When the model is choosing a tool, it cannot emit invalid JSON. The grammar is built from the registered tools at decode time. No retry loops on malformed calls.

Atomic operations

One tool, one feature. filesystem_read, filesystem_write, http_get, http_post. Wildcard policies (filesystem_*) get natural domain-level control.

Side-effect awareness

IToolMetadata exposes SideEffect, RiskLevel, IsReadOnly, IsIdempotent. Decisions become policy, not vibes.

Tool invocation events

BeforeToolInvocation and AfterToolInvocation events let you log, override, or cancel a call before it runs.

Cancellation and timeouts

Tools accept CancellationToken. The agent execution loop respects them. No more agent runs hanging on a slow HTTP call.

Build custom tools

Two paths, one runtime.

Pick the friction level that matches your tool. Reach for [LMFunction] for one-line bindings of existing methods, or implement ITool when you need full control over schema, streaming, side-effect declaration and metadata.

Annotate any C# method with [LMFunction] and register the whole class in one call. Schema is inferred from parameter types.

LMFunctionAttribute.cs
using LMKit.Agents.Tools;

// Annotate any C# method. The agent sees its name, description, and inferred schema.
public class WeatherTools
{
    [LMFunction(Name = "get_current_weather",
                Description = "Returns current weather for a city. Units default to celsius.")]
    public WeatherReport GetCurrentWeather(string city, string units = "c")
    {
        // Existing business logic. Untouched by LM-Kit.
        return _weatherService.Lookup(city, units);
    }
}

// Register the whole class with one call.
var agent = Agent.CreateBuilder(model)
    .WithTools(t => t.AddFromInstance(new WeatherTools()))
    .Build();
Built-in tools

Eight categories, seventy-plus tools.

Atomic by design: one tool equals one feature. New tools are added in every release, so do not hard-code the count. Each category exposes a group registration helper (tools.AddDataTools(), tools.AddNetTools(), etc.).

data

Data

JSON, XML, CSV, YAML, HTML, Markdown parsing and transformation. Spreadsheets, SQLite databases, QR codes, base64, hex.

document

Document

PDF read, split, merge, page extraction. Image preprocessing, native OCR. Markdown / EML / HTML / DOCX conversion.

text

Text

Diff, regex, templating, encoding, slugification, fuzzy matching, phonetics, Unicode normalisation, case operations.

numeric

Numeric

Calculator, expression evaluator, unit conversion, statistics, financial math, random numbers.

security

Security

Hashing (MD5, SHA, BLAKE), symmetric encryption, JWT issue/verify, password generation, checksums, validation primitives.

utility

Utility

Date/time arithmetic, cron expressions, URL parsing, color manipulation, locale, MIME types, paths, scheduling, time zones.

io

I/O

File system read/write/list/copy/move/delete, process execution, compression (zip, tar, gzip), clipboard, environment variables, file watching.

net

Network

HTTP (GET/POST/PUT/PATCH/DELETE/HEAD), FTP, web search (DuckDuckGo, Brave, Tavily, Serper, SearXNG), network diagnostics, SMTP, RSS feeds.

WebSearchTool providers

Six providers, one tool.

Switch search backends without changing your agent. Free providers for hobby projects, premium providers for production scale.

DuckDuckGo

Free, no API key

Default provider. HTML scraping, no auth, good for prototyping.

Brave

High quality, free tier

Curated index, generous free tier, simple API key auth.

Tavily

RAG-optimised

Designed for AI workloads. Returns clean, citation-friendly content.

Serper

Google results

Google search via API. High quality, predictable pricing.

SearXNG

Self-hosted

Run your own meta-search instance. Zero third-party dependency.

Custom

Bring your own

Implement the provider interface to plug in any internal search backend.

Lightweight: SingleFunctionCall

When you do not need a full agent.

For one-shot natural-language-to-method routing without the overhead of a planning loop, SingleFunctionCall is the lightweight path. Hand it a prompt and a method registry. It picks one, extracts arguments, and optionally invokes.

SingleFunctionCall.cs
using LMKit.FunctionCalling;

var caller = new SingleFunctionCall(model);
caller.Plugins.Add(new BookPlugin());

// One prompt, one method selected, arguments extracted, return value bound.
FunctionCallResult r = await caller.InvokeAsync(
    "Find me a thriller written by an author whose surname starts with K.");

Console.WriteLine(r.Method.Name);   // SearchBooks
Console.WriteLine(r.Confidence);    // 0.92
Versus the alternatives

Why hand-rolling tools is the wrong default.

LangChain Tools

Python-first. No first-class .NET story. No standardised security metadata. Tools live in scattered community packages.

Semantic Kernel Plugins

Plugins exist but are opinionated toward Microsoft Graph and Azure OpenAI. Local model integration is secondary; tool catalog is sparse.

LM-Kit.NET

Native .NET, 70+ atomic tools, typed metadata for permission policies, grammar-constrained decoding so the model cannot emit invalid JSON.

Related capabilities

Tools plus the rest.

Permission policies

Allow, deny, or require approval per tool, category, or risk level. Centralised security for tool calls.

Permissions page

MCP integration

Connect to any MCP server (GitHub, Slack, internal services) and register its tools alongside your local ones.

MCP page

Filter pipeline

Intercept tool invocations with ASP.NET-style middleware. Log, redact, rate-limit, validate.

Filter pipeline page

Structured content creation

Grammar-constrained generation underpins reliable tool calling. Same primitive, different audience.

Grammar page

Tools your agents can actually use.

Get Community Edition Download