Skip to content

Commit 8aa3cb1

Browse files
sziatkoclaude
andcommitted
Remove outputSchema: Claude Desktop rejects the draft-07 dialect the SDK emits
@modelcontextprotocol/sdk (server-side, currently 1.30.0) generates outputSchema via zod-to-json-schema, which stamps "$schema": draft-07 on every schema. Claude Desktop's bundled MCP client validates declared schemas against 2020-12 only and rejects draft-07 outright, so every tool call failed with "invalid outputSchema ... unsupported dialect". This is a known interop gap between v1-SDK servers and v2 clients (modelcontextprotocol/typescript-sdk#2532, anthropics/claude-code#86142). The fix landed in a separate client package this server doesn't control, so outputSchema is dropped from all 22 tools until Claude Desktop ships an updated bundled client. The Zod schemas stay in api/types.ts as the source of truth, ready to be re-wired once the client-side fix rolls out. api/types.ts is now excluded from coverage: every consumer imports it with `import type`, which tsc erases entirely, so the module is never loaded at runtime (0 executable lines, not merely untested). Co-Authored-By: Claude Sonnet 5 <[email protected]>
1 parent 897801e commit 8aa3cb1

13 files changed

Lines changed: 33 additions & 70 deletions

‎src/tools/account.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ describe("account tools", () => {
2626
}
2727
});
2828

29-
it("declare an outputSchema", () => {
29+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
3030
const server = createFakeServer();
3131
registerAccountTools(server as any);
3232

3333
for (const [name, { config }] of server.tools) {
34-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
34+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
3535
}
3636
});
3737

‎src/tools/account.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { t212Get } from "../api/client.js";
3-
import { AccountSummarySchema, CashBalanceSchema, type AccountSummary, type CashBalance } from "../api/types.js";
3+
import type { AccountSummary, CashBalance } from "../api/types.js";
44
import { jsonResult, readOnlyAnnotations, withEnvironmentTag } from "./shared.js";
55

66
export function registerAccountTools(server: McpServer) {
77
server.registerTool(
88
"get_cash_balance",
99
{
1010
description: withEnvironmentTag("Get the current cash balance for the Trading212 account."),
11-
outputSchema: CashBalanceSchema,
1211
annotations: readOnlyAnnotations("Get Cash Balance"),
1312
},
1413
async () => jsonResult(await t212Get<CashBalance>("/equity/account/cash", "accountCash"))
@@ -20,7 +19,6 @@ export function registerAccountTools(server: McpServer) {
2019
description: withEnvironmentTag(
2120
"Get a full account summary: cash, invested value, profit/loss, and total account value."
2221
),
23-
outputSchema: AccountSummarySchema,
2422
annotations: readOnlyAnnotations("Get Account Summary"),
2523
},
2624
async () => jsonResult(await t212Get<AccountSummary>("/equity/account/summary", "accountSummary"))

‎src/tools/history.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ describe("history tools", () => {
2626
}
2727
});
2828

29-
it("declare an outputSchema", () => {
29+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
3030
const server = createFakeServer();
3131
registerHistoryTools(server as any);
3232

3333
for (const [name, { config }] of server.tools) {
34-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
34+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
3535
}
3636
});
3737

‎src/tools/history.ts‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { z } from "zod";
33
import { t212Get } from "../api/client.js";
4-
import {
5-
DividendSchema,
6-
TransactionSchema,
7-
paginatedResponseSchema,
8-
type Dividend,
9-
type PaginatedResponse,
10-
type Transaction,
11-
} from "../api/types.js";
4+
import type { Dividend, PaginatedResponse, Transaction } from "../api/types.js";
125
import { jsonResult, readOnlyAnnotations, withEnvironmentTag } from "./shared.js";
136
import { paginationSchema } from "./pagination.js";
147

@@ -21,7 +14,6 @@ export function registerHistoryTools(server: McpServer) {
2114
...paginationSchema,
2215
ticker: z.string().optional().describe("Filter by instrument ticker."),
2316
},
24-
outputSchema: paginatedResponseSchema(DividendSchema),
2517
annotations: readOnlyAnnotations("Get Dividends"),
2618
},
2719
async ({ cursor, limit, ticker }) => {
@@ -44,7 +36,6 @@ export function registerHistoryTools(server: McpServer) {
4436
...paginationSchema,
4537
time: z.string().optional().describe("Retrieve transactions from this ISO 8601 time onward."),
4638
},
47-
outputSchema: paginatedResponseSchema(TransactionSchema),
4839
annotations: readOnlyAnnotations("Get Transactions"),
4940
},
5041
async ({ cursor, limit, time }) => {

‎src/tools/metadata.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ describe("metadata tools", () => {
2626
}
2727
});
2828

29-
it("declare an outputSchema", () => {
29+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
3030
const server = createFakeServer();
3131
registerMetadataTools(server as any);
3232

3333
for (const [name, { config }] of server.tools) {
34-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
34+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
3535
}
3636
});
3737

‎src/tools/metadata.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2-
import { z } from "zod";
32
import { t212Get } from "../api/client.js";
4-
import { ExchangeSchema, InstrumentSchema, type Exchange, type Instrument } from "../api/types.js";
3+
import type { Exchange, Instrument } from "../api/types.js";
54
import { jsonResult, readOnlyAnnotations, withEnvironmentTag } from "./shared.js";
65

76
export function registerMetadataTools(server: McpServer) {
@@ -11,7 +10,6 @@ export function registerMetadataTools(server: McpServer) {
1110
description: withEnvironmentTag(
1211
"Get metadata for all tradeable instruments (tickers, names, ISINs, currencies, etc)."
1312
),
14-
outputSchema: { instruments: z.array(InstrumentSchema) },
1513
annotations: readOnlyAnnotations("Get Instruments"),
1614
},
1715
async () =>
@@ -24,7 +22,6 @@ export function registerMetadataTools(server: McpServer) {
2422
"get_exchanges",
2523
{
2624
description: withEnvironmentTag("Get metadata for all exchanges, including their working schedules."),
27-
outputSchema: { exchanges: z.array(ExchangeSchema) },
2825
annotations: readOnlyAnnotations("Get Exchanges"),
2926
},
3027
async () =>

‎src/tools/orders.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ describe("order write tools", () => {
3030
}
3131
});
3232

33-
it("declare an outputSchema", () => {
33+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
3434
const server = createFakeServer();
3535
registerOrderWriteTools(server as any);
3636

3737
for (const [name, { config }] of server.tools) {
38-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
38+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
3939
}
4040
});
4141

@@ -122,12 +122,12 @@ describe("order read tools", () => {
122122
}
123123
});
124124

125-
it("declare an outputSchema", () => {
125+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
126126
const server = createFakeServer();
127127
registerOrderReadTools(server as any);
128128

129129
for (const [name, { config }] of server.tools) {
130-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
130+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
131131
}
132132
});
133133

‎src/tools/orders.ts‎

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { z } from "zod";
33
import { t212Delete, t212Get, t212Post } from "../api/client.js";
4-
import {
5-
HistoricalOrderEntrySchema,
6-
OrderSchema,
7-
paginatedResponseSchema,
8-
type HistoricalOrderEntry,
9-
type LimitOrderRequest,
10-
type MarketOrderRequest,
11-
type Order,
12-
type PaginatedResponse,
13-
type StopLimitOrderRequest,
14-
type StopOrderRequest,
4+
import type {
5+
HistoricalOrderEntry,
6+
LimitOrderRequest,
7+
MarketOrderRequest,
8+
Order,
9+
PaginatedResponse,
10+
StopLimitOrderRequest,
11+
StopOrderRequest,
1512
} from "../api/types.js";
1613
import {
1714
jsonResult,
@@ -27,7 +24,6 @@ export function registerOrderReadTools(server: McpServer) {
2724
"get_orders",
2825
{
2926
description: withEnvironmentTag("Get all currently open/pending orders."),
30-
outputSchema: { orders: z.array(OrderSchema) },
3127
annotations: readOnlyAnnotations("Get Orders"),
3228
},
3329
async () => jsonResult({ orders: await t212Get<Order[]>("/equity/orders", "ordersList") })
@@ -38,7 +34,6 @@ export function registerOrderReadTools(server: McpServer) {
3834
{
3935
description: withEnvironmentTag("Get a single open/pending order by id."),
4036
inputSchema: { orderId: z.number().describe("Order id") },
41-
outputSchema: OrderSchema,
4237
annotations: readOnlyAnnotations("Get Order"),
4338
},
4439
async ({ orderId }) => jsonResult(await t212Get<Order>(`/equity/orders/${orderId}`, "orderSingle"))
@@ -52,7 +47,6 @@ export function registerOrderReadTools(server: McpServer) {
5247
...paginationSchema,
5348
ticker: z.string().optional().describe("Filter by instrument ticker."),
5449
},
55-
outputSchema: paginatedResponseSchema(HistoricalOrderEntrySchema),
5650
annotations: readOnlyAnnotations("Get Order History"),
5751
},
5852
async ({ cursor, limit, ticker }) => {
@@ -84,7 +78,6 @@ export function registerOrderWriteTools(server: McpServer) {
8478
quantity,
8579
extendedHours: z.boolean().optional().describe("Allow execution during extended trading hours."),
8680
},
87-
outputSchema: OrderSchema,
8881
annotations: writeAnnotations("Place Market Order"),
8982
},
9083
async (body: MarketOrderRequest) =>
@@ -103,7 +96,6 @@ export function registerOrderWriteTools(server: McpServer) {
10396
limitPrice: z.number().describe("The limit price."),
10497
timeValidity,
10598
},
106-
outputSchema: OrderSchema,
10799
annotations: writeAnnotations("Place Limit Order"),
108100
},
109101
async (body: LimitOrderRequest) =>
@@ -122,7 +114,6 @@ export function registerOrderWriteTools(server: McpServer) {
122114
stopPrice: z.number().describe("The stop trigger price."),
123115
timeValidity,
124116
},
125-
outputSchema: OrderSchema,
126117
annotations: writeAnnotations("Place Stop Order"),
127118
},
128119
async (body: StopOrderRequest) =>
@@ -142,7 +133,6 @@ export function registerOrderWriteTools(server: McpServer) {
142133
limitPrice: z.number().describe("The limit price once triggered."),
143134
timeValidity,
144135
},
145-
outputSchema: OrderSchema,
146136
annotations: writeAnnotations("Place Stop-Limit Order"),
147137
},
148138
async (body: StopLimitOrderRequest) =>
@@ -154,7 +144,6 @@ export function registerOrderWriteTools(server: McpServer) {
154144
{
155145
description: withEnvironmentTag("Cancel an active, unfilled order by its id."),
156146
inputSchema: { orderId: z.number().describe("Order id") },
157-
outputSchema: { cancelled: z.boolean(), orderId: z.number() },
158147
annotations: writeAnnotations("Cancel Order", { destructive: true }),
159148
},
160149
async ({ orderId }) => {

‎src/tools/pies.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ describe("pie write tools", () => {
2828
}
2929
});
3030

31-
it("declare an outputSchema", () => {
31+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
3232
const server = createFakeServer();
3333
registerPieWriteTools(server as any);
3434

3535
for (const [name, { config }] of server.tools) {
36-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
36+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
3737
}
3838
});
3939

@@ -101,12 +101,12 @@ describe("pie read tools", () => {
101101
}
102102
});
103103

104-
it("declare an outputSchema", () => {
104+
it("omit outputSchema (Claude Desktop rejects the draft-07 dialect the SDK emits)", () => {
105105
const server = createFakeServer();
106106
registerPieReadTools(server as any);
107107

108108
for (const [name, { config }] of server.tools) {
109-
expect(config.outputSchema, `${name} should declare an outputSchema`).toBeDefined();
109+
expect(config.outputSchema, `${name} should not declare an outputSchema`).toBeUndefined();
110110
}
111111
});
112112

‎src/tools/pies.ts‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { z } from "zod";
33
import { t212Delete, t212Get, t212Post } from "../api/client.js";
4-
import {
5-
PieDetailSchema,
6-
PieSummarySchema,
7-
type DuplicatePieRequest,
8-
type PieDetail,
9-
type PieRequest,
10-
type PieSummary,
11-
} from "../api/types.js";
4+
import type { DuplicatePieRequest, PieDetail, PieRequest, PieSummary } from "../api/types.js";
125
import { jsonResult, readOnlyAnnotations, withEnvironmentTag, writeAnnotations } from "./shared.js";
136

147
const pieRequestSchema = {
@@ -28,7 +21,6 @@ export function registerPieReadTools(server: McpServer) {
2821
"get_pies",
2922
{
3023
description: withEnvironmentTag("Get all investment pies in the Trading212 account."),
31-
outputSchema: { pies: z.array(PieSummarySchema) },
3224
annotations: readOnlyAnnotations("Get Pies"),
3325
},
3426
async () => jsonResult({ pies: await t212Get<PieSummary[]>("/equity/pies", "piesList") })
@@ -39,7 +31,6 @@ export function registerPieReadTools(server: McpServer) {
3931
{
4032
description: withEnvironmentTag("Get a single investment pie by id, including its holdings."),
4133
inputSchema: { pieId: z.number().describe("Pie id") },
42-
outputSchema: PieDetailSchema,
4334
annotations: readOnlyAnnotations("Get Pie"),
4435
},
4536
async ({ pieId }) => jsonResult(await t212Get<PieDetail>(`/equity/pies/${pieId}`, "pieGet"))
@@ -52,7 +43,6 @@ export function registerPieWriteTools(server: McpServer) {
5243
{
5344
description: withEnvironmentTag("Create a new investment pie."),
5445
inputSchema: pieRequestSchema,
55-
outputSchema: PieDetailSchema,
5646
annotations: writeAnnotations("Create Pie"),
5747
},
5848
async (body: PieRequest) => jsonResult(await t212Post<PieDetail>("/equity/pies", "pieCreate", body))
@@ -63,7 +53,6 @@ export function registerPieWriteTools(server: McpServer) {
6353
{
6454
description: withEnvironmentTag("Update an existing investment pie's settings and/or allocation."),
6555
inputSchema: { pieId: z.number().describe("Pie id"), ...pieRequestSchema },
66-
outputSchema: PieDetailSchema,
6756
annotations: writeAnnotations("Update Pie"),
6857
},
6958
async ({ pieId, ...body }: PieRequest & { pieId: number }) =>
@@ -75,7 +64,6 @@ export function registerPieWriteTools(server: McpServer) {
7564
{
7665
description: withEnvironmentTag("Delete an investment pie by id."),
7766
inputSchema: { pieId: z.number().describe("Pie id") },
78-
outputSchema: { deleted: z.boolean(), pieId: z.number() },
7967
annotations: writeAnnotations("Delete Pie", { destructive: true }),
8068
},
8169
async ({ pieId }) => {
@@ -95,7 +83,6 @@ export function registerPieWriteTools(server: McpServer) {
9583
name: z.string().optional().describe("Name for the duplicated pie."),
9684
icon: z.string().optional().describe("Icon for the duplicated pie."),
9785
},
98-
outputSchema: PieDetailSchema,
9986
annotations: writeAnnotations("Duplicate Pie"),
10087
},
10188
async ({ pieId, ...body }: DuplicatePieRequest & { pieId: number }) =>

0 commit comments

Comments
 (0)