Add backwards compatibility for structuredContent by including serialized JSON in content
Problem
The MCP specification states that tools returning structuredContent should also include the serialized JSON in a TextContent block for backwards compatibility:
For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block.
Source: https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content
Currently, when rmcp-openapi returns structured content, it sets the content array to empty ([]). This causes issues with MCP clients like Claude Code that don't process structuredContent when content is empty.
Current Behavior
{
"content": [],
"structuredContent": {
"status": 200,
"body": {
"data": [...]
}
}
}
Expected Behavior
According to the MCP specification:
{
"content": [
{
"type": "text",
"text": "{\"status\":200,\"body\":{\"data\":[...]}}"
}
],
"structuredContent": {
"status": 200,
"body": {
"data": [...]
}
}
}
Impact
This affects all tools that have output schemas defined, as they currently return empty content arrays which makes them appear to return no data to clients that don't process structuredContent.
Suggested Fix
Update src/server.rs to serialize the structured_content as JSON and include it in a TextContent block when returning structured content.