parse static method
Attempts to parse function call from text in any supported format
Implementation
static FunctionCallResponse? parse(String text) {
if (text.trim().isEmpty) return null;
try {
// Clean up model response tags
final content = _cleanModelResponse(text);
// Try each format in order of specificity
return _parseToolCodeBlock(content) ?? _parseMarkdownBlock(content) ?? _parseDirectJson(content);
} catch (e) {
debugPrint('FunctionCallParser: Error parsing function call: $e');
return null;
}
}