Skip to content

feat: Return structured content from MCP tool responses#3

Merged
dankelleher merged 6 commits intomainfrom
feat/structured-content-tool-responses
Feb 11, 2026
Merged

feat: Return structured content from MCP tool responses#3
dankelleher merged 6 commits intomainfrom
feat/structured-content-tool-responses

Conversation

@dankelleher
Copy link
Copy Markdown
Member

@dankelleher dankelleher commented Feb 10, 2026

Summary

  • Tools now return raw Python data (dict[str, Any] or str) instead of pre-serialized List[TextContent]
  • FastMCP auto-generates both content (backward-compat text) and structuredContent (raw JSON object) from return type annotations
  • outputSchema is now included in list_tools responses for all tools
  • Added to_jsonable() helper for converting PostgreSQL types (Decimal, timedelta, bytes) to JSON-native Python types
  • Exceptions now propagate to FastMCP for consistent isError: true error responses
  • top_queries_calc returns list[dict[str, Any]] and raises ValueError when pg_stat_statements is missing

dankelleher and others added 6 commits February 10, 2026 11:02
- Add etc/scripts/push-to-ecr.sh for building and pushing multi-arch
  images to dev/prod ECR
- Add etc/scripts/promote.sh for promoting images from dev to prod ECR
  using crane
- Pin Dockerfile base images to SHA digests for supply-chain security
- Upgrade all dependencies to latest versions via uv lock --upgrade
Unquoted echo is intentional here — shell word splitting converts
the tab-separated aws sts output to spaces so cut -d' ' works.
Tools now return raw Python data (dict/str) instead of pre-serialized
List[TextContent]. FastMCP auto-generates both content (backward-compat
text) and structuredContent (raw JSON object) from return type annotations,
plus outputSchema in list_tools responses.

- Add to_jsonable() helper for PostgreSQL type conversion via orjson
- Refactor all 9 tools to return dict[str, Any] or str
- Let exceptions propagate for FastMCP error handling
- Update top_queries_calc to return list[dict] and raise on missing extension
Define TypedDict classes for all dict-returning tools so FastMCP
generates JSON schemas with explicit properties and types instead
of opaque {"type": "object", "additionalProperties": true}.

Uses only primitive types and dict[str, Any] to stay within MCP's
JSON Schema subset (no $defs/$ref/anyOf).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dankelleher dankelleher merged commit f4b1752 into main Feb 11, 2026
1 check passed
@dankelleher dankelleher deleted the feat/structured-content-tool-responses branch February 11, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant