#[tool]Expand description
#[tool]: an async fn becomes a Tool. See the crate docs.
Turns an async fn into a tool: keeps the function, and generates a unit
struct (the function’s name in UpperCamelCase) that implements
adam::Tool.
- The doc comment of the function is the tool’s description, and the doc comment of each parameter is that argument’s description. Wrapped lines are joined, blank lines separate paragraphs.
- A
&ToolCtxparameter (at most one) receives the call’s context, and aState<T>parameter receives the sharedTthe agent was given (and is reported byTool::required_state). Every other parameter is an argument the model fills in. #[args] a: MyArgstakes an existingDeserialize + JsonSchemastruct as the whole argument object.- The return type is
Result<T, E>or a bareT, withT: IntoToolOutputandE: Into<ToolError>.
Options: name = "..." (the tool’s name, default the function’s),
type = Ident (the generated struct, default the function’s name in
UpperCamelCase), strict (unknown argument fields are an error),
classify (the error is adam_error::Classify: retryable errors become
ToolError::Transient, or ToolError::Retryable with the class for a rate limit or a conflict,
others Permanent), retry(attempts = 3, backoff = "1s", max_backoff = "30s", multiplier = 2.0, on = ["rate-limited"]) (the tool’s retry policy, Tool::retry_policy:
attempts is required, durations are 500ms, 1s, 30m or 1h, on lists transient,
rate-limited and conflict, and what is left out is RetryPolicy’s default), asks_user (the tool can end a call with
ToolError::NeedsInput: Tool::asks_user says true; a subagent may have it, and the loop decides per run whether
the person can be asked) and
step = "subagent", label = "Helper" and icon = "agent" (how a call is drawn as a step,
Tool::step_style: the kind, a label instead of the tool’s name, and an icon; each from the closed
vocabulary of the steps/v1 extension, and any other word is an error that lists them),
parallel = "independent" | "read" | "write" | "exclusive" with an optional path = "<argument>",
or access = path::to::fn (what a call shares with the other calls of its turn,
Tool::access: read and write use files, or files/<path> when path names a string
argument, normalised lexically and widened to files when absolute or with ..; access is a
fn(&Value) -> ToolAccess; without any of them the tool runs alone) and crate = path (where
Tool and __private are, default ::adam; ::adam_llm_agent for a
crate without the facade).