Skip to content

fix(mcp): return structured content for tools with output schemas#97

Merged
antfu merged 2 commits into
devframes:mainfrom
webfansplz:fix/mcp
Jul 16, 2026
Merged

fix(mcp): return structured content for tools with output schemas#97
antfu merged 2 commits into
devframes:mainfrom
webfansplz:fix/mcp

Conversation

@webfansplz

Copy link
Copy Markdown
Contributor

MCP tools that declared an outputSchema only returned text content. MCP SDK clients reject these calls with:

Tool has an output schema but did not return structured content

Return the tool result through structuredContent whenever an output schema is exposed, while preserving the existing text content for compatibility.

Copilot AI review requested due to automatic review settings July 15, 2026 12:44
@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit b7c2f15
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a57831744a3ea00088539bf
😎 Deploy Preview https://deploy-preview-97--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes MCP tool call responses for tools that expose an outputSchema, ensuring the server returns structuredContent (in addition to the existing text payload) so MCP SDK clients accept the response.

Changes:

  • Detect whether the called tool exposes an outputSchema and, if so, include structuredContent in the callTool response.
  • Add a regression test asserting structuredContent is returned for a tool that declares an output schema.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/devframe/src/adapters/mcp/build-server.ts Adds structuredContent to CallTool responses when an output schema is present.
packages/devframe/src/adapters/mcp/tests/mcp-server.test.ts Extends the MCP adapter test to validate structuredContent is returned alongside text content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts
Comment thread packages/devframe/src/adapters/mcp/__tests__/mcp-server.test.ts
Copilot AI review requested due to automatic review settings July 15, 2026 12:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread packages/devframe/src/adapters/mcp/build-server.ts
@antfu antfu merged commit 603fba0 into devframes:main Jul 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants