aws / aws/amazon-q-developer-cli

MCP tool responses only display content field, ignoring structuredContent

Open
#2,865 0 comments 0 reactions 0 assignees View on GitHub
MCP
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue

### Operating system

macOS

### Expected behaviour

When MCP tools return responses with both `content` and `structuredContent` fields, Amazon Q CLI should display both or at least the structured data from `structuredContent` field.

### Actual behaviour

Amazon Q CLI only displays the `content` field from MCP tool responses and completely ignores the `structuredContent` field, which often contains the actual useful data.

For example, an MCP tool response like:
```json
{
"content": [{"type": "text", "text": "User information retrieved"}],
"structuredContent": {
"authenticated": true,
"authMethod": "PAT",
"email": "user@example.com"
}
}
```

Only shows "User information retrieved" instead of the actual user data in `structuredContent`.

### Root Cause

In `crates/chat-cli/src/cli/chat/tools/custom_tool.rs`, the `CustomTool::invoke` method returns the raw MCP response as JSON, but the CLI only processes the `content` field and ignores `structuredContent`.

### Suggested Fix

Modify the MCP tool response processing to either:
1. Display both `content` and `structuredContent` fields
2. Prioritize `structuredContent` when available
3. Combine both fields in a meaningful way

### Steps to reproduce

1. Set up an MCP server that returns responses with both `content` and `structuredContent` fields
2. Call a tool that returns structured data
3. Observe that only the `content` field message is displayed
4. The actual structured data in `structuredContent` is not shown to the user

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.