Skip to main content

parse_format

Function parse_format 

Source
pub fn parse_format(
    tool_name: &str,
    format_str: Option<&str>,
    allowed: &[Format],
) -> Result<Format, CallToolError>
Expand description

Parse and validate a format string against the formats a tool supports.

allowed lists the formats the calling tool actually accepts. Both an unrecognized string and a recognized format outside allowed produce an error that lists only the supported formats, so a caller is never advised to retry with a format the tool will then reject. None defaults to markdown, which every tool supports.