pub struct Tool { /* private fields */ }Expand description
A typed application tool executed by the Merry runtime.
The tool’s input schema is derived from I. The handler runs as trusted
in-process application code; runtime owns invocation ordering, lifecycle,
artifact recording, and model continuation. Use the explicit host handoff
protocol only when a different language runtime owns the callable.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn spec_for<I>(
name: impl AsRef<str>,
description: impl AsRef<str>,
) -> Result<ToolSpec, ToolBuildError>where
I: DeserializeOwned + JsonSchema,
pub fn spec_for<I>(
name: impl AsRef<str>,
description: impl AsRef<str>,
) -> Result<ToolSpec, ToolBuildError>where
I: DeserializeOwned + JsonSchema,
Creates a provider-neutral tool specification from a typed input.
This is useful for runtime-owned executors that need the same schema
derivation as Self::new but must retain custom execution, tracing,
cancellation, or action-policy behavior.
Sourcepub fn new<I, O, F, Fut, E>(
name: impl AsRef<str>,
description: impl AsRef<str>,
handler: F,
) -> Result<Self, ToolBuildError>
pub fn new<I, O, F, Fut, E>( name: impl AsRef<str>, description: impl AsRef<str>, handler: F, ) -> Result<Self, ToolBuildError>
Creates a typed asynchronous application tool.
Handler errors become durable failed tool results, allowing the model loop to observe the failure and recover. Serialization or argument decoding failures are also represented as tool failures where the call has already been admitted by runtime.