From a411c415a808fa433aeaf79f3776556269906f57 Mon Sep 17 00:00:00 2001
From: Sandy Tao <sandytao520@icloud.com>
Date: Tue, 24 Jun 2025 14:10:41 -0700
Subject: Do not render mcp responses as markdown (#1388)

---
 packages/cli/src/ui/components/messages/ToolMessage.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'packages/cli/src/ui/components/messages/ToolMessage.tsx')

diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx
index dd23381e..6cb3f8f3 100644
--- a/packages/cli/src/ui/components/messages/ToolMessage.tsx
+++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx
@@ -44,6 +44,13 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
       )
     : undefined;
 
+  // Long tool call response in MarkdownDisplay doesn't repect availableTerminalHeight properly,
+  // we're forcing it to not render as markdown when the response is too long, it will fallback
+  // to render as plain text, which is contained within the terminal using MaxSizedBox
+  if (availableHeight) {
+    renderOutputAsMarkdown = false;
+  }
+
   const childWidth = terminalWidth - 3; // account for padding.
 
   return (
-- 
cgit v1.2.3

