[Bug] MCP Server Tool Response: structuredContent Displayed While content Array Ignored
Bug Description
When an MCP server returns a tool response containing both content (array of text/data) and structuredContent (metadata), Claude Code only displays structuredContent and ignores content.
Environment Info
- Platform: darwin
- Terminal: tmux
- Version: 2.0.67
- Feedback ID: 6f82e95d-a1ab-409a-a310-e12b0b9f9a0b
Steps to Reproduce
- Configure
glab mcp serveas an MCP server (stdio transport) - Call any glab tool, e.g.,
glab_mr_list - Observe that only
structuredContentis displayed
Expected Behavior
Display the content field (array of text items containing actual data like the MR list)
Actual Behavior
Only shows structuredContent metadata:
{"pagination":{"actual_end":1006,"actual_size":1006,"actual_start":0,"limit":50000,"offset":0,"total_size":1006,"truncated":false}}
Evidence
MCP server logs (captured via wrapper script) show both fields are sent correctly by the server:
Request:
{"method":"tools/call","params":{"name":"glab_mr_list","arguments":{}},"jsonrpc":"2.0","id":2}
Response (from glab mcp serve):
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "Showing 8 open merge requests on synology/OrangeDrive. (Page 1)\n\n!1359\tsynology/OrangeDrive!1359\tfeat: support complex share paths...\n..."
}
],
"structuredContent": {
"pagination": {
"actual_end": 1006,
"actual_size": 1006,
"actual_start": 0,
"limit": 50000,
"offset": 0,
"total_size": 1006,
"truncated": false
}
}
}
}
What Claude Code displays to the user:
Only the structuredContent portion - the actual MR list in content is completely ignored.
Analysis
According to the MCP specification, CallToolResult supports both:
content: Primary response data (array of content items like text, images)structuredContent: Optional structured metadata
The MCP SDK schema (found in the binary) correctly defines both fields:
mF=CY.extend({content:b.array(w9B).default([]),structuredContent:b.object({}).passthrough().optional(),isError:b.optional(b.boolean())})
The issue appears to be in the response rendering/display logic that extracts data from MCP tool results - it seems to prioritize or exclusively use structuredContent when present, ignoring content.
Notes
- Issue likely introduced in v2.0.21 when
structuredContentsupport was added (per CHANGELOG.md) - Workaround: Use CLI commands directly via Bash tool instead of MCP tools
- The glab MCP server is working correctly - this is a Claude Code client-side parsing issue
Wrapper Script Used for Logging
#!/bin/bash
LOG_FILE="${GLAB_MCP_LOG:-/tmp/glab-mcp-$(date +%Y%m%d-%H%M%S).log}"
exec 3>&1
log_with_timestamp() {
while IFS= read -r line; do
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1: $line" >> "$LOG_FILE"
done
}
echo "=== glab mcp serve started at $(date) ===" >> "$LOG_FILE"
tee >(log_with_timestamp "IN" >&2 2>/dev/null) | \
glab mcp serve 2>> "$LOG_FILE" | \
tee >(log_with_timestamp "OUT" >&2 2>/dev/null)This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗