Skip to content

[Server] Use compact JSON in result formatters - #647

Open
steffans wants to merge 1 commit into
modelcontextprotocol:mainfrom
steffans:compact-formatter-json
Open

steffans wants to merge 1 commit into
modelcontextprotocol:mainfrom
steffans:compact-formatter-json

Conversation

@steffans

@steffans steffans commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Use compact JSON instead of pretty-printed JSON from tool, prompt, and resource result formatters, reducing whitespace in content that may be sent to models. Optionally the TextContent class could also be changed to not use pretty-printed JSON.

Motivation and Context

Compact JSON preserves the same data while reducing its size.

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@steffans
steffans force-pushed the compact-formatter-json branch from 395cc7d to 0c9d664 Compare November 1, 2026 16:13

This branch has not been deployed

No deployments
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