From ag-ui-dotnet
Exposes client-side tools to an AG-UI agent via the .NET SDK: C# functions running in the client app (GPS, local state, device APIs) that the model can call and get results back automatically.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ag-ui-dotnet:agui-dotnet-client-toolsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Goal: let the model call a function that runs in the client app — to read something only the client has (location, local state, UI selection, a device API) — with the client executing the call and returning the result so the run continues to a final answer.
Goal: let the model call a function that runs in the client app — to read something only the client has (location, local state, UI selection, a device API) — with the client executing the call and returning the result so the run continues to a final answer.
A client tool is an ordinary Microsoft.Extensions.AI AIFunction you attach to the request via ChatOptions.Tools. AGUIChatClient is itself a function-invoking client, so it runs the tool locally and sends the result back automatically — you do not wrap it in UseFunctionInvocation.
dotnet add package AGUI.Client
Microsoft.Extensions.AI supplies AIFunctionFactory, ChatOptions, and AITool. Run dotnet package search AGUI.Client --exact-match for the current version.
Define the function in the client, wrap it with AIFunctionFactory.Create, and put it on ChatOptions.Tools:
using System.ComponentModel;
using AGUI.Client;
using Microsoft.Extensions.AI;
[Description("Get the user's current location from GPS.")]
static string GetUserLocation() => "Amsterdam, Netherlands (52.37°N, 4.90°E)";
using var httpClient = new HttpClient();
IChatClient client = new AGUIChatClient(new(httpClient, "http://localhost:5003"));
var options = new ChatOptions { Tools = [AIFunctionFactory.Create(GetUserLocation)] };
var messages = new List<ChatMessage> { new(ChatRole.User, "What's fun to do near me?") };
await foreach (var update in client.GetStreamingResponseAsync(messages, options))
{
Console.Write(update.Text);
}
When the model decides to call GetUserLocation, AGUIChatClient invokes it on this machine, returns the result to the server, and the run continues — the streamed text you print already reflects the location.
The server forwards a tool it doesn't own to the client instead of trying to run it. Register the server's chat client with function invocation and TerminateOnUnknownCalls so an unknown (client) tool ends the server turn cleanly and is surfaced to the client to execute:
builder.Services.AddChatClient(/* provider IChatClient */)
.UseFunctionInvocation(fic => fic.TerminateOnUnknownCalls = true);
The server declares none of the client's tools; it only needs to forward them.
UseFunctionInvocation. AGUIChatClient already invokes functions; adding another function-invoking layer double-handles the call and can execute it twice or strip the AG-UI tool routing. Pass the tool through ChatOptions.Tools and let the client invoke it.RUN_FINISHED in a single client call — you wrote no code to send the tool result back.npx claudepluginhub ag-ui-protocol/ag-ui --plugin ag-ui-dotnetExposes server-side backend tools for AG-UI agents using the .NET SDK. Define AIFunctions, register on IChatClient, and let the model call C# functions running on the server.
Creates and manages persistent AI agents in .NET using Azure SDK for threads, messages, runs, tools, function calling, file search, and code interpreter.
Low-level .NET SDK for creating and managing persistent Azure AI agents with threads, messages, runs, and tools.