Repository navigation
fix(mcp): return an object as generate-theme structuredContent - #298
Open
dpritzker0905-cmd wants to merge 2 commits into
Open
dpritzker0905-cmd wants to merge 2 commits into
dpritzker0905-cmd wants to merge 2 commits into
Conversation
generate-theme returned theme.contrastColors, an array, as structuredContent.
The MCP spec requires structuredContent to be an object, so clients reject
every call with "Invalid tools/call result ... expected record, received
array". Return {contrastColors: [...]} instead; the text content is unchanged.
Export the McpServer instance so a test can connect a real client over the
SDK's in-memory transport, and add test/server.test.js, which calls every
tool end to end and asserts its structuredContent is an object. The two
generate-theme cases fail on the old handler with the error above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: c6eab9d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Description
Fixes #297.
generate-themereturnedtheme.contrastColors, an array, asstructuredContent. The MCP spec requiresstructuredContentto be an object, so SDK-based clients reject everygenerate-themecall:Changes:
packages/mcp/src/server.js:generate-themenow returnsstructuredContent: {contrastColors: result}. The text content is unchanged.McpServerinstance is exported so tests can connect a client;runServer()is unchanged.packages/mcp/test/server.test.js(new): connects a realClientto the server over the SDK'sInMemoryTransportand calls all four tools end to end.structuredContentis a plain object.generate-theme's array sits undercontrastColorsand matches the text content.generate-themecases fail with the error above; the other tools pass..changeset/mcp-structured-content-object.md: patch bump for@adobe/leonardo-mcp.node --test test/*.test.jsinpackages/mcp: 9/9 pass (4 existing, 5 new). Locally I ran against@modelcontextprotocol/sdk1.32.1 and the published@adobe/leonardo-contrast-colors1.1.0, not a fullpnpm installof the workspace, so CI is the authority there.Motivation
generate-themeis the package's main tool, and it is currently unusable from Claude Code and other SDK-based MCP clients. The other three tools already return objects and work.Screenshots
n/a
To-do list
🤖 Generated with Claude Code