pub trait AsyncPromptHandler: Sized {
type Arguments: PromptArguments;
const NAME: &'static str;
const DESCRIPTION: Option<&'static str> = None;
// Required method
fn resolve_async(
args: Value,
) -> impl Future<Output = Result<Vec<PromptMessage>, String>>;
}
Expand description
Async trait for implementing MCP prompts.
Prompts are templates that can be resolved with arguments to produce messages. This async version allows for non-blocking operations like external API calls, etc.
Required Associated Constants§
Provided Associated Constants§
Sourceconst DESCRIPTION: Option<&'static str> = None
const DESCRIPTION: Option<&'static str> = None
Optional description of what the prompt does.
Required Associated Types§
Sourcetype Arguments: PromptArguments
type Arguments: PromptArguments
The type that defines the prompt’s arguments.
Required Methods§
Sourcefn resolve_async(
args: Value,
) -> impl Future<Output = Result<Vec<PromptMessage>, String>>
fn resolve_async( args: Value, ) -> impl Future<Output = Result<Vec<PromptMessage>, String>>
Resolves the prompt with the given arguments to produce messages asynchronously.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.