// A tools bundle in Rust: one tool of its own and one seat verb, served over stdio. use mesh_sdk::{serve, Tool}; use serde_json::{json, Map, Value}; fn greet(a: &Map) -> Result { let who = a.get("who").and_then(Value::as_str).unwrap_or("world"); Ok(json!({"greeting": format!("hello {}", who), "language": "rust"})) } fn on(_: &Map) -> Result { Ok(json!({"on": true, "language": "rust"})) } fn main() -> std::io::Result<()> { serve("rust-example", &[ Tool { name: "greet", description: "say hello", input: json!({"who": {"type": "string", "description": "whom"}}), run: greet }, Tool { name: "node-lamp.on", description: "the seat's verb", input: json!({}), run: on }, ]) }