chore: bump to 0.2.2 + make Zod schemas version-agnostic (v3.25+/v4) (#178)
* feat: make generated Zod schemas version-agnostic (v3.25+/v4) - Change generated schema imports from `zod/v4` to standard `zod` - Replace v4-only `z.looseObject()` with `z.object().passthrough()` - Works with both Zod v3.25+ and v4, matching MCP TS SDK approach - Bump version to 0.2.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: regenerate package-lock.json in Docker 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bbea41f27b
commit
82ab3c894c
2 changed files with 2041 additions and 1246 deletions
2
src/generated/schema.test.ts
generated
2
src/generated/schema.test.ts
generated
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by ts-to-zod
|
||||
// Integration tests verifying schemas match TypeScript types
|
||||
// Run: npm run generate:schemas
|
||||
import * as z from "zod/v4";
|
||||
import { z } from "zod";
|
||||
|
||||
import * as spec from "../spec.types.js";
|
||||
import * as generated from "./schema.js";
|
||||
|
|
|
|||
284
src/generated/schema.ts
generated
284
src/generated/schema.ts
generated
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by ts-to-zod
|
||||
// Post-processed for Zod v4 and MCP SDK compatibility
|
||||
// Post-processed for Zod v3/v4 compatibility and MCP SDK integration
|
||||
// Run: npm run generate:schemas
|
||||
import * as z from "zod/v4";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
ContentBlockSchema,
|
||||
CallToolResultSchema,
|
||||
|
|
@ -148,27 +148,31 @@ export const McpUiOpenLinkRequestSchema = z.object({
|
|||
* @description Result from opening a URL.
|
||||
* @see {@link McpUiOpenLinkRequest}
|
||||
*/
|
||||
export const McpUiOpenLinkResultSchema = z.looseObject({
|
||||
/** @description True if the host failed to open the URL (e.g., due to security policy). */
|
||||
isError: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe(
|
||||
"True if the host failed to open the URL (e.g., due to security policy).",
|
||||
),
|
||||
});
|
||||
export const McpUiOpenLinkResultSchema = z
|
||||
.object({
|
||||
/** @description True if the host failed to open the URL (e.g., due to security policy). */
|
||||
isError: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe(
|
||||
"True if the host failed to open the URL (e.g., due to security policy).",
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* @description Result from sending a message.
|
||||
* @see {@link McpUiMessageRequest}
|
||||
*/
|
||||
export const McpUiMessageResultSchema = z.looseObject({
|
||||
/** @description True if the host rejected or failed to deliver the message. */
|
||||
isError: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("True if the host rejected or failed to deliver the message."),
|
||||
});
|
||||
export const McpUiMessageResultSchema = z
|
||||
.object({
|
||||
/** @description True if the host rejected or failed to deliver the message. */
|
||||
isError: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("True if the host rejected or failed to deliver the message."),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* @description Notification that the sandbox proxy iframe is ready to receive content.
|
||||
|
|
@ -458,12 +462,14 @@ export const McpUiRequestDisplayModeRequestSchema = z.object({
|
|||
* @description Result from requesting a display mode change.
|
||||
* @see {@link McpUiRequestDisplayModeRequest}
|
||||
*/
|
||||
export const McpUiRequestDisplayModeResultSchema = z.looseObject({
|
||||
/** @description The display mode that was actually set. May differ from requested if not supported. */
|
||||
mode: McpUiDisplayModeSchema.describe(
|
||||
"The display mode that was actually set. May differ from requested if not supported.",
|
||||
),
|
||||
});
|
||||
export const McpUiRequestDisplayModeResultSchema = z
|
||||
.object({
|
||||
/** @description The display mode that was actually set. May differ from requested if not supported. */
|
||||
mode: McpUiDisplayModeSchema.describe(
|
||||
"The display mode that was actually set. May differ from requested if not supported.",
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* @description Tool visibility scope - who can access the tool.
|
||||
|
|
@ -526,101 +532,103 @@ export const McpUiToolResultNotificationSchema = z.object({
|
|||
/**
|
||||
* @description Rich context about the host environment provided to Guest UIs.
|
||||
*/
|
||||
export const McpUiHostContextSchema = z.looseObject({
|
||||
/** @description Metadata of the tool call that instantiated this App. */
|
||||
toolInfo: z
|
||||
.object({
|
||||
/** @description JSON-RPC id of the tools/call request. */
|
||||
id: RequestIdSchema.describe("JSON-RPC id of the tools/call request."),
|
||||
/** @description Tool definition including name, inputSchema, etc. */
|
||||
tool: ToolSchema.describe(
|
||||
"Tool definition including name, inputSchema, etc.",
|
||||
),
|
||||
})
|
||||
.optional()
|
||||
.describe("Metadata of the tool call that instantiated this App."),
|
||||
/** @description Current color theme preference. */
|
||||
theme: McpUiThemeSchema.optional().describe(
|
||||
"Current color theme preference.",
|
||||
),
|
||||
/** @description Style configuration for theming the app. */
|
||||
styles: McpUiHostStylesSchema.optional().describe(
|
||||
"Style configuration for theming the app.",
|
||||
),
|
||||
/** @description How the UI is currently displayed. */
|
||||
displayMode: McpUiDisplayModeSchema.optional().describe(
|
||||
"How the UI is currently displayed.",
|
||||
),
|
||||
/** @description Display modes the host supports. */
|
||||
availableDisplayModes: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.describe("Display modes the host supports."),
|
||||
/** @description Current and maximum dimensions available to the UI. */
|
||||
viewport: z
|
||||
.object({
|
||||
/** @description Current viewport width in pixels. */
|
||||
width: z.number().describe("Current viewport width in pixels."),
|
||||
/** @description Current viewport height in pixels. */
|
||||
height: z.number().describe("Current viewport height in pixels."),
|
||||
/** @description Maximum available height in pixels (if constrained). */
|
||||
maxHeight: z
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Maximum available height in pixels (if constrained)."),
|
||||
/** @description Maximum available width in pixels (if constrained). */
|
||||
maxWidth: z
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Maximum available width in pixels (if constrained)."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Current and maximum dimensions available to the UI."),
|
||||
/** @description User's language and region preference in BCP 47 format. */
|
||||
locale: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("User's language and region preference in BCP 47 format."),
|
||||
/** @description User's timezone in IANA format. */
|
||||
timeZone: z.string().optional().describe("User's timezone in IANA format."),
|
||||
/** @description Host application identifier. */
|
||||
userAgent: z.string().optional().describe("Host application identifier."),
|
||||
/** @description Platform type for responsive design decisions. */
|
||||
platform: z
|
||||
.union([z.literal("web"), z.literal("desktop"), z.literal("mobile")])
|
||||
.optional()
|
||||
.describe("Platform type for responsive design decisions."),
|
||||
/** @description Device input capabilities. */
|
||||
deviceCapabilities: z
|
||||
.object({
|
||||
/** @description Whether the device supports touch input. */
|
||||
touch: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("Whether the device supports touch input."),
|
||||
/** @description Whether the device supports hover interactions. */
|
||||
hover: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("Whether the device supports hover interactions."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Device input capabilities."),
|
||||
/** @description Mobile safe area boundaries in pixels. */
|
||||
safeAreaInsets: z
|
||||
.object({
|
||||
/** @description Top safe area inset in pixels. */
|
||||
top: z.number().describe("Top safe area inset in pixels."),
|
||||
/** @description Right safe area inset in pixels. */
|
||||
right: z.number().describe("Right safe area inset in pixels."),
|
||||
/** @description Bottom safe area inset in pixels. */
|
||||
bottom: z.number().describe("Bottom safe area inset in pixels."),
|
||||
/** @description Left safe area inset in pixels. */
|
||||
left: z.number().describe("Left safe area inset in pixels."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Mobile safe area boundaries in pixels."),
|
||||
});
|
||||
export const McpUiHostContextSchema = z
|
||||
.object({
|
||||
/** @description Metadata of the tool call that instantiated this App. */
|
||||
toolInfo: z
|
||||
.object({
|
||||
/** @description JSON-RPC id of the tools/call request. */
|
||||
id: RequestIdSchema.describe("JSON-RPC id of the tools/call request."),
|
||||
/** @description Tool definition including name, inputSchema, etc. */
|
||||
tool: ToolSchema.describe(
|
||||
"Tool definition including name, inputSchema, etc.",
|
||||
),
|
||||
})
|
||||
.optional()
|
||||
.describe("Metadata of the tool call that instantiated this App."),
|
||||
/** @description Current color theme preference. */
|
||||
theme: McpUiThemeSchema.optional().describe(
|
||||
"Current color theme preference.",
|
||||
),
|
||||
/** @description Style configuration for theming the app. */
|
||||
styles: McpUiHostStylesSchema.optional().describe(
|
||||
"Style configuration for theming the app.",
|
||||
),
|
||||
/** @description How the UI is currently displayed. */
|
||||
displayMode: McpUiDisplayModeSchema.optional().describe(
|
||||
"How the UI is currently displayed.",
|
||||
),
|
||||
/** @description Display modes the host supports. */
|
||||
availableDisplayModes: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.describe("Display modes the host supports."),
|
||||
/** @description Current and maximum dimensions available to the UI. */
|
||||
viewport: z
|
||||
.object({
|
||||
/** @description Current viewport width in pixels. */
|
||||
width: z.number().describe("Current viewport width in pixels."),
|
||||
/** @description Current viewport height in pixels. */
|
||||
height: z.number().describe("Current viewport height in pixels."),
|
||||
/** @description Maximum available height in pixels (if constrained). */
|
||||
maxHeight: z
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Maximum available height in pixels (if constrained)."),
|
||||
/** @description Maximum available width in pixels (if constrained). */
|
||||
maxWidth: z
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Maximum available width in pixels (if constrained)."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Current and maximum dimensions available to the UI."),
|
||||
/** @description User's language and region preference in BCP 47 format. */
|
||||
locale: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("User's language and region preference in BCP 47 format."),
|
||||
/** @description User's timezone in IANA format. */
|
||||
timeZone: z.string().optional().describe("User's timezone in IANA format."),
|
||||
/** @description Host application identifier. */
|
||||
userAgent: z.string().optional().describe("Host application identifier."),
|
||||
/** @description Platform type for responsive design decisions. */
|
||||
platform: z
|
||||
.union([z.literal("web"), z.literal("desktop"), z.literal("mobile")])
|
||||
.optional()
|
||||
.describe("Platform type for responsive design decisions."),
|
||||
/** @description Device input capabilities. */
|
||||
deviceCapabilities: z
|
||||
.object({
|
||||
/** @description Whether the device supports touch input. */
|
||||
touch: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("Whether the device supports touch input."),
|
||||
/** @description Whether the device supports hover interactions. */
|
||||
hover: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe("Whether the device supports hover interactions."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Device input capabilities."),
|
||||
/** @description Mobile safe area boundaries in pixels. */
|
||||
safeAreaInsets: z
|
||||
.object({
|
||||
/** @description Top safe area inset in pixels. */
|
||||
top: z.number().describe("Top safe area inset in pixels."),
|
||||
/** @description Right safe area inset in pixels. */
|
||||
right: z.number().describe("Right safe area inset in pixels."),
|
||||
/** @description Bottom safe area inset in pixels. */
|
||||
bottom: z.number().describe("Bottom safe area inset in pixels."),
|
||||
/** @description Left safe area inset in pixels. */
|
||||
left: z.number().describe("Left safe area inset in pixels."),
|
||||
})
|
||||
.optional()
|
||||
.describe("Mobile safe area boundaries in pixels."),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* @description Notification that host context has changed (Host -> Guest UI).
|
||||
|
|
@ -658,21 +666,23 @@ export const McpUiInitializeRequestSchema = z.object({
|
|||
* @description Initialization result returned from Host to Guest UI.
|
||||
* @see {@link McpUiInitializeRequest}
|
||||
*/
|
||||
export const McpUiInitializeResultSchema = z.looseObject({
|
||||
/** @description Negotiated protocol version string (e.g., "2025-11-21"). */
|
||||
protocolVersion: z
|
||||
.string()
|
||||
.describe('Negotiated protocol version string (e.g., "2025-11-21").'),
|
||||
/** @description Host application identification and version. */
|
||||
hostInfo: ImplementationSchema.describe(
|
||||
"Host application identification and version.",
|
||||
),
|
||||
/** @description Features and capabilities provided by the host. */
|
||||
hostCapabilities: McpUiHostCapabilitiesSchema.describe(
|
||||
"Features and capabilities provided by the host.",
|
||||
),
|
||||
/** @description Rich context about the host environment. */
|
||||
hostContext: McpUiHostContextSchema.describe(
|
||||
"Rich context about the host environment.",
|
||||
),
|
||||
});
|
||||
export const McpUiInitializeResultSchema = z
|
||||
.object({
|
||||
/** @description Negotiated protocol version string (e.g., "2025-11-21"). */
|
||||
protocolVersion: z
|
||||
.string()
|
||||
.describe('Negotiated protocol version string (e.g., "2025-11-21").'),
|
||||
/** @description Host application identification and version. */
|
||||
hostInfo: ImplementationSchema.describe(
|
||||
"Host application identification and version.",
|
||||
),
|
||||
/** @description Features and capabilities provided by the host. */
|
||||
hostCapabilities: McpUiHostCapabilitiesSchema.describe(
|
||||
"Features and capabilities provided by the host.",
|
||||
),
|
||||
/** @description Rich context about the host environment. */
|
||||
hostContext: McpUiHostContextSchema.describe(
|
||||
"Rich context about the host environment.",
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
|
|
|||
Loading…
Reference in a new issue