fix(core): expose MCP output schemas to code mode (#35502)

This commit is contained in:
Aiden Cline 2026-07-05 23:12:45 -05:00 committed by GitHub
commit 4e019ba5d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 106 additions and 2 deletions

View file

@ -0,0 +1,40 @@
import { Server } from "@modelcontextprotocol/sdk/server/index.js"
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"
const server = new Server({ name: "output-schema", version: "1.0.0" }, { capabilities: { tools: {} } })
server.setRequestHandler(ListToolsRequestSchema, ({ params }) =>
Promise.resolve(
params?.cursor === "page-2"
? {
tools: [
{
name: "second",
inputSchema: { type: "object" },
outputSchema: {
type: "object",
properties: { value: { type: "number" } },
required: ["value"],
},
},
],
}
: {
tools: [
{
name: "first",
inputSchema: { type: "object" },
outputSchema: {
type: "object",
properties: { value: { type: "string" } },
required: ["value"],
},
},
],
nextCursor: "page-2",
},
),
)
await server.connect(new StdioServerTransport())