Import shared wire types from @modelcontextprotocol/client
spec.types.ts previously inferred CallToolResult, ContentBlock and friends from core's Zod schemas via a local core-types module so that the type surface stayed free of a client package edge. Now that client is a required peer, take the types from it directly and delete the indirection. Generated schemas are unchanged.
This commit is contained in:
parent
50eb30ec8d
commit
040942b3af
1 changed files with 6 additions and 24 deletions
|
|
@ -22,10 +22,12 @@
|
|||
*
|
||||
* **Problem**: ts-to-zod cannot resolve types imported from external packages.
|
||||
* When it encounters types like `ContentBlock`, `CallToolResult`, `Implementation`,
|
||||
* `RequestId`, and `Tool` from `@modelcontextprotocol/core`, it generates `z.any()`
|
||||
* as a placeholder.
|
||||
* `RequestId`, and `Tool` (imported by spec.types.ts from
|
||||
* `@modelcontextprotocol/client`), it generates `z.any()` as a placeholder.
|
||||
*
|
||||
* **Solution**: Import the schemas from MCP SDK and remove the z.any() placeholders.
|
||||
* **Solution**: Import the corresponding Zod schemas from
|
||||
* `@modelcontextprotocol/core` (the role-neutral package both client and
|
||||
* server re-export) and remove the z.any() placeholders.
|
||||
*
|
||||
* ### 3. Index Signatures (`z.record().and()` → `z.object().passthrough()`)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue