anthropics / anthropics/claude-agent-sdk-python

Request for Better MCP Tool Response Formatting and Display Control in Claude Code SDK

Aperta
#11 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
8.1k
Fork
1.3k
Merge medio
2g 31m
PR unite (30g)
1

Descrizione

Hi Claude Code SDK Python team,

We're developing an MCP server that integrates external LLMs (Gemini, OpenAI) with Claude Code using the Python SDK and have encountered formatting challenges that significantly impact user experience.

Current Problem:
When our MCP tools return responses from external LLMs, Claude Code displays them as raw JSON, making them difficult to read and breaking the conversational flow between Claude and external AI models.

What We're Trying to Achieve:
- Clean, readable display of external LLM responses within Claude Code
- Ability to show full conversations between Claude and other AI models without JSON wrapping
- Better formatting control for MCP tool outputs
- Transparency requirement: "The user MUST be able to view the internal discussion between you and any external LLMs"

Current Workaround:
We're using jq to format JSON responses and returning them as TextContent, but this still displays as raw JSON rather than rendered content:

return [TextContent(type="text", text=formatted_json)]

Questions for the Team:

1. Response Formatting: Is there a way in the Python SDK to control how MCP tool responses are displayed in Claude Code? We need responses from external LLMs to appear as cleanly formatted text rather than
JSON.
2. Content Type Support: Does the SDK support different content types (markdown, HTML, etc.) for MCP tool responses that would render properly in the Claude Code interface?
3. Display Control: Is there a mechanism, flag, or SDK parameter we can use to force Claude Code to display certain responses from external LLMs in full, without truncation or JSON wrapping?
4. SDK Best Practices: What's the recommended approach using the Python SDK for MCP servers that act as bridges to other AI models? How should we format responses to ensure optimal user experience?

Use Case:
Our zen-thinkdeep MCP tool enables Claude to collaborate with Gemini for extended reasoning tasks. Users need to see the full conversation flow between Claude and Gemini, formatted readably for transparency
and usability.

Technical Details:
- Using mcp Python library with TextContent responses
- External APIs: Google Gemini, OpenAI GPT
- Response format: Currently JSON-wrapped but need clean text display
- Repository: MCP server integrating with claude-code-sdk-python

Environment:
- Claude Code CLI version: [latest]
- claude-code-sdk-python version: [latest from repo]
- MCP Server: Python-based using official mcp library
- Python: 3.13

Request:
Any guidance on proper SDK usage for readable external LLM integration, or roadmap items for improved MCP response formatting support would be tremendously helpful.

Thank you for the excellent Python SDK work!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.