formatToolOutput method
Formats tool execution output with a header.
Implementation
String formatToolOutput(
String toolName,
String output, {
OutputFormat? format,
}) {
final fmt = format ?? this.format;
switch (fmt) {
case OutputFormat.plain:
return '[$toolName]\n$output';
case OutputFormat.rich:
return '${theme.info}[$toolName]${theme.reset}\n$output';
case OutputFormat.json:
return '{"tool":"$toolName","output":${_jsonEscape(output)}}';
case OutputFormat.markdown:
return '### $toolName\n\n```\n$output\n```';
case OutputFormat.minimal:
return output;
}
}