Skip to content

feat: add outputSchema support for local MCP tools - #10901

Open
chkuang-g wants to merge 2 commits into
mainfrom
chkuang/mcp-output-schema
Open

feat: add outputSchema support for local MCP tools#10901
chkuang-g wants to merge 2 commits into
mainfrom
chkuang/mcp-output-schema

Conversation

@chkuang-g

Copy link
Copy Markdown
Contributor

Description

Introduced the outputSchema property to the MCP ServerTool interface and the tool() builder function, enabling local tools to declare typed output schemas. Since the @modelcontextprotocol/sdk natively supports outputSchema, remote server schemas are automatically validated and forwarded.

Scenarios Tested

  • Verified that local tools constructed using tool() builder accept and compile with outputSchema.
  • Verified that outputSchema gets processed and cleaned correctly in unit tests.
  • Verified that OneMcpServer.listTools() successfully parses and retains the outputSchema returned by remote servers.

Sample Commands

npx mocha src/mcp/tool.spec.ts src/mcp/onemcp/onemcp_server.spec.ts

@chkuang-g
chkuang-g requested a review from joehan August 7, 2026 01:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for outputSchema in local MCP tools, updating the ServerTool interface, the tool builder function, and associated tests. The reviewer feedback suggests simplifying the ServerTool interface by removing the unused OutputSchema generic parameter to avoid a phantom type parameter, and updating the tool function signature accordingly.

Comment thread src/mcp/tool.ts Outdated
Comment thread src/mcp/tool.ts Outdated
Comment thread src/mcp/tool.ts Outdated
### Description
Introduced the `outputSchema` property to the MCP `ServerTool` interface and the `tool()` builder function, enabling local tools to declare typed output schemas. Since the `@modelcontextprotocol/sdk` natively supports `outputSchema`, remote server schemas are automatically validated and forwarded.

### Scenarios Tested
- Verified that local tools constructed using `tool()` builder accept and compile with `outputSchema`.
- Verified that `outputSchema` gets processed and cleaned correctly in unit tests.
- Verified that `OneMcpServer.listTools()` successfully parses and retains the `outputSchema` returned by remote servers.

### Sample Commands
npx mocha src/mcp/tool.spec.ts src/mcp/onemcp/onemcp_server.spec.ts
@chkuang-g
chkuang-g force-pushed the chkuang/mcp-output-schema branch from 8972250 to bbc3ad6 Compare August 7, 2026 17:39
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