isOutputLineTruncated function

bool isOutputLineTruncated(
  1. String output
)

Check if an output string appears to have been truncated. Matches the isOutputLineTruncated utility from the TS codebase.

Implementation

bool isOutputLineTruncated(String output) {
  if (output.isEmpty) return false;
  // Check for explicit truncation markers
  if (output.endsWith(_truncationMarker)) return true;
  if (output.endsWith('...')) return true;
  // Check if the last line appears cut off (no newline at end of very
  // long output)
  if (output.length > mcpMaxResultSizeChars) return true;
  return false;
}