← Back to Kontasks
MCP Tool Content Format Fix
Fixed MCP tool results using array format instead of string
Output
Found Second Bug: MCP Content Format
MCP tool results use a different content format than built-in tools. The first fix (tool_use_id Map) was correct, but MCP results weren't being parsed.
Root Cause
Built-in tools return content: "string result"
MCP tools return content: [{type: "text", text: "..."}]
The code was casting to string so MCP results became undefined.
Fix Applied
// Handle both string content and array content let resultContent: string | undefined; if (typeof content.content === "string") { resultContent = content.content; } else if (Array.isArray(content.content)) { // MCP tools return [{type: "text", text: "..."}] const textParts = content.content .filter(c => c.type === "text") .map(c => c.text); resultContent = textParts.join("\n"); }
Expected Result
After restarting konsole, MCP tools like mcp__konui__konui_create_task will appear in the Tool Time Distribution chart.
What's Next?
Choose an action:
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
telemetrybugmcp
Created
3 Jan 2026, 9:48 pm
Updated
3 Jan 2026, 9:48 pm
Created By
claude
Raw Data
{
"id": "1dec3331-241c-4dd5-9a5a-c53768e5504d",
"type": "general",
"status": "completed",
"title": "MCP Tool Content Format Fix",
"description": "Fixed MCP tool results using array format instead of string",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:system-ui,sans-serif;\"><h2 style=\"color:#f97316;margin:0 0 16px 0;\">Found Second Bug: MCP Content Format</h2><p style=\"color:#9ca3af;margin-bottom:16px;\">MCP tool results use a <strong>different content format</strong> than built-in tools. The first fix (tool_use_id Map) was correct, but MCP results weren't being parsed.</p><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"color:#ef4444;margin:0 0 12px 0;\">Root Cause</h4><p style=\"color:#9ca3af;margin:0;line-height:1.6;\">Built-in tools return <code style=\"background:#444;padding:2px 6px;border-radius:3px;\">content: \"string result\"</code></p><p style=\"color:#9ca3af;margin:8px 0 0 0;line-height:1.6;\">MCP tools return <code style=\"background:#444;padding:2px 6px;border-radius:3px;\">content: [{type: \"text\", text: \"...\"}]</code></p><p style=\"color:#9ca3af;margin:8px 0 0 0;line-height:1.6;\">The code was casting to <code>string</code> so MCP results became <code>undefined</code>.</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"color:#22c55e;margin:0 0 12px 0;\">Fix Applied</h4><pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;overflow-x:auto;color:#9ca3af;font-size:0.85rem;line-height:1.6;\"><span style=\"color:#7f848e;\">// Handle both string content and array content</span>\n<span style=\"color:#c678dd;\">let</span> resultContent: <span style=\"color:#e5c07b;\">string</span> | <span style=\"color:#e5c07b;\">undefined</span>;\n<span style=\"color:#c678dd;\">if</span> (<span style=\"color:#c678dd;\">typeof</span> content.content === <span style=\"color:#98c379;\">\"string\"</span>) {\n resultContent = content.content;\n} <span style=\"color:#c678dd;\">else if</span> (Array.isArray(content.content)) {\n <span style=\"color:#7f848e;\">// MCP tools return [{type: \"text\", text: \"...\"}]</span>\n <span style=\"color:#c678dd;\">const</span> textParts = content.content\n .filter(c => c.type === <span style=\"color:#98c379;\">\"text\"</span>)\n .map(c => c.text);\n resultContent = textParts.join(<span style=\"color:#98c379;\">\"\\n\"</span>);\n}</pre></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h4 style=\"color:#61afef;margin:0 0 8px 0;\">Expected Result</h4><p style=\"color:#9ca3af;margin:0;font-size:0.9rem;\">After restarting konsole, MCP tools like <code>mcp__konui__konui_create_task</code> will appear in the Tool Time Distribution chart.</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-top:16px;\"><h4 style=\"margin:0 0 8px 0;color:#fff;\">What's Next?</h4><p style=\"color:#9ca3af;margin:0;\">Choose an action:</p></div></div>",
"choices": [
{
"label": "Commit & restart",
"value": "Commit the MCP content format fix and restart konsole",
"primary": true
},
{
"label": "Run tests first",
"value": "Run konsole tests before committing"
},
{
"label": "View diff",
"value": "Show me the full diff of changes"
}
],
"requestedAt": "2026-01-03T11:50:00Z",
"requestId": "8e9775c8-165e-4297-b53e-f086b169b429"
},
"createdBy": "claude",
"createdAt": "2026-01-03T11:48:13.566Z",
"updatedAt": "2026-01-03T11:48:13.727Z",
"requestId": "8e9775c8-165e-4297-b53e-f086b169b429",
"scope": "vibetools",
"tags": [
"telemetry",
"bug",
"mcp"
],
"targetUser": "claude"
}