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:
Olivier Chafik 2025-12-17 20:55:59 +00:00 • committed by GitHub
commit 82ab3c894c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2041 additions and 1246 deletions

934
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "@modelcontextprotocol/ext-apps", "name": "@modelcontextprotocol/ext-apps",
"version": "0.2.1", "version": "0.2.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@modelcontextprotocol/ext-apps", "name": "@modelcontextprotocol/ext-apps",
"version": "0.2.1", "version": "0.2.2",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"workspaces": [ "workspaces": [
@ -802,6 +802,74 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@esbuild/aix-ppc64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
"integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
"integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
"integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
"integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-arm64": { "node_modules/@esbuild/darwin-arm64": {
"version": "0.25.12", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
@ -819,6 +887,363 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/@esbuild/darwin-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
"integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
"integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
"integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
"integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
"integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
"integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
"integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
"integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
"integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
"integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
"integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
"integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
"integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openharmony-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
"integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
"integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
"integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
"integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@gerrit0/mini-shiki": { "node_modules/@gerrit0/mini-shiki": {
"version": "3.19.0", "version": "3.19.0",
"resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.19.0.tgz", "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.19.0.tgz",
@ -1198,9 +1623,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.53.5", "version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz",
"integrity": "sha512-YTbnsAaHo6VrAczISxgpTva8EkfQus0VPEVJCEaboHtZRIb6h6j0BNxRBOwnDciFTZLDPW5r+ZBmhL/+YpTZgA==", "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1267,9 +1692,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.53.5", "version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz",
"integrity": "sha512-Y+qVA0D9d0y2FRNiG9oM3Hut/DgODZbU9I8pLLPwAsU0tUKZ49cyV1tzmB/qRbSzGvY8lpgGkJuMyuhH7Ma+Vg==", "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1364,9 +1789,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.53.5", "version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz",
"integrity": "sha512-Pg6E+oP7GvZ4XwgRJBuSXZjcqpIW3yCBhK4BcsANvb47qMvAbCjR6E+1a/U2WXz1JJxp9/4Dno3/iSJLcm5auw==", "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1447,9 +1872,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.53.5", "version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz",
"integrity": "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ==", "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -5025,62 +5450,6 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/rollup/node_modules/@rollup/rollup-darwin-x64": {
"version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz",
"integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/rollup/node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz",
"integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/rollup/node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz",
"integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/rollup/node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.53.3",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz",
"integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/router": { "node_modules/router": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
@ -5997,6 +6366,74 @@
"fsevents": "~2.3.3" "fsevents": "~2.3.3"
} }
}, },
"node_modules/tsx/node_modules/@esbuild/aix-ppc64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.1.tgz",
"integrity": "sha512-HHB50pdsBX6k47S4u5g/CaLjqS3qwaOVE5ILsq64jyzgMhLuCuZ8rGzM9yhsAjfjkbgUPMzZEPa7DAp7yz6vuA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.1.tgz",
"integrity": "sha512-kFqa6/UcaTbGm/NncN9kzVOODjhZW8e+FRdSeypWe6j33gzclHtwlANs26JrupOntlcWmB0u8+8HZo8s7thHvg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.1.tgz",
"integrity": "sha512-45fuKmAJpxnQWixOGCrS+ro4Uvb4Re9+UTieUY2f8AEc+t7d4AaZ6eUJ3Hva7dtrxAAWHtlEFsXFMAgNnGU9uQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.1.tgz",
"integrity": "sha512-LBEpOz0BsgMEeHgenf5aqmn/lLNTFXVfoWMUox8CtWWYK9X4jmQzWjoGoNb8lmAYml/tQ/Ysvm8q7szu7BoxRQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/darwin-arm64": { "node_modules/tsx/node_modules/@esbuild/darwin-arm64": {
"version": "0.27.1", "version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.1.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.1.tgz",
@ -6014,6 +6451,363 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/tsx/node_modules/@esbuild/darwin-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.1.tgz",
"integrity": "sha512-+3ELd+nTzhfWb07Vol7EZ+5PTbJ/u74nC6iv4/lwIU99Ip5uuY6QoIf0Hn4m2HoV0qcnRivN3KSqc+FyCHjoVQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.1.tgz",
"integrity": "sha512-/8Rfgns4XD9XOSXlzUDepG8PX+AVWHliYlUkFI3K3GB6tqbdjYqdhcb4BKRd7C0BhZSoaCxhv8kTcBrcZWP+xg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.1.tgz",
"integrity": "sha512-GITpD8dK9C+r+5yRT/UKVT36h/DQLOHdwGVwwoHidlnA168oD3uxA878XloXebK4Ul3gDBBIvEdL7go9gCUFzQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.1.tgz",
"integrity": "sha512-ieMID0JRZY/ZeCrsFQ3Y3NlHNCqIhTprJfDgSB3/lv5jJZ8FX3hqPyXWhe+gvS5ARMBJ242PM+VNz/ctNj//eA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.1.tgz",
"integrity": "sha512-W9//kCrh/6in9rWIBdKaMtuTTzNj6jSeG/haWBADqLLa9P8O5YSRDzgD5y9QBok4AYlzS6ARHifAb75V6G670Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ia32": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.1.tgz",
"integrity": "sha512-VIUV4z8GD8rtSVMfAj1aXFahsi/+tcoXXNYmXgzISL+KB381vbSTNdeZHHHIYqFyXcoEhu9n5cT+05tRv13rlw==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-loong64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.1.tgz",
"integrity": "sha512-l4rfiiJRN7sTNI//ff65zJ9z8U+k6zcCg0LALU5iEWzY+a1mVZ8iWC1k5EsNKThZ7XCQ6YWtsZ8EWYm7r1UEsg==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-mips64el": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.1.tgz",
"integrity": "sha512-U0bEuAOLvO/DWFdygTHWY8C067FXz+UbzKgxYhXC0fDieFa0kDIra1FAhsAARRJbvEyso8aAqvPdNxzWuStBnA==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ppc64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.1.tgz",
"integrity": "sha512-NzdQ/Xwu6vPSf/GkdmRNsOfIeSGnh7muundsWItmBsVpMoNPVpM61qNzAVY3pZ1glzzAxLR40UyYM23eaDDbYQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-riscv64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.1.tgz",
"integrity": "sha512-7zlw8p3IApcsN7mFw0O1Z1PyEk6PlKMu18roImfl3iQHTnr/yAfYv6s4hXPidbDoI2Q0pW+5xeoM4eTCC0UdrQ==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-s390x": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.1.tgz",
"integrity": "sha512-cGj5wli+G+nkVQdZo3+7FDKC25Uh4ZVwOAK6A06Hsvgr8WqBBuOy/1s+PUEd/6Je+vjfm6stX0kmib5b/O2Ykw==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.1.tgz",
"integrity": "sha512-z3H/HYI9MM0HTv3hQZ81f+AKb+yEoCRlUby1F80vbQ5XdzEMyY/9iNlAmhqiBKw4MJXwfgsh7ERGEOhrM1niMA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.1.tgz",
"integrity": "sha512-wzC24DxAvk8Em01YmVXyjl96Mr+ecTPyOuADAvjGg+fyBpGmxmcr2E5ttf7Im8D0sXZihpxzO1isus8MdjMCXQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.1.tgz",
"integrity": "sha512-1YQ8ybGi2yIXswu6eNzJsrYIGFpnlzEWRl6iR5gMgmsrR0FcNoV1m9k9sc3PuP5rUBLshOZylc9nqSgymI+TYg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.1.tgz",
"integrity": "sha512-5Z+DzLCrq5wmU7RDaMDe2DVXMRm2tTDvX2KU14JJVBN2CT/qov7XVix85QoJqHltpvAOZUAc3ndU56HSMWrv8g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.1.tgz",
"integrity": "sha512-Q73ENzIdPF5jap4wqLtsfh8YbYSZ8Q0wnxplOlZUOyZy7B4ZKW8DXGWgTCZmF8VWD7Tciwv5F4NsRf6vYlZtqg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openharmony-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.1.tgz",
"integrity": "sha512-ajbHrGM/XiK+sXM0JzEbJAen+0E+JMQZ2l4RR4VFwvV9JEERx+oxtgkpoKv1SevhjavK2z2ReHk32pjzktWbGg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/sunos-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.1.tgz",
"integrity": "sha512-IPUW+y4VIjuDVn+OMzHc5FV4GubIwPnsz6ubkvN8cuhEqH81NovB53IUlrlBkPMEPxvNnf79MGBoz8rZ2iW8HA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-arm64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.1.tgz",
"integrity": "sha512-RIVRWiljWA6CdVu8zkWcRmGP7iRRIIwvhDKem8UMBjPql2TXM5PkDVvvrzMtj1V+WFPB4K7zkIGM7VzRtFkjdg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-ia32": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.1.tgz",
"integrity": "sha512-2BR5M8CPbptC1AK5JbJT1fWrHLvejwZidKx3UMSF0ecHMa+smhi16drIrCEggkgviBwLYd5nwrFLSl5Kho96RQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-x64": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.1.tgz",
"integrity": "sha512-d5X6RMYv6taIymSk8JBP+nxv8DQAMY6A51GPgusqLdK9wBz5wWIXy1KjTck6HnjE9hqJzJRdk+1p/t5soSbCtw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/esbuild": { "node_modules/tsx/node_modules/esbuild": {
"version": "0.27.1", "version": "0.27.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.1.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.1.tgz",

View file

@ -5,7 +5,7 @@
"url": "https://github.com/modelcontextprotocol/ext-apps" "url": "https://github.com/modelcontextprotocol/ext-apps"
}, },
"homepage": "https://github.com/modelcontextprotocol/ext-apps", "homepage": "https://github.com/modelcontextprotocol/ext-apps",
"version": "0.2.1", "version": "0.2.2",
"license": "MIT", "license": "MIT",
"description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.", "description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
"type": "module", "type": "module",

View file

@ -8,12 +8,10 @@
* *
* ts-to-zod is a powerful tool but has limitations that require post-processing: * ts-to-zod is a powerful tool but has limitations that require post-processing:
* *
* ### 1. Zod Import Path (`"zod"` → `"zod/v4"`) * ### 1. Zod Import Path (keep standard `"zod"` for version agnosticism)
* *
* **Problem**: ts-to-zod generates `import { z } from "zod"` but this project * ts-to-zod generates `import { z } from "zod"` which works with both
* uses the Zod v4 subpath import `"zod/v4"` for explicit version targeting. * Zod v3.25+ and v4. We keep this standard import to support both versions.
*
* **Solution**: Replace the import path in the generated output.
* *
* ### 2. External Type References (`z.any()` → actual schemas) * ### 2. External Type References (`z.any()` → actual schemas)
* *
@ -24,13 +22,14 @@
* *
* **Solution**: Import the schemas from MCP SDK and remove the z.any() placeholders. * **Solution**: Import the schemas from MCP SDK and remove the z.any() placeholders.
* *
* ### 3. Index Signatures (`z.record().and()` → `z.looseObject()`) * ### 3. Index Signatures (`z.record().and()` → `z.object().passthrough()`)
* *
* **Problem**: TypeScript index signatures like `[key: string]: unknown` are * **Problem**: TypeScript index signatures like `[key: string]: unknown` are
* translated by ts-to-zod to `z.record(z.string(), z.unknown()).and(z.object({...}))`. * translated by ts-to-zod to `z.record(z.string(), z.unknown()).and(z.object({...}))`.
* This creates a `ZodIntersection` type which doesn't support `.extend()` etc. * This creates a `ZodIntersection` type which doesn't support `.extend()` etc.
* *
* **Solution**: Replace the intersection pattern with `z.looseObject()`. * **Solution**: Replace with `z.object({...}).passthrough()` which works in both
* Zod v3 and v4, allowing extra properties while validating known ones.
* *
* ## Adding Schema Descriptions * ## Adding Schema Descriptions
* *
@ -178,23 +177,17 @@ async function generateJsonSchema() {
* Post-process generated schemas for project compatibility. * Post-process generated schemas for project compatibility.
*/ */
function postProcess(content: string): string { function postProcess(content: string): string {
// 1. Update import to use zod/v4 // 1. Add MCP SDK schema imports (keep standard zod import for v3/v4 compatibility)
content = content.replace(
'import { z } from "zod";',
'import * as z from "zod/v4";',
);
// 2. Add MCP SDK schema imports
const mcpImports = EXTERNAL_TYPE_SCHEMAS.join(",\n "); const mcpImports = EXTERNAL_TYPE_SCHEMAS.join(",\n ");
content = content.replace( content = content.replace(
'import * as z from "zod/v4";', 'import { z } from "zod";',
`import * as z from "zod/v4"; `import { z } from "zod";
import { import {
${mcpImports}, ${mcpImports},
} from "@modelcontextprotocol/sdk/types.js";`, } from "@modelcontextprotocol/sdk/types.js";`,
); );
// 3. Remove z.any() placeholders for external types (now imported from MCP SDK) // 2. Remove z.any() placeholders for external types (now imported from MCP SDK)
for (const schema of EXTERNAL_TYPE_SCHEMAS) { for (const schema of EXTERNAL_TYPE_SCHEMAS) {
content = content.replace( content = content.replace(
new RegExp(`(?:export )?const ${schema} = z\\.any\\(\\);\\n?`, "g"), new RegExp(`(?:export )?const ${schema} = z\\.any\\(\\);\\n?`, "g"),
@ -202,15 +195,16 @@ import {
); );
} }
// 4. Replace z.record().and(z.object({...})) with z.looseObject({...}) // 3. Replace z.record().and(z.object({...})) with z.object({...}).passthrough()
// Uses brace-counting to handle nested objects correctly. // Uses brace-counting to handle nested objects correctly.
content = replaceRecordAndWithLooseObject(content); // passthrough() works in both Zod v3 and v4, unlike looseObject() which is v4-only.
content = replaceRecordAndWithPassthrough(content);
// 5. Add header comment // 4. Add header comment
content = content.replace( content = content.replace(
"// Generated by ts-to-zod", "// Generated by ts-to-zod",
`// Generated by ts-to-zod `// 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`, // Run: npm run generate:schemas`,
); );
@ -218,10 +212,11 @@ import {
} }
/** /**
* Replace z.record(z.string(), z.unknown()).and(z.object({...})) with z.looseObject({...}) * Replace z.record(z.string(), z.unknown()).and(z.object({...})) with z.object({...}).passthrough()
* Uses brace-counting to handle nested objects correctly. * Uses brace-counting to handle nested objects correctly.
* passthrough() works in both Zod v3 and v4, allowing extra properties.
*/ */
function replaceRecordAndWithLooseObject(content: string): string { function replaceRecordAndWithPassthrough(content: string): string {
const pattern = "z.record(z.string(), z.unknown()).and(z.object({"; const pattern = "z.record(z.string(), z.unknown()).and(z.object({";
let result = content; let result = content;
let startIndex = 0; let startIndex = 0;
@ -245,7 +240,7 @@ function replaceRecordAndWithLooseObject(content: string): string {
// Check if followed by )) // Check if followed by ))
if (result.slice(i, i + 2) === "))") { if (result.slice(i, i + 2) === "))") {
const objectContent = result.slice(objectStart, i - 1); const objectContent = result.slice(objectStart, i - 1);
const replacement = `z.looseObject({${objectContent}})`; const replacement = `z.object({${objectContent}}).passthrough()`;
result = result.slice(0, matchStart) + replacement + result.slice(i + 2); result = result.slice(0, matchStart) + replacement + result.slice(i + 2);
startIndex = matchStart + replacement.length; startIndex = matchStart + replacement.length;
} else { } else {
@ -260,11 +255,7 @@ function replaceRecordAndWithLooseObject(content: string): string {
* Post-process generated integration tests. * Post-process generated integration tests.
*/ */
function postProcessTests(content: string): string { function postProcessTests(content: string): string {
content = content.replace( // Keep standard zod import for v3/v4 compatibility
'import { z } from "zod";',
'import * as z from "zod/v4";',
);
content = content.replace( content = content.replace(
"// Generated by ts-to-zod", "// Generated by ts-to-zod",
`// Generated by ts-to-zod `// Generated by ts-to-zod

View file

@ -1,7 +1,7 @@
// Generated by ts-to-zod // Generated by ts-to-zod
// Integration tests verifying schemas match TypeScript types // Integration tests verifying schemas match TypeScript types
// Run: npm run generate:schemas // Run: npm run generate:schemas
import * as z from "zod/v4"; import { z } from "zod";
import * as spec from "../spec.types.js"; import * as spec from "../spec.types.js";
import * as generated from "./schema.js"; import * as generated from "./schema.js";

284
src/generated/schema.ts generated
View file

@ -1,7 +1,7 @@
// Generated by ts-to-zod // 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 // Run: npm run generate:schemas
import * as z from "zod/v4"; import { z } from "zod";
import { import {
ContentBlockSchema, ContentBlockSchema,
CallToolResultSchema, CallToolResultSchema,
@ -148,27 +148,31 @@ export const McpUiOpenLinkRequestSchema = z.object({
* @description Result from opening a URL. * @description Result from opening a URL.
* @see {@link McpUiOpenLinkRequest} * @see {@link McpUiOpenLinkRequest}
*/ */
export const McpUiOpenLinkResultSchema = z.looseObject({ export const McpUiOpenLinkResultSchema = z
/** @description True if the host failed to open the URL (e.g., due to security policy). */ .object({
isError: z /** @description True if the host failed to open the URL (e.g., due to security policy). */
.boolean() isError: z
.optional() .boolean()
.describe( .optional()
"True if the host failed to open the URL (e.g., due to security policy).", .describe(
), "True if the host failed to open the URL (e.g., due to security policy).",
}); ),
})
.passthrough();
/** /**
* @description Result from sending a message. * @description Result from sending a message.
* @see {@link McpUiMessageRequest} * @see {@link McpUiMessageRequest}
*/ */
export const McpUiMessageResultSchema = z.looseObject({ export const McpUiMessageResultSchema = z
/** @description True if the host rejected or failed to deliver the message. */ .object({
isError: z /** @description True if the host rejected or failed to deliver the message. */
.boolean() isError: z
.optional() .boolean()
.describe("True if the host rejected or failed to deliver the message."), .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. * @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. * @description Result from requesting a display mode change.
* @see {@link McpUiRequestDisplayModeRequest} * @see {@link McpUiRequestDisplayModeRequest}
*/ */
export const McpUiRequestDisplayModeResultSchema = z.looseObject({ export const McpUiRequestDisplayModeResultSchema = z
/** @description The display mode that was actually set. May differ from requested if not supported. */ .object({
mode: McpUiDisplayModeSchema.describe( /** @description The display mode that was actually set. May differ from requested if not supported. */
"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. * @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. * @description Rich context about the host environment provided to Guest UIs.
*/ */
export const McpUiHostContextSchema = z.looseObject({ export const McpUiHostContextSchema = z
/** @description Metadata of the tool call that instantiated this App. */ .object({
toolInfo: z /** @description Metadata of the tool call that instantiated this App. */
.object({ toolInfo: z
/** @description JSON-RPC id of the tools/call request. */ .object({
id: RequestIdSchema.describe("JSON-RPC id of the tools/call request."), /** @description JSON-RPC id of the tools/call request. */
/** @description Tool definition including name, inputSchema, etc. */ id: RequestIdSchema.describe("JSON-RPC id of the tools/call request."),
tool: ToolSchema.describe( /** @description Tool definition including name, inputSchema, etc. */
"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."), .optional()
/** @description Current color theme preference. */ .describe("Metadata of the tool call that instantiated this App."),
theme: McpUiThemeSchema.optional().describe( /** @description Current color theme preference. */
"Current color theme preference.", theme: McpUiThemeSchema.optional().describe(
), "Current color theme preference.",
/** @description Style configuration for theming the app. */ ),
styles: McpUiHostStylesSchema.optional().describe( /** @description Style configuration for theming the app. */
"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( /** @description How the UI is currently displayed. */
"How the UI is currently displayed.", displayMode: McpUiDisplayModeSchema.optional().describe(
), "How the UI is currently displayed.",
/** @description Display modes the host supports. */ ),
availableDisplayModes: z /** @description Display modes the host supports. */
.array(z.string()) availableDisplayModes: z
.optional() .array(z.string())
.describe("Display modes the host supports."), .optional()
/** @description Current and maximum dimensions available to the UI. */ .describe("Display modes the host supports."),
viewport: z /** @description Current and maximum dimensions available to the UI. */
.object({ viewport: z
/** @description Current viewport width in pixels. */ .object({
width: z.number().describe("Current viewport width in pixels."), /** @description Current viewport width in pixels. */
/** @description Current viewport height in pixels. */ width: z.number().describe("Current viewport width in pixels."),
height: z.number().describe("Current viewport height in pixels."), /** @description Current viewport height in pixels. */
/** @description Maximum available height in pixels (if constrained). */ height: z.number().describe("Current viewport height in pixels."),
maxHeight: z /** @description Maximum available height in pixels (if constrained). */
.number() maxHeight: z
.optional() .number()
.describe("Maximum available height in pixels (if constrained)."), .optional()
/** @description Maximum available width in pixels (if constrained). */ .describe("Maximum available height in pixels (if constrained)."),
maxWidth: z /** @description Maximum available width in pixels (if constrained). */
.number() maxWidth: z
.optional() .number()
.describe("Maximum available width in pixels (if constrained)."), .optional()
}) .describe("Maximum available width in pixels (if constrained)."),
.optional() })
.describe("Current and maximum dimensions available to the UI."), .optional()
/** @description User's language and region preference in BCP 47 format. */ .describe("Current and maximum dimensions available to the UI."),
locale: z /** @description User's language and region preference in BCP 47 format. */
.string() locale: z
.optional() .string()
.describe("User's language and region preference in BCP 47 format."), .optional()
/** @description User's timezone in IANA format. */ .describe("User's language and region preference in BCP 47 format."),
timeZone: z.string().optional().describe("User's timezone in IANA format."), /** @description User's timezone in IANA format. */
/** @description Host application identifier. */ timeZone: z.string().optional().describe("User's timezone in IANA format."),
userAgent: z.string().optional().describe("Host application identifier."), /** @description Host application identifier. */
/** @description Platform type for responsive design decisions. */ userAgent: z.string().optional().describe("Host application identifier."),
platform: z /** @description Platform type for responsive design decisions. */
.union([z.literal("web"), z.literal("desktop"), z.literal("mobile")]) platform: z
.optional() .union([z.literal("web"), z.literal("desktop"), z.literal("mobile")])
.describe("Platform type for responsive design decisions."), .optional()
/** @description Device input capabilities. */ .describe("Platform type for responsive design decisions."),
deviceCapabilities: z /** @description Device input capabilities. */
.object({ deviceCapabilities: z
/** @description Whether the device supports touch input. */ .object({
touch: z /** @description Whether the device supports touch input. */
.boolean() touch: z
.optional() .boolean()
.describe("Whether the device supports touch input."), .optional()
/** @description Whether the device supports hover interactions. */ .describe("Whether the device supports touch input."),
hover: z /** @description Whether the device supports hover interactions. */
.boolean() hover: z
.optional() .boolean()
.describe("Whether the device supports hover interactions."), .optional()
}) .describe("Whether the device supports hover interactions."),
.optional() })
.describe("Device input capabilities."), .optional()
/** @description Mobile safe area boundaries in pixels. */ .describe("Device input capabilities."),
safeAreaInsets: z /** @description Mobile safe area boundaries in pixels. */
.object({ safeAreaInsets: z
/** @description Top safe area inset in pixels. */ .object({
top: z.number().describe("Top safe area inset in pixels."), /** @description Top safe area inset in pixels. */
/** @description Right safe area inset in pixels. */ top: z.number().describe("Top safe area inset in pixels."),
right: z.number().describe("Right safe area inset in pixels."), /** @description Right safe area inset in pixels. */
/** @description Bottom safe area inset in pixels. */ right: z.number().describe("Right safe area inset in pixels."),
bottom: z.number().describe("Bottom safe area inset in pixels."), /** @description Bottom safe area inset in pixels. */
/** @description Left safe area inset in pixels. */ bottom: z.number().describe("Bottom safe area inset in pixels."),
left: z.number().describe("Left 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."), .optional()
}); .describe("Mobile safe area boundaries in pixels."),
})
.passthrough();
/** /**
* @description Notification that host context has changed (Host -> Guest UI). * @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. * @description Initialization result returned from Host to Guest UI.
* @see {@link McpUiInitializeRequest} * @see {@link McpUiInitializeRequest}
*/ */
export const McpUiInitializeResultSchema = z.looseObject({ export const McpUiInitializeResultSchema = z
/** @description Negotiated protocol version string (e.g., "2025-11-21"). */ .object({
protocolVersion: z /** @description Negotiated protocol version string (e.g., "2025-11-21"). */
.string() protocolVersion: z
.describe('Negotiated protocol version string (e.g., "2025-11-21").'), .string()
/** @description Host application identification and version. */ .describe('Negotiated protocol version string (e.g., "2025-11-21").'),
hostInfo: ImplementationSchema.describe( /** @description Host application identification and version. */
"Host application identification and version.", hostInfo: ImplementationSchema.describe(
), "Host application identification and version.",
/** @description Features and capabilities provided by the host. */ ),
hostCapabilities: McpUiHostCapabilitiesSchema.describe( /** @description Features and capabilities provided by the host. */
"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( /** @description Rich context about the host environment. */
"Rich context about the host environment.", hostContext: McpUiHostContextSchema.describe(
), "Rich context about the host environment.",
}); ),
})
.passthrough();