INNER CODE UNIT · Rust
prompt
modelcontextprotocol/rust-sdk · crates/rmcp-macros/src/lib.rs:255
pub fn prompt(attr: TokenStream, input: TokenStream) -> TokenStream {
prompt::prompt(attr.into(), input.into())
.unwrap_or_else(|err| err.to_compile_error())
.into()
}
/// # prompt_router
///
/// This macro generates a prompt router based on functions marked with `#[rmcp::prompt]` in an implementation block.
///
/// It creates a function that returns a `PromptRouter` instance.
///
/// ## Usage
///
/// | field | type | usage |
/// | :- | :- | :- |
/// | `router` | `Ident` | The name of the router function to be generated. Defaults to `prompt_router`. |
/// | `vis` | `Visibility` | The visibility of the generated router function. Defaults to empty. |