fastapi_mcp
fastapi_mcp copied to clipboard
feat: add prefer_structured_content parameter for response format con…
Add structured content response support
Add parameter to choose between structured JSON and text content responses. Defaults to False for backward compatibility.
Describe your changes
- Added
prefer_structured_contentparameter toFastApiMCPclass - When enabled, returns raw JSON response instead of formatted text content
- Maintains backward compatibility by defaulting to
False - Updated return type annotations to support both text and structured content
- Added comprehensive tests for structured content functionality
Issue ticket number and link (if applicable)
Closes #219 - Feature Request: Add Structured Content Support
Screenshots of the feature / bugfix
N/A
Checklist before requesting a review
- [x] Added relevant tests
- [x] Run ruff & mypy
- [x] All tests pass