Refactor Actor response to use structured content per MCP spec#745
Draft
jirispilka wants to merge 1 commit intomasterfrom
Draft
Refactor Actor response to use structured content per MCP spec#745jirispilka wants to merge 1 commit intomasterfrom
jirispilka wants to merge 1 commit intomasterfrom
Conversation
Per MCP spec 2025-11-25, a tool returning structuredContent SHOULD also return the serialized JSON in a TextContent block. content[0] was JSON.stringify(previewItems) — only part of structuredContent — so backwards-compat clients saw a different payload than structured clients. Make content[0] = JSON.stringify(structuredContent). Keep the human-readable metadata/instructions block as content[1] (unchanged content, still at the end). Move the empty-preview note into structuredContent.instructions so structuredContent-only clients see it. Narrow fix for #709. Broader tool-result standardization tracked in #744.
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.
Summary
Refactored
buildActorResponseContentto align with MCP spec 2025-11-25 by returning structured content as the canonical data payload, with backwards-compatibility support for clients that don't yet support structured content.Key Changes
structuredContentobject containingrunId,datasetId,totalItemCount,items, andinstructionsas the canonical response payloadstructuredContentas the first TextContent block per MCP spec recommendations for clients that don't support structured content yetemptyPreviewNotevariable that's included in instructionsImplementation Details
structuredContent(structured data) andcontentarray (text blocks for LLM consumption)https://claude.ai/code/session_01XqXmsBHXsMi5ycLsWm7AUX