Skip to content

Add an optional mimeType property to TextContent#662

Open
atesgoral wants to merge 3 commits intomodelcontextprotocol:mainfrom
atesgoral:optional-text-mime-type
Open

Add an optional mimeType property to TextContent#662
atesgoral wants to merge 3 commits intomodelcontextprotocol:mainfrom
atesgoral:optional-text-mime-type

Conversation

@atesgoral
Copy link
Contributor

Motivation and Context

Addresses #180

Where @jspahrsummers said:

Yep, makes sense. I think this is basically just an oversight. We have a MIME type on all resources, for example.

How Has This Been Tested?

No. Just adding an optional property to the schema.

Breaking Changes

No.

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

Additional context

Copy link
Contributor

@hesreallyhim hesreallyhim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: it sounds like we're going to end up with three ContentTypes:
TextContent | ImageContent | AudioContent
and they're each going to have type, mimeType, and annotations? properties, which sounds to me like a good opportunity for a shared interface from which to extend

@atesgoral
Copy link
Contributor Author

@hesreallyhim Ah, actually this is a small patch before we potentially rock the boat and unify types: #180 (reply in thread)

@hesreallyhim
Copy link
Contributor

@hesreallyhim Ah, actually this is a small patch before we potentially rock the boat and unify types: #180 (reply in thread)

ok, thanks for the context 👍

@dsp-ant dsp-ant moved this to Consulting in Standards Track Jun 16, 2025
@dsp-ant dsp-ant added this to the DRAFT-XX-XX milestone Jun 16, 2025
@evalstate
Copy link
Member

I'd prefer this was fixed to text/plain if it is going to be added.

@atesgoral
Copy link
Contributor Author

@evalstate can you elaborate? What does "fixing" mean in this context? Assume all type: "text" additionally means mimeType: "text/plain", without a way to override it?

@evalstate
Copy link
Member

evalstate commented Jun 17, 2025

Yes, my view is that TextContent should have the guarantee that it is text/plain.

TextContent is by far the most widely used type, and we already have TextResourceContents for transmitting semantic information about textual content.

The potential breakage here is that Server developers think they want to send text/html or text/css or application/x-python, but in truth they are not natively tokenized by the models. Sending those as content blocks with their mime type via the LLM API will usually cause an error, and this is often not what the MCP Server developer intended.

There are rare exceptions (e.g. models like StarVector) but the general case is that having a modifiable mime type on TextContent this will cause unnecessary complexity and breakages.

At the moment TextContent is almost guaranteed to work in all situations, is simple for MCP Server and Host developers and TextResourceContents exists for more complex integrations. Adding a specifiable mime type would regress this.

@dsp-ant dsp-ant requested a review from a team September 23, 2025 21:10
@domdomegg domdomegg requested a review from a team as a code owner November 25, 2025 19:37
localden
localden previously approved these changes Dec 5, 2025
@localden localden added the schema Work related to schema changes. label Dec 5, 2025
@localden
Copy link
Contributor

localden commented Dec 5, 2025

LGTM. @atesgoral - mind resolving the schema conflicts in this PR?

🏠 Remote-Dev: homespace
@localden localden requested a review from a team as a code owner March 10, 2026 23:30
@localden localden removed this from the DRAFT-2025-11-25 milestone Mar 10, 2026
@atesgoral
Copy link
Contributor Author

atesgoral commented Mar 14, 2026

@localden My GH notification settings suck. I missed your ping. Looking now.


Update: Thank you for updating it!

@localden
Copy link
Contributor

@evalstate @olaservo @jonathanhefner @cliffhall any concerns with this merging as-is?

@jonathanhefner
Copy link
Member

jonathanhefner commented Mar 16, 2026

any concerns with this merging as-is?

Back when this was proposed I was in favor of it. In particular, I was in favor of having just TextContent and BlobContent as a replacement for ImageContent, AudioContent, and EmbeddedResource (which also has its own TextResourceContents and BlobResourceContents). That seemed cleaner to me, from an API perspective.

But since then, I've flipped to favoring TextContent with no MIME type (same as current) and EmbeddedResource for anything else (if anything else). That combo currently feels more "model native" to me.

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

Labels

schema Work related to schema changes.

Projects

No open projects
Status: Consulting

Development

Successfully merging this pull request may close these issues.

6 participants