agent-client-protocol-derive 0.11.0

Derive macros for Agent Client Protocol JSON-RPC traits
Documentation

Derive macros for Agent Client Protocol JSON-RPC traits.

This crate provides derive macros to reduce boilerplate when implementing custom JSON-RPC requests, notifications, and response types.

Example

use agent_client_protocol::{JsonRpcRequest, JsonRpcNotification, JsonRpcResponse};

#[derive(Debug, Clone, Serialize, Deserialize, JsonRpcRequest)]
#[request(method = "_hello", response = HelloResponse)]
struct HelloRequest {
    name: String,
}

#[derive(Debug, Serialize, Deserialize, JsonRpcResponse)]
#[response(method = "_hello")]
struct HelloResponse {
    greeting: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, JsonRpcNotification)]
#[notification(method = "_ping")]
struct PingNotification {
    timestamp: u64,
}

Using within the agent_client_protocol crate

When using these derives within the agent_client_protocol crate itself, add crate = crate:

#[derive(JsonRpcRequest)]
#[request(method = "_foo", response = FooResponse, crate = crate)]
struct FooRequest { ... }