Skip to main content

parse_ask_question_args

Function parse_ask_question_args 

Source
pub fn parse_ask_question_args(
    args_json: &str,
) -> Result<Vec<QuestionItem>, QuestionArgsError>
Expand description

Parses and validates one ask_question call’s arguments (invariant I5).

Rejects: malformed JSON; a questions array of 0 or more than MAX_QUESTIONS_PER_CALL; a question missing header/question/ options; a header over MAX_HEADER_CHARS; a question or option description over MAX_SENTENCE_CHARS; an options array with fewer than MIN_OPTIONS or more than MAX_OPTIONS entries; an option with an empty or missing label/description, or a label over MAX_OPTION_LABEL_CHARS; more than one option marked recommended on the same question.

§Errors

Returns a complete, reader-facing sentence — fed back to the model verbatim as the tool call’s own {"error": ...} result, never a pause and never an event-log write (I5) — describing exactly what was wrong.