//! Reference system plugin: one echo tool over the smith:plugin world. #![expect(missing_docs, reason = "wit-bindgen generates the world surface")] #![expect(clippy::pedantic, reason = "wit-bindgen generates the world surface")] wit_bindgen::generate!({ path: "../../wit/smith-plugin.wit", world: "plugin-world", }); use exports::smith::plugin::plugin::{Guest, ToolDeclaration}; struct EchoPlugin; impl Guest for EchoPlugin { fn declare_tools() -> Vec { vec![ToolDeclaration { name: "echo".to_string(), description: "Echoes the input string back verbatim.".to_string(), }] } fn invoke(name: String, input_json: String) -> Result { if name == "echo" { Ok(input_json) } else { Err(format!("unknown tool: {name}")) } } } export!(EchoPlugin);