fastapi_mcp icon indicating copy to clipboard operation
fastapi_mcp copied to clipboard

feat: add prefer_structured_content parameter for response format con…

Open Edison-A-N opened this issue 7 months ago • 0 comments

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_content parameter to FastApiMCP class
  • 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

Edison-A-N avatar Sep 23 '25 00:09 Edison-A-N