[v1] tools/list fails as a whole when outputSchema.properties contains a boolean subschema (accepted in v2)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, json, typescript
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by reading the v1 ListToolsResultSchema and AssertObjectSchema definitions mentioned in the issue, then run the minimal reproduction against the affected SDK versions. Check how the existing v2 schema accepts boolean subschemas and whether v1 tests cover outputSchema.properties; done means the intended v1 behavior is decided and the regression or limitation is documented or covered by a focused test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
In @modelcontextprotocol/sdk 1.22.0 – 1.32.2 (the v1 line, currently latest on npm), ListToolsResultSchema rejects a tools/list response when any tool's outputSchema.properties contains a boolean subschema such as "data": true.
Because the response is validated as a whole, one such property makes the client drop every tool in the response, including tools that are perfectly valid. From the user's point of view: "connected, resources work, 0 tools".
Boolean subschemas are valid JSON Schema 2020-12 (true means "any value"), and the official Go SDK's jsonschema-go emits them on purpose for unconstrained fields (any in Go). So any Go MCP server returning a struct with an any field and declaring an outputSchema is affected when talking to a v1 client.
v2 (@modelcontextprotocol/core 2.4.0) accepts the same input, so this looks like v1 behavior that v2 already relaxed. I'm filing this to (a) document it for people hitting it on v1 and (b) ask whether a v1 backport is planned.
Minimal reproduction
No server needed:
import { ListToolsResultSchema } from "@modelcontextprotocol/sdk/types.js";
const good = { name: "good", inputSchema: { type: "object" } };
const bad = {
name: "bad",
inputSchema: { type: "object" },
outputSchema: { type: "object", properties: { data: true } },
};
const r = ListToolsResultSchema.safeParse({ tools: [good, bad] });
console.log(r.success);
// 1.21.0 -> true
// 1.22.0+ -> false
console.log(r.error?.issues);
// [{ path: ["tools", 1, "outputSchema", "properties", "data"], message: "Invalid input", ... }]
Note that good is rejected together with bad.
Where the boolean comes from (real-world trigger)
github.com/google/jsonschema-go v0.4.3 (used by github.com/modelcontextprotocol/go-sdk v1.8.0 and v1.9.0) marshals an empty schema {} as true by design (jsonschema/schema.go, MarshalJSON: // Marshal {} as true and {"not": {}} as false.). A Go tool result type like
type Out struct {
Data any `json:"data"`
}
produces:
"outputSchema": {
"type": "object",
"properties": { "data": true },
"required": ["data"],
"additionalProperties": false
}
Cause
v1 declares outputSchema.properties as z.record(z.string(), AssertObjectSchema), where AssertObjectSchema requires typeof v === 'object' || typeof v === 'function'. typeof true === 'boolean', so it fails.
v2 declares outputSchema: z.looseObject({ $schema: z.string().optional() }).optional() and no longer inspects properties.
Version matrix
Same input as above, and also a real 82-tool tools/list response (9 tools / 16 boolean subschemas):
| SDK | Result |
|---|---|
@modelcontextprotocol/sdk 1.0.0 – 1.21.0 |
passes |
@modelcontextprotocol/sdk 1.22.0 – 1.32.2 |
fails |
@modelcontextprotocol/core 2.4.0 (v2) |
passes |
Python mcp 2.3.0 |
passes (output_schema: dict[str, Any] | None) |
Go go-sdk v1.8.0 |
passes (OutputSchema any) |
Expected behavior
{ "data": true } should be accepted. Per JSON Schema 2020-12 a boolean is a valid subschema, and the MCP spec only requires outputSchema to be a JSON Schema object with root type: "object".
Questions
- Is a v1 backport of the v2 relaxation planned, or should server authors treat this as a known v1 limitation?
- Independent of booleans: should a single malformed tool fail the entire
tools/list? Skipping or flagging only the offending tool would keep the rest usable.
Workaround (server side)
Rewrite boolean subschemas to the equivalent object form on the wire before sending tools/list: true -> {}, false -> { "not": {} }.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.8k
- Fork
- 2.5k
- Merge trung bình
- 6 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/typescript-sdk
-
v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Có thể đã có người làm @mgoldsborough đã nhận 6 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyCó thể đã có người làm @Tidehyc đã nhận 8 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsCó thể đã có người làm @yunusemrejs đã nhận 12 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/typescript-sdk
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Vessel9817/onion-site-template#512 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nightly-tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
approved
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
fritzprix/libr-agent#3266 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
better-auth/better-auth#13101 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày