The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 19:45 UTC
fix(shared): html_render pages show for Grok threads (#35434)
Julius Marminge committed
Nov 12, 2026 at 10:01 UTC
ddd02848e601e63e04686fa636a818df90a8a207
2 files changed
+15
-1
packages/shared/src/htmlRender.test.ts
+10
@@ -169,6 +169,16 @@ describe("htmlRenderFromToolItem", () => {
169
["html_render", result],
170
// OpenCode 2 Code Mode reports a script's nested html_render call as one `execute` item.
171
["execute", JSON.stringify(result)],
172
+ // Grok CLI wraps MCP results as { type: "MCP", output: { OkayOutput: "<json>" } }.
173
+ [
174
+ "t3-code.html_render",
175
+ {
176
+ type: "MCP",
177
+ tool_name: "html_render",
178
+ server_name: "t3-code",
179
+ output: { OkayOutput: JSON.stringify(result) },
180
+ },
181
+ ],
182
] as const) {
183
expect(htmlRenderFromToolItem({ toolName, output })).toEqual(reference);
184
}
packages/shared/src/toolOutput.ts
+5
-1
@@ -100,7 +100,11 @@ function readResult(value: unknown, budget: ResultReadBudget, depth = 0): Result
100
value.is_error === true ||
101
value._tag === "OrchestratorMcpFailure" ||
102
value.error != null;
103
- const content = value.structuredContent ?? value.content;
103
+ // Grok CLI wraps MCP results as { type: "MCP", output: { OkayOutput: "<result json>" } }.
104
+ const content =
105
+ value.structuredContent ??
106
+ value.content ??
107
+ (Predicate.isObject(value.output) ? value.output.OkayOutput : undefined);
108
if (content !== undefined) {
109
const nested = readResult(content, budget, depth + 1);
110
return { ...nested, failed: failed || nested.failed };