fix: allow empty content in CallToolResult#681
Merged
jokemanfire merged 1 commit intomodelcontextprotocol:mainfrom Feb 24, 2026
Merged
fix: allow empty content in CallToolResult#681jokemanfire merged 1 commit intomodelcontextprotocol:mainfrom
jokemanfire merged 1 commit intomodelcontextprotocol:mainfrom
Conversation
jokemanfire
previously approved these changes
Feb 24, 2026
Member
jokemanfire
left a comment
There was a problem hiding this comment.
In spec , the office's description is Tool results may contain [structured](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#structured-content) or unstructured content.
Looks like the content could be empty.
Member
|
fix the ci please. |
Per the MCP spec [1] and the TypeScript schema [2], `CallToolResult.content` is typed as `ContentBlock[]`, so it is a required array with no minimum length constraint. MCP server libraries use such a representation in practice: for example, FastMCP returns responses with no `structuredContent` and an empty `content` array when tools return `None`. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools [2]: https://github.com/modelcontextprotocol/specification/blob/main/schema/2025-11-25/schema.ts
f6d6842 to
9847bde
Compare
Contributor
Author
|
CI fixed. The one in this repo is awaiting maintainer approval: https://github.com/modelcontextprotocol/rust-sdk/actions/runs/22334296705 $ npx commitlint --from 0854700 --to 9847bde --verbose
⧗ input: fix: allow empty content in CallToolResult
Per the MCP spec [1] and the TypeScript schema [2],
`CallToolResult.content` is typed as `ContentBlock[]`, so it is a
required array with no minimum length constraint.
MCP server libraries use such a representation in practice: for example,
FastMCP returns responses with no `structuredContent` and an empty
`content` array when tools return `None`.
[1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools
[2]: https://github.com/modelcontextprotocol/specification/blob/main/schema/2025-11-25/schema.ts
✔ found 0 problems, 0 warnings
$ cargo +nightly fmt --all -- --check; echo $?
0 |
jokemanfire
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the MCP spec [1] and the TypeScript schema [2],
CallToolResult.contentis typed asContentBlock[], so it is a required array with no minimum length constraint.MCP server libraries use such a representation in practice: for example, FastMCP returns responses with no
structuredContentand an emptycontentarray when tools returnNone.Motivation and Context
See above.
How Has This Been Tested?
Updated unit tests, included in this PR.
Breaking Changes
This is more permissive, so I don't think this should break anything.
Types of changes
Checklist
Additional context
N/A.