diff --git a/scripts/generate-schemas.ts b/scripts/generate-schemas.ts index 85225f5..0ff9f04 100644 --- a/scripts/generate-schemas.ts +++ b/scripts/generate-schemas.ts @@ -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()`) * diff --git a/src/core-types.ts b/src/core-types.ts deleted file mode 100644 index 19392d2..0000000 --- a/src/core-types.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { - CallToolResultSchema, - ContentBlockSchema, - EmbeddedResourceSchema, - ImplementationSchema, - RequestIdSchema, - ResourceLinkSchema, - ToolSchema, -} from "@modelcontextprotocol/core"; -import type { z } from "zod/v4"; - -// Infer shared wire types from the public role-neutral schemas so declarations -// used by every entrypoint do not acquire a client or server package edge. -export type CallToolResult = z.infer; -export type ContentBlock = z.infer; -export type EmbeddedResource = z.infer; -export type Implementation = z.infer; -export type RequestId = z.infer; -export type ResourceLink = z.infer; -export type Tool = z.infer; diff --git a/src/spec.types.ts b/src/spec.types.ts index 5d3fda6..0c45396 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -18,7 +18,7 @@ import type { RequestId, ResourceLink, Tool, -} from "./core-types"; +} from "@modelcontextprotocol/client"; /** * Current protocol version supported by this SDK.