use enum2schema::Schema;
use serde::{Deserialize, Serialize};
#[derive(Schema, Serialize, Deserialize)]
struct PlaceArgs {
entity: u32,
position: [f32; 3],
material: Option<String>,
}
#[derive(Schema, Serialize, Deserialize)]
struct PlaceReply {
placed: bool,
version: u64,
}
fn main() {
let descriptor =
enum2schema::mcp::tool_io::<PlaceArgs, PlaceReply>("place", "Place an entity in the scene");
println!("tool descriptor:");
println!("{}", serde_json::to_string_pretty(&descriptor).unwrap());
let request = PlaceArgs {
entity: 7,
position: [1.0, 0.0, 2.0],
material: Some("wood".to_string()),
};
println!("\nrequest: {}", serde_json::to_string(&request).unwrap());
let response = PlaceReply {
placed: true,
version: 42,
};
println!("response: {}", serde_json::to_string(&response).unwrap());
}