pub fn build_tool_args(
args: &[Arg],
ctx: &ExecContext,
schema: Option<&ToolSchema>,
) -> Result<ToolArgs, String>Expand description
Build ToolArgs from AST Args, evaluating expressions.
If a schema is provided, uses it to determine argument types:
- For
--flagwhere schema says type is non-bool: consume next positional as value - For
--flagwhere schema says type is bool (or unknown): treat as boolean flag
This enables natural shell syntax like mcp_tool --query "test" --limit 10.
Fallible: a bad/subscripted collection access (${u[nope]} on a record
without that key, a subscript on a scalar, ${#u[tags]} on an undefined
subscripted root) must fail loud here too, matching the four primary eval
sites (echo, assignment, $(( )), "${…}") — see [eval_simple_expr].