Skip to content

fastmcp call --json drops fields from supported MCP content blocks #5526

Description

@mikamikasuki

What happened?

The client CLI's JSON serializer converts valid MCP ResourceLink and EmbeddedResource blocks to {"type": "unknown", "value": "..."} using Python's string representation. Their typed fields and nested resource content are no longer available as structured JSON. For text, image, and audio blocks, it preserves the primary payload but drops annotations and _meta.

This affects tool results printed by fastmcp call --json; prompt JSON output uses the same serializer and supports the same MCP content-block union. The CLI documentation says --json emits the raw result, including content blocks.

Could the CLI preserve all defined fields when serializing supported mcp_types.ContentBlock variants, including annotations and _meta on text/image/audio and the structured fields of resource_link and resource blocks?

Example Code

Version Information

- FastMCP main: `5baeacfe20eca735cb949564b4915f93a622b916`
- Python: 3.12.15
- OS: macOS 15.0.1 arm64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.cliRelated to FastMCP CLI commands (run, dev, install) or CLI functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions