mirror of
https://github.com/zap-proto/dev.git
synced 2026-10-30 15:05:18 +00:00
Folds rich SDK content out of hanzoai/docs into zap-proto/dev (canonical brand). Per-SDK pages: typescript, go, python, rust, cpp, c, java, csharp, ocaml, haskell, erlang. Each carries install, quick-start, client API, gateway, error handling, server impl, and testing. Top-level /sdks/ adds the matrix of all 33 zap-proto repos (core SDKs, community SDKs, wire encoders, editor plugins, tools, protocols over ZAP, spec/research).
58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
---
|
|
title: C#
|
|
description: ZAP C# SDK - .NET binding with async support
|
|
---
|
|
|
|
# C# Binding
|
|
|
|
The C# binding provides .NET integration with async/await support.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
dotnet add package Zap.Protocol
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```csharp
|
|
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-proto/spec-dotnet](https://github.com/zap-proto/spec-dotnet).
|