Skip to main content

require_str

Function require_str 

Source
pub fn require_str<'a>(
    args: &'a Value,
    name: &str,
) -> Result<&'a str, ToolCallResult>
Expand description

Extract a required string argument from a tools/call arguments object.

§Errors

Returns a ready-to-send isError: true ToolCallResult when the argument is absent (Missing required argument: <name>) or present with a non-string JSON type (Argument <name> must be a string, got <type>). The two messages are deliberately distinguishable — see the module header.