What is the problem this feature would solve?
Sometimes llms return invalid, but repairable JSON . For example, GLM 4.6 from OpenRouter sometimes adds {} after a valid JSON object. OpenRouter's "response healing" doesn't help in this case.
What is the feature you are proposing to solve the problem?
Right now function Tool.unsafeSecureJsonParse is being invoked on each tool call and fails when provided with invalid JSON. I would like an option to override or disable this behavior and parse the llm response myself.
What alternatives have you considered?
For now I just retry until it succeeds.