admk / admk/sembr

Request: Follow MCP specification for backward compatibility with structured content

Open
#5 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi @admk! First, thank you for creating sembr and making it accessible via MCP Server - this is a very useful tool for applying semantic line breaks programmatically.

Issue Description

I've been testing the MCP server integration with both Zed Editor and Claude Desktop, and I've discovered that neither client currently supports the structured_content field introduced in the MCP spec version 6/18/2025. Both clients only display the content field, which means clients only see the summary message ("Performed semantic line breaks to N lines") rather than the actual wrapped text.

Current Behaviour

The tool correctly returns both fields as per the FastMCP specification:

  • content: Contains the human-readable summary
  • structured_content: Contains the actual wrapped text in the output field

However, since most MCP clients haven't yet implemented support for structured_content, the wrapped text remains inaccessible to users.

Proposed Solution

According to the MCP specification, tools that return structured content should follow this guidance:

"For backwards compatibility, a tool that returns structured content SHOULD also return functionally equivalent unstructured content. (For example, serialized JSON can be returned in a TextContent block.)"

Could you update the tool to include the wrapped text in the content field alongside the summary? This would make it compliant with the MCP specification's backward compatibility recommendation.

For example:

# Current code:
return ToolResult(
    content=[TextContent(type="text", text=readable)],
    structured_content={"success": True, "output": wrapped_text})

# Suggested change:
return ToolResult(
    content=[TextContent(type="text", text=f"{readable}\n\n{wrapped_text}")],
    structured_content={"success": True, "output": wrapped_text})

This simply appends the wrapped text to the existing readable summary, ensuring backward compatibility without losing any existing functionality.

Context

This appears to be a widespread compatibility issue affecting various MCP integrations. The research I found indicates that:

Alternative Approaches

I originally thought of applying a command-line flag for legacy support, like --legacy-client-support or --include-output-in-content that would modify the tool's behaviour to include the wrapped text directly in the content field alongside the summary message.

However, since reading the MCP spec, I think the better solution is to follow the official MCP backward compatibility guidelines. This would ensure it works with both legacy and modern MCP clients.

Thanks again for this excellent tool!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the MCP tool implementation that returns ToolResult with readable content and structured_content. Start by tracing that return value, then include the wrapped text in the content field while preserving structured_content; done means legacy clients can display the wrapped text and modern clients retain the structured output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.