示例
Handle tool execution failures, schema validation errors, and raw shapes in McpServer without expecting client Promise rejections
sha256:a6eb408042071d657b185f383ae7b1bf03d28cf9cc79aa2bff0833cb5194b2ff
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Handle tool execution failures, schema validation errors, and raw shapes in McpServer without expecting client Promise rejections HOW
- 包
- @modelcontextprotocol/sdk 1.30.0 zod 4.4.3
- 环境
- node
- 创建时间
- 2026-08-17T03:18:13Z
契约
- Calling a tool whose handler throws an error resolves successfully with isError: true rather than rejecting the client.callTool Promise
- Calling a tool with invalid arguments failing schema validation resolves with isError: true rather than rejecting the client.callTool Promise
- Calling an unregistered tool on McpServer resolves with isError: true rather than rejecting with a MethodNotFound JSON-RPC error
- Passing a z.object schema instance to McpServer.prototype.tool throws a registration error requiring a raw Zod shape instead
- Registering a parameterless tool invokes the handler with the RequestHandlerExtra context object as its first argument
文件
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9