Skip to main content

Module client

Module client 

Source
Expand description

ZAP client implementation

Provides a high-level async client for connecting to ZAP servers and gateways. Uses Cap’n Proto RPC over the twoparty VatNetwork.

§Example

use zap::{Client, Result};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<()> {
    let client = Client::connect("zap://localhost:9999").await?;

    // Initialize connection
    let server_info = client.init("my-client", "1.0.0").await?;
    println!("Connected to: {} v{}", server_info.name, server_info.version);

    // List and call tools
    let tools = client.list_tools().await?;
    let result = client.call_tool("search", json!({"query": "hello"})).await?;

    Ok(())
}

Structs§

Client
ZAP client for connecting to ZAP gateways
ClientInfo
Client info sent during initialization
Prompt
Prompt definition
PromptArgument
Prompt argument
PromptMessage
Prompt message
Resource
Resource definition
ResourceContent
Resource content
ResourceStream
Resource stream for subscription-based updates
ServerCapabilities
Server capabilities
ServerInfo
Server info received during initialization
Tool
Tool definition

Enums§

Content
Content types
LogLevel
Log level for server logging
MessageContent
Message content
Role
Message role