ZAP Protocol
Language Bindings

C#

ZAP C# SDK - .NET binding with async support

C# Binding

The C# binding provides .NET integration with async/await support.

Installation

dotnet add package Zap.Protocol

Quick Start

using Zap;

var client = await Zap.ConnectAsync("zap://localhost:9000");

var server = await client.InitAsync(new ClientInfo
{
    Name = "my-agent",
    Version = "1.0.0"
});
Console.WriteLine($"Connected to: {server.Name} v{server.Version}");

var tools = await client.ListToolsAsync();
foreach (var tool in tools)
{
    Console.WriteLine($"  {tool.Name} - {tool.Description}");
}

var result = await client.CallToolAsync(new ToolCall
{
    Id = Guid.NewGuid().ToString(),
    Name = "read_file",
    Args = "{\"path\": \"/etc/hosts\"}"
});

if (result.Error != null)
{
    Console.Error.WriteLine($"Error: {result.Error}");
}
else
{
    Console.WriteLine($"Result: {result.Content}");
}

await client.CloseAsync();

Documentation

Full documentation at zap-protocol/zap-dotnet.

Last updated on

On this page