@modelcontextprotocol/sdk 1.18.2 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/README.md +766 -738
  2. package/dist/cjs/cli.js +35 -37
  3. package/dist/cjs/cli.js.map +1 -1
  4. package/dist/cjs/client/auth.d.ts +12 -12
  5. package/dist/cjs/client/auth.d.ts.map +1 -1
  6. package/dist/cjs/client/auth.js +76 -83
  7. package/dist/cjs/client/auth.js.map +1 -1
  8. package/dist/cjs/client/index.d.ts +186 -123
  9. package/dist/cjs/client/index.d.ts.map +1 -1
  10. package/dist/cjs/client/index.js +40 -41
  11. package/dist/cjs/client/index.js.map +1 -1
  12. package/dist/cjs/client/middleware.d.ts +2 -2
  13. package/dist/cjs/client/middleware.d.ts.map +1 -1
  14. package/dist/cjs/client/middleware.js +22 -27
  15. package/dist/cjs/client/middleware.js.map +1 -1
  16. package/dist/cjs/client/sse.d.ts +4 -4
  17. package/dist/cjs/client/sse.d.ts.map +1 -1
  18. package/dist/cjs/client/sse.js +34 -21
  19. package/dist/cjs/client/sse.js.map +1 -1
  20. package/dist/cjs/client/stdio.d.ts +4 -4
  21. package/dist/cjs/client/stdio.d.ts.map +1 -1
  22. package/dist/cjs/client/stdio.js +32 -32
  23. package/dist/cjs/client/stdio.js.map +1 -1
  24. package/dist/cjs/client/streamableHttp.d.ts +7 -6
  25. package/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  26. package/dist/cjs/client/streamableHttp.js +55 -38
  27. package/dist/cjs/client/streamableHttp.js.map +1 -1
  28. package/dist/cjs/client/websocket.d.ts +2 -2
  29. package/dist/cjs/client/websocket.d.ts.map +1 -1
  30. package/dist/cjs/client/websocket.js +5 -7
  31. package/dist/cjs/client/websocket.js.map +1 -1
  32. package/dist/cjs/examples/client/multipleClientsParallel.js +2 -2
  33. package/dist/cjs/examples/client/multipleClientsParallel.js.map +1 -1
  34. package/dist/cjs/examples/client/parallelToolCallsClient.js +6 -5
  35. package/dist/cjs/examples/client/parallelToolCallsClient.js.map +1 -1
  36. package/dist/cjs/examples/client/simpleOAuthClient.js +15 -13
  37. package/dist/cjs/examples/client/simpleOAuthClient.js.map +1 -1
  38. package/dist/cjs/examples/client/simpleStreamableHttp.js +15 -11
  39. package/dist/cjs/examples/client/simpleStreamableHttp.js.map +1 -1
  40. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.js +2 -2
  41. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.js.map +1 -1
  42. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +1 -1
  43. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  44. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js +18 -16
  45. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  46. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js +18 -18
  47. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  48. package/dist/cjs/examples/server/mcpServerOutputSchema.js +19 -17
  49. package/dist/cjs/examples/server/mcpServerOutputSchema.js.map +1 -1
  50. package/dist/cjs/examples/server/simpleSseServer.js +8 -8
  51. package/dist/cjs/examples/server/simpleSseServer.js.map +1 -1
  52. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js +22 -22
  53. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  54. package/dist/cjs/examples/server/simpleStreamableHttp.js +78 -78
  55. package/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
  56. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +18 -18
  57. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  58. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +8 -8
  59. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  60. package/dist/cjs/examples/server/toolWithSampleServer.js +19 -19
  61. package/dist/cjs/examples/server/toolWithSampleServer.js.map +1 -1
  62. package/dist/cjs/examples/shared/inMemoryEventStore.d.ts.map +1 -1
  63. package/dist/cjs/examples/shared/inMemoryEventStore.js.map +1 -1
  64. package/dist/cjs/inMemory.d.ts +3 -3
  65. package/dist/cjs/inMemory.d.ts.map +1 -1
  66. package/dist/cjs/inMemory.js +1 -1
  67. package/dist/cjs/inMemory.js.map +1 -1
  68. package/dist/cjs/server/auth/clients.d.ts +2 -2
  69. package/dist/cjs/server/auth/clients.d.ts.map +1 -1
  70. package/dist/cjs/server/auth/errors.d.ts +1 -1
  71. package/dist/cjs/server/auth/errors.d.ts.map +1 -1
  72. package/dist/cjs/server/auth/errors.js +17 -17
  73. package/dist/cjs/server/auth/errors.js.map +1 -1
  74. package/dist/cjs/server/auth/handlers/authorize.d.ts +3 -3
  75. package/dist/cjs/server/auth/handlers/authorize.d.ts.map +1 -1
  76. package/dist/cjs/server/auth/handlers/authorize.js +21 -18
  77. package/dist/cjs/server/auth/handlers/authorize.js.map +1 -1
  78. package/dist/cjs/server/auth/handlers/metadata.d.ts +2 -2
  79. package/dist/cjs/server/auth/handlers/metadata.js +1 -1
  80. package/dist/cjs/server/auth/handlers/metadata.js.map +1 -1
  81. package/dist/cjs/server/auth/handlers/register.d.ts +4 -4
  82. package/dist/cjs/server/auth/handlers/register.d.ts.map +1 -1
  83. package/dist/cjs/server/auth/handlers/register.js +7 -9
  84. package/dist/cjs/server/auth/handlers/register.js.map +1 -1
  85. package/dist/cjs/server/auth/handlers/revoke.d.ts +4 -4
  86. package/dist/cjs/server/auth/handlers/revoke.d.ts.map +1 -1
  87. package/dist/cjs/server/auth/handlers/revoke.js +9 -9
  88. package/dist/cjs/server/auth/handlers/revoke.js.map +1 -1
  89. package/dist/cjs/server/auth/handlers/token.d.ts +3 -3
  90. package/dist/cjs/server/auth/handlers/token.d.ts.map +1 -1
  91. package/dist/cjs/server/auth/handlers/token.js +14 -14
  92. package/dist/cjs/server/auth/handlers/token.js.map +1 -1
  93. package/dist/cjs/server/auth/middleware/allowedMethods.d.ts +1 -1
  94. package/dist/cjs/server/auth/middleware/allowedMethods.d.ts.map +1 -1
  95. package/dist/cjs/server/auth/middleware/allowedMethods.js +1 -3
  96. package/dist/cjs/server/auth/middleware/allowedMethods.js.map +1 -1
  97. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts +4 -4
  98. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  99. package/dist/cjs/server/auth/middleware/bearerAuth.js +7 -7
  100. package/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
  101. package/dist/cjs/server/auth/middleware/clientAuth.d.ts +4 -4
  102. package/dist/cjs/server/auth/middleware/clientAuth.d.ts.map +1 -1
  103. package/dist/cjs/server/auth/middleware/clientAuth.js +6 -6
  104. package/dist/cjs/server/auth/middleware/clientAuth.js.map +1 -1
  105. package/dist/cjs/server/auth/provider.d.ts +4 -4
  106. package/dist/cjs/server/auth/provider.d.ts.map +1 -1
  107. package/dist/cjs/server/auth/providers/proxyProvider.d.ts +10 -10
  108. package/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -1
  109. package/dist/cjs/server/auth/providers/proxyProvider.js +34 -34
  110. package/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
  111. package/dist/cjs/server/auth/router.d.ts +11 -11
  112. package/dist/cjs/server/auth/router.d.ts.map +1 -1
  113. package/dist/cjs/server/auth/router.js +16 -18
  114. package/dist/cjs/server/auth/router.js.map +1 -1
  115. package/dist/cjs/server/auth/types.d.ts +1 -1
  116. package/dist/cjs/server/auth/types.d.ts.map +1 -1
  117. package/dist/cjs/server/completable.d.ts +5 -5
  118. package/dist/cjs/server/completable.d.ts.map +1 -1
  119. package/dist/cjs/server/completable.js +5 -5
  120. package/dist/cjs/server/completable.js.map +1 -1
  121. package/dist/cjs/server/index.d.ts +9 -9
  122. package/dist/cjs/server/index.d.ts.map +1 -1
  123. package/dist/cjs/server/index.js +38 -42
  124. package/dist/cjs/server/index.js.map +1 -1
  125. package/dist/cjs/server/mcp.d.ts +8 -8
  126. package/dist/cjs/server/mcp.d.ts.map +1 -1
  127. package/dist/cjs/server/mcp.js +87 -82
  128. package/dist/cjs/server/mcp.js.map +1 -1
  129. package/dist/cjs/server/sse.d.ts +4 -4
  130. package/dist/cjs/server/sse.d.ts.map +1 -1
  131. package/dist/cjs/server/sse.js +16 -15
  132. package/dist/cjs/server/sse.js.map +1 -1
  133. package/dist/cjs/server/stdio.d.ts +3 -3
  134. package/dist/cjs/server/stdio.d.ts.map +1 -1
  135. package/dist/cjs/server/stdio.js +7 -7
  136. package/dist/cjs/server/stdio.js.map +1 -1
  137. package/dist/cjs/server/streamableHttp.d.ts +5 -5
  138. package/dist/cjs/server/streamableHttp.d.ts.map +1 -1
  139. package/dist/cjs/server/streamableHttp.js +63 -64
  140. package/dist/cjs/server/streamableHttp.js.map +1 -1
  141. package/dist/cjs/shared/auth-utils.d.ts.map +1 -1
  142. package/dist/cjs/shared/auth-utils.js +3 -3
  143. package/dist/cjs/shared/auth-utils.js.map +1 -1
  144. package/dist/cjs/shared/auth.d.ts +1 -1
  145. package/dist/cjs/shared/auth.d.ts.map +1 -1
  146. package/dist/cjs/shared/auth.js +42 -46
  147. package/dist/cjs/shared/auth.js.map +1 -1
  148. package/dist/cjs/shared/metadataUtils.d.ts +1 -1
  149. package/dist/cjs/shared/metadataUtils.js.map +1 -1
  150. package/dist/cjs/shared/protocol.d.ts +6 -6
  151. package/dist/cjs/shared/protocol.d.ts.map +1 -1
  152. package/dist/cjs/shared/protocol.js +42 -43
  153. package/dist/cjs/shared/protocol.js.map +1 -1
  154. package/dist/cjs/shared/stdio.d.ts +1 -1
  155. package/dist/cjs/shared/stdio.d.ts.map +1 -1
  156. package/dist/cjs/shared/stdio.js +3 -3
  157. package/dist/cjs/shared/stdio.js.map +1 -1
  158. package/dist/cjs/shared/transport.d.ts +1 -1
  159. package/dist/cjs/shared/transport.d.ts.map +1 -1
  160. package/dist/cjs/shared/uriTemplate.d.ts.map +1 -1
  161. package/dist/cjs/shared/uriTemplate.js +69 -71
  162. package/dist/cjs/shared/uriTemplate.js.map +1 -1
  163. package/dist/cjs/types.d.ts +9650 -4790
  164. package/dist/cjs/types.d.ts.map +1 -1
  165. package/dist/cjs/types.js +199 -234
  166. package/dist/cjs/types.js.map +1 -1
  167. package/dist/esm/cli.js +45 -47
  168. package/dist/esm/cli.js.map +1 -1
  169. package/dist/esm/client/auth.d.ts +12 -12
  170. package/dist/esm/client/auth.d.ts.map +1 -1
  171. package/dist/esm/client/auth.js +82 -89
  172. package/dist/esm/client/auth.js.map +1 -1
  173. package/dist/esm/client/index.d.ts +186 -123
  174. package/dist/esm/client/index.d.ts.map +1 -1
  175. package/dist/esm/client/index.js +43 -44
  176. package/dist/esm/client/index.js.map +1 -1
  177. package/dist/esm/client/middleware.d.ts +2 -2
  178. package/dist/esm/client/middleware.d.ts.map +1 -1
  179. package/dist/esm/client/middleware.js +23 -28
  180. package/dist/esm/client/middleware.js.map +1 -1
  181. package/dist/esm/client/sse.d.ts +4 -4
  182. package/dist/esm/client/sse.d.ts.map +1 -1
  183. package/dist/esm/client/sse.js +37 -24
  184. package/dist/esm/client/sse.js.map +1 -1
  185. package/dist/esm/client/stdio.d.ts +4 -4
  186. package/dist/esm/client/stdio.d.ts.map +1 -1
  187. package/dist/esm/client/stdio.js +36 -36
  188. package/dist/esm/client/stdio.js.map +1 -1
  189. package/dist/esm/client/streamableHttp.d.ts +7 -6
  190. package/dist/esm/client/streamableHttp.d.ts.map +1 -1
  191. package/dist/esm/client/streamableHttp.js +58 -41
  192. package/dist/esm/client/streamableHttp.js.map +1 -1
  193. package/dist/esm/client/websocket.d.ts +2 -2
  194. package/dist/esm/client/websocket.d.ts.map +1 -1
  195. package/dist/esm/client/websocket.js +6 -8
  196. package/dist/esm/client/websocket.js.map +1 -1
  197. package/dist/esm/examples/client/multipleClientsParallel.js +3 -3
  198. package/dist/esm/examples/client/multipleClientsParallel.js.map +1 -1
  199. package/dist/esm/examples/client/parallelToolCallsClient.js +7 -6
  200. package/dist/esm/examples/client/parallelToolCallsClient.js.map +1 -1
  201. package/dist/esm/examples/client/simpleOAuthClient.js +15 -13
  202. package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -1
  203. package/dist/esm/examples/client/simpleStreamableHttp.js +17 -13
  204. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
  205. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.js +3 -3
  206. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.js.map +1 -1
  207. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +1 -1
  208. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  209. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js +19 -17
  210. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  211. package/dist/esm/examples/server/jsonResponseStreamableHttp.js +18 -18
  212. package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  213. package/dist/esm/examples/server/mcpServerOutputSchema.js +22 -20
  214. package/dist/esm/examples/server/mcpServerOutputSchema.js.map +1 -1
  215. package/dist/esm/examples/server/simpleSseServer.js +8 -8
  216. package/dist/esm/examples/server/simpleSseServer.js.map +1 -1
  217. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +22 -22
  218. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  219. package/dist/esm/examples/server/simpleStreamableHttp.js +78 -78
  220. package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  221. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +19 -19
  222. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  223. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +8 -8
  224. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  225. package/dist/esm/examples/server/toolWithSampleServer.js +22 -22
  226. package/dist/esm/examples/server/toolWithSampleServer.js.map +1 -1
  227. package/dist/esm/examples/shared/inMemoryEventStore.d.ts.map +1 -1
  228. package/dist/esm/examples/shared/inMemoryEventStore.js.map +1 -1
  229. package/dist/esm/inMemory.d.ts +3 -3
  230. package/dist/esm/inMemory.d.ts.map +1 -1
  231. package/dist/esm/inMemory.js +1 -1
  232. package/dist/esm/inMemory.js.map +1 -1
  233. package/dist/esm/server/auth/clients.d.ts +2 -2
  234. package/dist/esm/server/auth/clients.d.ts.map +1 -1
  235. package/dist/esm/server/auth/errors.d.ts +1 -1
  236. package/dist/esm/server/auth/errors.d.ts.map +1 -1
  237. package/dist/esm/server/auth/errors.js +17 -17
  238. package/dist/esm/server/auth/errors.js.map +1 -1
  239. package/dist/esm/server/auth/handlers/authorize.d.ts +3 -3
  240. package/dist/esm/server/auth/handlers/authorize.d.ts.map +1 -1
  241. package/dist/esm/server/auth/handlers/authorize.js +26 -23
  242. package/dist/esm/server/auth/handlers/authorize.js.map +1 -1
  243. package/dist/esm/server/auth/handlers/metadata.d.ts +2 -2
  244. package/dist/esm/server/auth/handlers/metadata.js +3 -3
  245. package/dist/esm/server/auth/handlers/metadata.js.map +1 -1
  246. package/dist/esm/server/auth/handlers/register.d.ts +4 -4
  247. package/dist/esm/server/auth/handlers/register.d.ts.map +1 -1
  248. package/dist/esm/server/auth/handlers/register.js +12 -14
  249. package/dist/esm/server/auth/handlers/register.js.map +1 -1
  250. package/dist/esm/server/auth/handlers/revoke.d.ts +4 -4
  251. package/dist/esm/server/auth/handlers/revoke.d.ts.map +1 -1
  252. package/dist/esm/server/auth/handlers/revoke.js +16 -16
  253. package/dist/esm/server/auth/handlers/revoke.js.map +1 -1
  254. package/dist/esm/server/auth/handlers/token.d.ts +3 -3
  255. package/dist/esm/server/auth/handlers/token.d.ts.map +1 -1
  256. package/dist/esm/server/auth/handlers/token.js +22 -22
  257. package/dist/esm/server/auth/handlers/token.js.map +1 -1
  258. package/dist/esm/server/auth/middleware/allowedMethods.d.ts +1 -1
  259. package/dist/esm/server/auth/middleware/allowedMethods.d.ts.map +1 -1
  260. package/dist/esm/server/auth/middleware/allowedMethods.js +2 -4
  261. package/dist/esm/server/auth/middleware/allowedMethods.js.map +1 -1
  262. package/dist/esm/server/auth/middleware/bearerAuth.d.ts +4 -4
  263. package/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  264. package/dist/esm/server/auth/middleware/bearerAuth.js +8 -8
  265. package/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  266. package/dist/esm/server/auth/middleware/clientAuth.d.ts +4 -4
  267. package/dist/esm/server/auth/middleware/clientAuth.d.ts.map +1 -1
  268. package/dist/esm/server/auth/middleware/clientAuth.js +8 -8
  269. package/dist/esm/server/auth/middleware/clientAuth.js.map +1 -1
  270. package/dist/esm/server/auth/provider.d.ts +4 -4
  271. package/dist/esm/server/auth/provider.d.ts.map +1 -1
  272. package/dist/esm/server/auth/providers/proxyProvider.d.ts +10 -10
  273. package/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -1
  274. package/dist/esm/server/auth/providers/proxyProvider.js +36 -36
  275. package/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
  276. package/dist/esm/server/auth/router.d.ts +11 -11
  277. package/dist/esm/server/auth/router.d.ts.map +1 -1
  278. package/dist/esm/server/auth/router.js +22 -24
  279. package/dist/esm/server/auth/router.js.map +1 -1
  280. package/dist/esm/server/auth/types.d.ts +1 -1
  281. package/dist/esm/server/auth/types.d.ts.map +1 -1
  282. package/dist/esm/server/completable.d.ts +5 -5
  283. package/dist/esm/server/completable.d.ts.map +1 -1
  284. package/dist/esm/server/completable.js +6 -6
  285. package/dist/esm/server/completable.js.map +1 -1
  286. package/dist/esm/server/index.d.ts +9 -9
  287. package/dist/esm/server/index.d.ts.map +1 -1
  288. package/dist/esm/server/index.js +41 -45
  289. package/dist/esm/server/index.js.map +1 -1
  290. package/dist/esm/server/mcp.d.ts +8 -8
  291. package/dist/esm/server/mcp.d.ts.map +1 -1
  292. package/dist/esm/server/mcp.js +93 -88
  293. package/dist/esm/server/mcp.js.map +1 -1
  294. package/dist/esm/server/sse.d.ts +4 -4
  295. package/dist/esm/server/sse.d.ts.map +1 -1
  296. package/dist/esm/server/sse.js +20 -19
  297. package/dist/esm/server/sse.js.map +1 -1
  298. package/dist/esm/server/stdio.d.ts +3 -3
  299. package/dist/esm/server/stdio.d.ts.map +1 -1
  300. package/dist/esm/server/stdio.js +9 -9
  301. package/dist/esm/server/stdio.js.map +1 -1
  302. package/dist/esm/server/streamableHttp.d.ts +5 -5
  303. package/dist/esm/server/streamableHttp.d.ts.map +1 -1
  304. package/dist/esm/server/streamableHttp.js +67 -68
  305. package/dist/esm/server/streamableHttp.js.map +1 -1
  306. package/dist/esm/shared/auth-utils.d.ts.map +1 -1
  307. package/dist/esm/shared/auth-utils.js +3 -3
  308. package/dist/esm/shared/auth-utils.js.map +1 -1
  309. package/dist/esm/shared/auth.d.ts +1 -1
  310. package/dist/esm/shared/auth.d.ts.map +1 -1
  311. package/dist/esm/shared/auth.js +43 -47
  312. package/dist/esm/shared/auth.js.map +1 -1
  313. package/dist/esm/shared/metadataUtils.d.ts +1 -1
  314. package/dist/esm/shared/metadataUtils.js.map +1 -1
  315. package/dist/esm/shared/protocol.d.ts +6 -6
  316. package/dist/esm/shared/protocol.d.ts.map +1 -1
  317. package/dist/esm/shared/protocol.js +43 -44
  318. package/dist/esm/shared/protocol.js.map +1 -1
  319. package/dist/esm/shared/stdio.d.ts +1 -1
  320. package/dist/esm/shared/stdio.d.ts.map +1 -1
  321. package/dist/esm/shared/stdio.js +4 -4
  322. package/dist/esm/shared/stdio.js.map +1 -1
  323. package/dist/esm/shared/transport.d.ts +1 -1
  324. package/dist/esm/shared/transport.d.ts.map +1 -1
  325. package/dist/esm/shared/uriTemplate.d.ts.map +1 -1
  326. package/dist/esm/shared/uriTemplate.js +69 -71
  327. package/dist/esm/shared/uriTemplate.js.map +1 -1
  328. package/dist/esm/types.d.ts +9650 -4790
  329. package/dist/esm/types.d.ts.map +1 -1
  330. package/dist/esm/types.js +197 -232
  331. package/dist/esm/types.js.map +1 -1
  332. package/package.json +100 -98
package/dist/esm/types.js CHANGED
@@ -1,14 +1,9 @@
1
- import { z } from "zod";
2
- export const LATEST_PROTOCOL_VERSION = "2025-06-18";
3
- export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
4
- export const SUPPORTED_PROTOCOL_VERSIONS = [
5
- LATEST_PROTOCOL_VERSION,
6
- "2025-03-26",
7
- "2024-11-05",
8
- "2024-10-07",
9
- ];
1
+ import { z } from 'zod';
2
+ export const LATEST_PROTOCOL_VERSION = '2025-06-18';
3
+ export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';
4
+ export const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-03-26', '2024-11-05', '2024-10-07'];
10
5
  /* JSON-RPC types */
11
- export const JSONRPC_VERSION = "2.0";
6
+ export const JSONRPC_VERSION = '2.0';
12
7
  /**
13
8
  * A progress token, used to associate progress notifications with the original request.
14
9
  */
@@ -22,17 +17,17 @@ const RequestMetaSchema = z
22
17
  /**
23
18
  * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
24
19
  */
25
- progressToken: z.optional(ProgressTokenSchema),
20
+ progressToken: z.optional(ProgressTokenSchema)
26
21
  })
27
22
  .passthrough();
28
23
  const BaseRequestParamsSchema = z
29
24
  .object({
30
- _meta: z.optional(RequestMetaSchema),
25
+ _meta: z.optional(RequestMetaSchema)
31
26
  })
32
27
  .passthrough();
33
28
  export const RequestSchema = z.object({
34
29
  method: z.string(),
35
- params: z.optional(BaseRequestParamsSchema),
30
+ params: z.optional(BaseRequestParamsSchema)
36
31
  });
37
32
  const BaseNotificationParamsSchema = z
38
33
  .object({
@@ -40,12 +35,12 @@ const BaseNotificationParamsSchema = z
40
35
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
41
36
  * for notes on _meta usage.
42
37
  */
43
- _meta: z.optional(z.object({}).passthrough()),
38
+ _meta: z.optional(z.object({}).passthrough())
44
39
  })
45
40
  .passthrough();
46
41
  export const NotificationSchema = z.object({
47
42
  method: z.string(),
48
- params: z.optional(BaseNotificationParamsSchema),
43
+ params: z.optional(BaseNotificationParamsSchema)
49
44
  });
50
45
  export const ResultSchema = z
51
46
  .object({
@@ -53,7 +48,7 @@ export const ResultSchema = z
53
48
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
54
49
  * for notes on _meta usage.
55
50
  */
56
- _meta: z.optional(z.object({}).passthrough()),
51
+ _meta: z.optional(z.object({}).passthrough())
57
52
  })
58
53
  .passthrough();
59
54
  /**
@@ -66,7 +61,7 @@ export const RequestIdSchema = z.union([z.string(), z.number().int()]);
66
61
  export const JSONRPCRequestSchema = z
67
62
  .object({
68
63
  jsonrpc: z.literal(JSONRPC_VERSION),
69
- id: RequestIdSchema,
64
+ id: RequestIdSchema
70
65
  })
71
66
  .merge(RequestSchema)
72
67
  .strict();
@@ -76,7 +71,7 @@ export const isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value)
76
71
  */
77
72
  export const JSONRPCNotificationSchema = z
78
73
  .object({
79
- jsonrpc: z.literal(JSONRPC_VERSION),
74
+ jsonrpc: z.literal(JSONRPC_VERSION)
80
75
  })
81
76
  .merge(NotificationSchema)
82
77
  .strict();
@@ -88,7 +83,7 @@ export const JSONRPCResponseSchema = z
88
83
  .object({
89
84
  jsonrpc: z.literal(JSONRPC_VERSION),
90
85
  id: RequestIdSchema,
91
- result: ResultSchema,
86
+ result: ResultSchema
92
87
  })
93
88
  .strict();
94
89
  export const isJSONRPCResponse = (value) => JSONRPCResponseSchema.safeParse(value).success;
@@ -126,17 +121,12 @@ export const JSONRPCErrorSchema = z
126
121
  /**
127
122
  * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
128
123
  */
129
- data: z.optional(z.unknown()),
130
- }),
124
+ data: z.optional(z.unknown())
125
+ })
131
126
  })
132
127
  .strict();
133
128
  export const isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
134
- export const JSONRPCMessageSchema = z.union([
135
- JSONRPCRequestSchema,
136
- JSONRPCNotificationSchema,
137
- JSONRPCResponseSchema,
138
- JSONRPCErrorSchema,
139
- ]);
129
+ export const JSONRPCMessageSchema = z.union([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]);
140
130
  /* Empty result */
141
131
  /**
142
132
  * A response that indicates success but carries no data.
@@ -153,7 +143,7 @@ export const EmptyResultSchema = ResultSchema.strict();
153
143
  * A client MUST NOT attempt to cancel its `initialize` request.
154
144
  */
155
145
  export const CancelledNotificationSchema = NotificationSchema.extend({
156
- method: z.literal("notifications/cancelled"),
146
+ method: z.literal('notifications/cancelled'),
157
147
  params: BaseNotificationParamsSchema.extend({
158
148
  /**
159
149
  * The ID of the request to cancel.
@@ -164,8 +154,8 @@ export const CancelledNotificationSchema = NotificationSchema.extend({
164
154
  /**
165
155
  * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
166
156
  */
167
- reason: z.string().optional(),
168
- }),
157
+ reason: z.string().optional()
158
+ })
169
159
  });
170
160
  /* Base Metadata */
171
161
  /**
@@ -182,9 +172,32 @@ export const IconSchema = z
182
172
  */
183
173
  mimeType: z.optional(z.string()),
184
174
  /**
185
- * Optional string specifying icon dimensions (e.g., "48x48 96x96").
175
+ * Optional array of strings that specify sizes at which the icon can be used.
176
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
177
+ *
178
+ * If not provided, the client should assume that the icon can be used at any size.
179
+ */
180
+ sizes: z.optional(z.array(z.string()))
181
+ })
182
+ .passthrough();
183
+ /**
184
+ * Base schema to add `icons` property.
185
+ *
186
+ */
187
+ export const IconsSchema = z
188
+ .object({
189
+ /**
190
+ * Optional set of sized icons that the client can display in a user interface.
191
+ *
192
+ * Clients that support rendering icons MUST support at least the following MIME types:
193
+ * - `image/png` - PNG images (safe, universal compatibility)
194
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
195
+ *
196
+ * Clients that support rendering icons SHOULD also support:
197
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
198
+ * - `image/webp` - WebP images (modern, efficient format)
186
199
  */
187
- sizes: z.optional(z.string()),
200
+ icons: z.array(IconSchema).optional()
188
201
  })
189
202
  .passthrough();
190
203
  /**
@@ -195,14 +208,14 @@ export const BaseMetadataSchema = z
195
208
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
196
209
  name: z.string(),
197
210
  /**
198
- * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
199
- * even by those unfamiliar with domain-specific terminology.
200
- *
201
- * If not provided, the name should be used for display (except for Tool,
202
- * where `annotations.title` should be given precedence over using `name`,
203
- * if present).
204
- */
205
- title: z.optional(z.string()),
211
+ * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
212
+ * even by those unfamiliar with domain-specific terminology.
213
+ *
214
+ * If not provided, the name should be used for display (except for Tool,
215
+ * where `annotations.title` should be given precedence over using `name`,
216
+ * if present).
217
+ */
218
+ title: z.optional(z.string())
206
219
  })
207
220
  .passthrough();
208
221
  /* Initialization */
@@ -214,17 +227,8 @@ export const ImplementationSchema = BaseMetadataSchema.extend({
214
227
  /**
215
228
  * An optional URL of the website for this implementation.
216
229
  */
217
- websiteUrl: z.optional(z.string()),
218
- /**
219
- * An optional list of icons for this implementation.
220
- * This can be used by clients to display the implementation in a user interface.
221
- * Each icon should have a `kind` property that specifies whether it is a data representation or a URL source, a `src` property that points to the icon file or data representation, and may also include a `mimeType` and `sizes` property.
222
- * The `mimeType` property should be a valid MIME type for the icon file, such as "image/png" or "image/svg+xml".
223
- * The `sizes` property should be a string that specifies one or more sizes at which the icon file can be used, such as "48x48" or "any" for scalable formats like SVG.
224
- * The `sizes` property is optional, and if not provided, the client should assume that the icon can be used at any size.
225
- */
226
- icons: z.optional(z.array(IconSchema)),
227
- });
230
+ websiteUrl: z.optional(z.string())
231
+ }).merge(IconsSchema);
228
232
  /**
229
233
  * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
230
234
  */
@@ -250,24 +254,24 @@ export const ClientCapabilitiesSchema = z
250
254
  /**
251
255
  * Whether the client supports issuing notifications for changes to the roots list.
252
256
  */
253
- listChanged: z.optional(z.boolean()),
257
+ listChanged: z.optional(z.boolean())
254
258
  })
255
- .passthrough()),
259
+ .passthrough())
256
260
  })
257
261
  .passthrough();
258
262
  /**
259
263
  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
260
264
  */
261
265
  export const InitializeRequestSchema = RequestSchema.extend({
262
- method: z.literal("initialize"),
266
+ method: z.literal('initialize'),
263
267
  params: BaseRequestParamsSchema.extend({
264
268
  /**
265
269
  * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
266
270
  */
267
271
  protocolVersion: z.string(),
268
272
  capabilities: ClientCapabilitiesSchema,
269
- clientInfo: ImplementationSchema,
270
- }),
273
+ clientInfo: ImplementationSchema
274
+ })
271
275
  });
272
276
  export const isInitializeRequest = (value) => InitializeRequestSchema.safeParse(value).success;
273
277
  /**
@@ -295,7 +299,7 @@ export const ServerCapabilitiesSchema = z
295
299
  /**
296
300
  * Whether this server supports issuing notifications for changes to the prompt list.
297
301
  */
298
- listChanged: z.optional(z.boolean()),
302
+ listChanged: z.optional(z.boolean())
299
303
  })
300
304
  .passthrough()),
301
305
  /**
@@ -310,7 +314,7 @@ export const ServerCapabilitiesSchema = z
310
314
  /**
311
315
  * Whether this server supports issuing notifications for changes to the resource list.
312
316
  */
313
- listChanged: z.optional(z.boolean()),
317
+ listChanged: z.optional(z.boolean())
314
318
  })
315
319
  .passthrough()),
316
320
  /**
@@ -321,9 +325,9 @@ export const ServerCapabilitiesSchema = z
321
325
  /**
322
326
  * Whether this server supports issuing notifications for changes to the tool list.
323
327
  */
324
- listChanged: z.optional(z.boolean()),
328
+ listChanged: z.optional(z.boolean())
325
329
  })
326
- .passthrough()),
330
+ .passthrough())
327
331
  })
328
332
  .passthrough();
329
333
  /**
@@ -341,13 +345,13 @@ export const InitializeResultSchema = ResultSchema.extend({
341
345
  *
342
346
  * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
343
347
  */
344
- instructions: z.optional(z.string()),
348
+ instructions: z.optional(z.string())
345
349
  });
346
350
  /**
347
351
  * This notification is sent from the client to the server after initialization has finished.
348
352
  */
349
353
  export const InitializedNotificationSchema = NotificationSchema.extend({
350
- method: z.literal("notifications/initialized"),
354
+ method: z.literal('notifications/initialized')
351
355
  });
352
356
  export const isInitializedNotification = (value) => InitializedNotificationSchema.safeParse(value).success;
353
357
  /* Ping */
@@ -355,7 +359,7 @@ export const isInitializedNotification = (value) => InitializedNotificationSchem
355
359
  * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
356
360
  */
357
361
  export const PingRequestSchema = RequestSchema.extend({
358
- method: z.literal("ping"),
362
+ method: z.literal('ping')
359
363
  });
360
364
  /* Progress notifications */
361
365
  export const ProgressSchema = z
@@ -371,20 +375,20 @@ export const ProgressSchema = z
371
375
  /**
372
376
  * An optional message describing the current progress.
373
377
  */
374
- message: z.optional(z.string()),
378
+ message: z.optional(z.string())
375
379
  })
376
380
  .passthrough();
377
381
  /**
378
382
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
379
383
  */
380
384
  export const ProgressNotificationSchema = NotificationSchema.extend({
381
- method: z.literal("notifications/progress"),
385
+ method: z.literal('notifications/progress'),
382
386
  params: BaseNotificationParamsSchema.merge(ProgressSchema).extend({
383
387
  /**
384
388
  * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
385
389
  */
386
- progressToken: ProgressTokenSchema,
387
- }),
390
+ progressToken: ProgressTokenSchema
391
+ })
388
392
  });
389
393
  /* Pagination */
390
394
  export const PaginatedRequestSchema = RequestSchema.extend({
@@ -393,15 +397,15 @@ export const PaginatedRequestSchema = RequestSchema.extend({
393
397
  * An opaque token representing the current pagination position.
394
398
  * If provided, the server should return results starting after this cursor.
395
399
  */
396
- cursor: z.optional(CursorSchema),
397
- }).optional(),
400
+ cursor: z.optional(CursorSchema)
401
+ }).optional()
398
402
  });
399
403
  export const PaginatedResultSchema = ResultSchema.extend({
400
404
  /**
401
405
  * An opaque token representing the pagination position after the last returned result.
402
406
  * If present, there may be more results available.
403
407
  */
404
- nextCursor: z.optional(CursorSchema),
408
+ nextCursor: z.optional(CursorSchema)
405
409
  });
406
410
  /* Resources */
407
411
  /**
@@ -421,21 +425,21 @@ export const ResourceContentsSchema = z
421
425
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
422
426
  * for notes on _meta usage.
423
427
  */
424
- _meta: z.optional(z.object({}).passthrough()),
428
+ _meta: z.optional(z.object({}).passthrough())
425
429
  })
426
430
  .passthrough();
427
431
  export const TextResourceContentsSchema = ResourceContentsSchema.extend({
428
432
  /**
429
433
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
430
434
  */
431
- text: z.string(),
435
+ text: z.string()
432
436
  });
433
437
  /**
434
438
  * A Zod schema for validating Base64 strings that is more performant and
435
439
  * robust for very large inputs than the default regex-based check. It avoids
436
440
  * stack overflows by using the native `atob` function for validation.
437
441
  */
438
- const Base64Schema = z.string().refine((val) => {
442
+ const Base64Schema = z.string().refine(val => {
439
443
  try {
440
444
  // atob throws a DOMException if the string contains characters
441
445
  // that are not part of the Base64 character set.
@@ -445,12 +449,12 @@ const Base64Schema = z.string().refine((val) => {
445
449
  catch (_a) {
446
450
  return false;
447
451
  }
448
- }, { message: "Invalid Base64 string" });
452
+ }, { message: 'Invalid Base64 string' });
449
453
  export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
450
454
  /**
451
455
  * A base64-encoded string representing the binary data of the item.
452
456
  */
453
- blob: Base64Schema,
457
+ blob: Base64Schema
454
458
  });
455
459
  /**
456
460
  * A known resource that the server is capable of reading.
@@ -470,16 +474,12 @@ export const ResourceSchema = BaseMetadataSchema.extend({
470
474
  * The MIME type of this resource, if known.
471
475
  */
472
476
  mimeType: z.optional(z.string()),
473
- /**
474
- * An optional list of icons for this resource.
475
- */
476
- icons: z.optional(z.array(IconSchema)),
477
477
  /**
478
478
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
479
479
  * for notes on _meta usage.
480
480
  */
481
- _meta: z.optional(z.object({}).passthrough()),
482
- });
481
+ _meta: z.optional(z.object({}).passthrough())
482
+ }).merge(IconsSchema);
483
483
  /**
484
484
  * A template description for resources available on the server.
485
485
  */
@@ -502,91 +502,91 @@ export const ResourceTemplateSchema = BaseMetadataSchema.extend({
502
502
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
503
503
  * for notes on _meta usage.
504
504
  */
505
- _meta: z.optional(z.object({}).passthrough()),
506
- });
505
+ _meta: z.optional(z.object({}).passthrough())
506
+ }).merge(IconsSchema);
507
507
  /**
508
508
  * Sent from the client to request a list of resources the server has.
509
509
  */
510
510
  export const ListResourcesRequestSchema = PaginatedRequestSchema.extend({
511
- method: z.literal("resources/list"),
511
+ method: z.literal('resources/list')
512
512
  });
513
513
  /**
514
514
  * The server's response to a resources/list request from the client.
515
515
  */
516
516
  export const ListResourcesResultSchema = PaginatedResultSchema.extend({
517
- resources: z.array(ResourceSchema),
517
+ resources: z.array(ResourceSchema)
518
518
  });
519
519
  /**
520
520
  * Sent from the client to request a list of resource templates the server has.
521
521
  */
522
522
  export const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({
523
- method: z.literal("resources/templates/list"),
523
+ method: z.literal('resources/templates/list')
524
524
  });
525
525
  /**
526
526
  * The server's response to a resources/templates/list request from the client.
527
527
  */
528
528
  export const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
529
- resourceTemplates: z.array(ResourceTemplateSchema),
529
+ resourceTemplates: z.array(ResourceTemplateSchema)
530
530
  });
531
531
  /**
532
532
  * Sent from the client to the server, to read a specific resource URI.
533
533
  */
534
534
  export const ReadResourceRequestSchema = RequestSchema.extend({
535
- method: z.literal("resources/read"),
535
+ method: z.literal('resources/read'),
536
536
  params: BaseRequestParamsSchema.extend({
537
537
  /**
538
538
  * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
539
539
  */
540
- uri: z.string(),
541
- }),
540
+ uri: z.string()
541
+ })
542
542
  });
543
543
  /**
544
544
  * The server's response to a resources/read request from the client.
545
545
  */
546
546
  export const ReadResourceResultSchema = ResultSchema.extend({
547
- contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema])),
547
+ contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema]))
548
548
  });
549
549
  /**
550
550
  * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
551
551
  */
552
552
  export const ResourceListChangedNotificationSchema = NotificationSchema.extend({
553
- method: z.literal("notifications/resources/list_changed"),
553
+ method: z.literal('notifications/resources/list_changed')
554
554
  });
555
555
  /**
556
556
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
557
557
  */
558
558
  export const SubscribeRequestSchema = RequestSchema.extend({
559
- method: z.literal("resources/subscribe"),
559
+ method: z.literal('resources/subscribe'),
560
560
  params: BaseRequestParamsSchema.extend({
561
561
  /**
562
562
  * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
563
563
  */
564
- uri: z.string(),
565
- }),
564
+ uri: z.string()
565
+ })
566
566
  });
567
567
  /**
568
568
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
569
569
  */
570
570
  export const UnsubscribeRequestSchema = RequestSchema.extend({
571
- method: z.literal("resources/unsubscribe"),
571
+ method: z.literal('resources/unsubscribe'),
572
572
  params: BaseRequestParamsSchema.extend({
573
573
  /**
574
574
  * The URI of the resource to unsubscribe from.
575
575
  */
576
- uri: z.string(),
577
- }),
576
+ uri: z.string()
577
+ })
578
578
  });
579
579
  /**
580
580
  * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
581
581
  */
582
582
  export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
583
- method: z.literal("notifications/resources/updated"),
583
+ method: z.literal('notifications/resources/updated'),
584
584
  params: BaseNotificationParamsSchema.extend({
585
585
  /**
586
586
  * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
587
587
  */
588
- uri: z.string(),
589
- }),
588
+ uri: z.string()
589
+ })
590
590
  });
591
591
  /* Prompts */
592
592
  /**
@@ -605,7 +605,7 @@ export const PromptArgumentSchema = z
605
605
  /**
606
606
  * Whether this argument must be provided.
607
607
  */
608
- required: z.optional(z.boolean()),
608
+ required: z.optional(z.boolean())
609
609
  })
610
610
  .passthrough();
611
611
  /**
@@ -620,33 +620,29 @@ export const PromptSchema = BaseMetadataSchema.extend({
620
620
  * A list of arguments to use for templating the prompt.
621
621
  */
622
622
  arguments: z.optional(z.array(PromptArgumentSchema)),
623
- /**
624
- * An optional list of icons for this prompt.
625
- */
626
- icons: z.optional(z.array(IconSchema)),
627
623
  /**
628
624
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
629
625
  * for notes on _meta usage.
630
626
  */
631
- _meta: z.optional(z.object({}).passthrough()),
632
- });
627
+ _meta: z.optional(z.object({}).passthrough())
628
+ }).merge(IconsSchema);
633
629
  /**
634
630
  * Sent from the client to request a list of prompts and prompt templates the server has.
635
631
  */
636
632
  export const ListPromptsRequestSchema = PaginatedRequestSchema.extend({
637
- method: z.literal("prompts/list"),
633
+ method: z.literal('prompts/list')
638
634
  });
639
635
  /**
640
636
  * The server's response to a prompts/list request from the client.
641
637
  */
642
638
  export const ListPromptsResultSchema = PaginatedResultSchema.extend({
643
- prompts: z.array(PromptSchema),
639
+ prompts: z.array(PromptSchema)
644
640
  });
645
641
  /**
646
642
  * Used by the client to get a prompt provided by the server.
647
643
  */
648
644
  export const GetPromptRequestSchema = RequestSchema.extend({
649
- method: z.literal("prompts/get"),
645
+ method: z.literal('prompts/get'),
650
646
  params: BaseRequestParamsSchema.extend({
651
647
  /**
652
648
  * The name of the prompt or prompt template.
@@ -655,15 +651,15 @@ export const GetPromptRequestSchema = RequestSchema.extend({
655
651
  /**
656
652
  * Arguments to use for templating the prompt.
657
653
  */
658
- arguments: z.optional(z.record(z.string())),
659
- }),
654
+ arguments: z.optional(z.record(z.string()))
655
+ })
660
656
  });
661
657
  /**
662
658
  * Text provided to or from an LLM.
663
659
  */
664
660
  export const TextContentSchema = z
665
661
  .object({
666
- type: z.literal("text"),
662
+ type: z.literal('text'),
667
663
  /**
668
664
  * The text content of the message.
669
665
  */
@@ -672,7 +668,7 @@ export const TextContentSchema = z
672
668
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
673
669
  * for notes on _meta usage.
674
670
  */
675
- _meta: z.optional(z.object({}).passthrough()),
671
+ _meta: z.optional(z.object({}).passthrough())
676
672
  })
677
673
  .passthrough();
678
674
  /**
@@ -680,7 +676,7 @@ export const TextContentSchema = z
680
676
  */
681
677
  export const ImageContentSchema = z
682
678
  .object({
683
- type: z.literal("image"),
679
+ type: z.literal('image'),
684
680
  /**
685
681
  * The base64-encoded image data.
686
682
  */
@@ -693,7 +689,7 @@ export const ImageContentSchema = z
693
689
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
694
690
  * for notes on _meta usage.
695
691
  */
696
- _meta: z.optional(z.object({}).passthrough()),
692
+ _meta: z.optional(z.object({}).passthrough())
697
693
  })
698
694
  .passthrough();
699
695
  /**
@@ -701,7 +697,7 @@ export const ImageContentSchema = z
701
697
  */
702
698
  export const AudioContentSchema = z
703
699
  .object({
704
- type: z.literal("audio"),
700
+ type: z.literal('audio'),
705
701
  /**
706
702
  * The base64-encoded audio data.
707
703
  */
@@ -714,7 +710,7 @@ export const AudioContentSchema = z
714
710
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
715
711
  * for notes on _meta usage.
716
712
  */
717
- _meta: z.optional(z.object({}).passthrough()),
713
+ _meta: z.optional(z.object({}).passthrough())
718
714
  })
719
715
  .passthrough();
720
716
  /**
@@ -722,13 +718,13 @@ export const AudioContentSchema = z
722
718
  */
723
719
  export const EmbeddedResourceSchema = z
724
720
  .object({
725
- type: z.literal("resource"),
721
+ type: z.literal('resource'),
726
722
  resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
727
723
  /**
728
724
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
729
725
  * for notes on _meta usage.
730
726
  */
731
- _meta: z.optional(z.object({}).passthrough()),
727
+ _meta: z.optional(z.object({}).passthrough())
732
728
  })
733
729
  .passthrough();
734
730
  /**
@@ -737,7 +733,7 @@ export const EmbeddedResourceSchema = z
737
733
  * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
738
734
  */
739
735
  export const ResourceLinkSchema = ResourceSchema.extend({
740
- type: z.literal("resource_link"),
736
+ type: z.literal('resource_link')
741
737
  });
742
738
  /**
743
739
  * A content block that can be used in prompts and tool results.
@@ -747,15 +743,15 @@ export const ContentBlockSchema = z.union([
747
743
  ImageContentSchema,
748
744
  AudioContentSchema,
749
745
  ResourceLinkSchema,
750
- EmbeddedResourceSchema,
746
+ EmbeddedResourceSchema
751
747
  ]);
752
748
  /**
753
749
  * Describes a message returned as part of a prompt.
754
750
  */
755
751
  export const PromptMessageSchema = z
756
752
  .object({
757
- role: z.enum(["user", "assistant"]),
758
- content: ContentBlockSchema,
753
+ role: z.enum(['user', 'assistant']),
754
+ content: ContentBlockSchema
759
755
  })
760
756
  .passthrough();
761
757
  /**
@@ -766,13 +762,13 @@ export const GetPromptResultSchema = ResultSchema.extend({
766
762
  * An optional description for the prompt.
767
763
  */
768
764
  description: z.optional(z.string()),
769
- messages: z.array(PromptMessageSchema),
765
+ messages: z.array(PromptMessageSchema)
770
766
  });
771
767
  /**
772
768
  * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
773
769
  */
774
770
  export const PromptListChangedNotificationSchema = NotificationSchema.extend({
775
- method: z.literal("notifications/prompts/list_changed"),
771
+ method: z.literal('notifications/prompts/list_changed')
776
772
  });
777
773
  /* Tools */
778
774
  /**
@@ -823,7 +819,7 @@ export const ToolAnnotationsSchema = z
823
819
  *
824
820
  * Default: true
825
821
  */
826
- openWorldHint: z.optional(z.boolean()),
822
+ openWorldHint: z.optional(z.boolean())
827
823
  })
828
824
  .passthrough();
829
825
  /**
@@ -839,46 +835,43 @@ export const ToolSchema = BaseMetadataSchema.extend({
839
835
  */
840
836
  inputSchema: z
841
837
  .object({
842
- type: z.literal("object"),
838
+ type: z.literal('object'),
843
839
  properties: z.optional(z.object({}).passthrough()),
844
- required: z.optional(z.array(z.string())),
840
+ required: z.optional(z.array(z.string()))
845
841
  })
846
842
  .passthrough(),
847
843
  /**
848
844
  * An optional JSON Schema object defining the structure of the tool's output returned in
849
845
  * the structuredContent field of a CallToolResult.
850
846
  */
851
- outputSchema: z.optional(z.object({
852
- type: z.literal("object"),
847
+ outputSchema: z.optional(z
848
+ .object({
849
+ type: z.literal('object'),
853
850
  properties: z.optional(z.object({}).passthrough()),
854
- required: z.optional(z.array(z.string())),
851
+ required: z.optional(z.array(z.string()))
855
852
  })
856
853
  .passthrough()),
857
854
  /**
858
855
  * Optional additional tool information.
859
856
  */
860
857
  annotations: z.optional(ToolAnnotationsSchema),
861
- /**
862
- * An optional list of icons for this tool.
863
- */
864
- icons: z.optional(z.array(IconSchema)),
865
858
  /**
866
859
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
867
860
  * for notes on _meta usage.
868
861
  */
869
- _meta: z.optional(z.object({}).passthrough()),
870
- });
862
+ _meta: z.optional(z.object({}).passthrough())
863
+ }).merge(IconsSchema);
871
864
  /**
872
865
  * Sent from the client to request a list of tools the server has.
873
866
  */
874
867
  export const ListToolsRequestSchema = PaginatedRequestSchema.extend({
875
- method: z.literal("tools/list"),
868
+ method: z.literal('tools/list')
876
869
  });
877
870
  /**
878
871
  * The server's response to a tools/list request from the client.
879
872
  */
880
873
  export const ListToolsResultSchema = PaginatedResultSchema.extend({
881
- tools: z.array(ToolSchema),
874
+ tools: z.array(ToolSchema)
882
875
  });
883
876
  /**
884
877
  * The server's response to a tool call.
@@ -911,61 +904,52 @@ export const CallToolResultSchema = ResultSchema.extend({
911
904
  * server does not support tool calls, or any other exceptional conditions,
912
905
  * should be reported as an MCP error response.
913
906
  */
914
- isError: z.optional(z.boolean()),
907
+ isError: z.optional(z.boolean())
915
908
  });
916
909
  /**
917
910
  * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
918
911
  */
919
912
  export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
920
- toolResult: z.unknown(),
913
+ toolResult: z.unknown()
921
914
  }));
922
915
  /**
923
916
  * Used by the client to invoke a tool provided by the server.
924
917
  */
925
918
  export const CallToolRequestSchema = RequestSchema.extend({
926
- method: z.literal("tools/call"),
919
+ method: z.literal('tools/call'),
927
920
  params: BaseRequestParamsSchema.extend({
928
921
  name: z.string(),
929
- arguments: z.optional(z.record(z.unknown())),
930
- }),
922
+ arguments: z.optional(z.record(z.unknown()))
923
+ })
931
924
  });
932
925
  /**
933
926
  * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
934
927
  */
935
928
  export const ToolListChangedNotificationSchema = NotificationSchema.extend({
936
- method: z.literal("notifications/tools/list_changed"),
929
+ method: z.literal('notifications/tools/list_changed')
937
930
  });
938
931
  /* Logging */
939
932
  /**
940
933
  * The severity of a log message.
941
934
  */
942
- export const LoggingLevelSchema = z.enum([
943
- "debug",
944
- "info",
945
- "notice",
946
- "warning",
947
- "error",
948
- "critical",
949
- "alert",
950
- "emergency",
951
- ]);
935
+ export const LoggingLevelSchema = z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']);
952
936
  /**
953
937
  * A request from the client to the server, to enable or adjust logging.
954
938
  */
955
939
  export const SetLevelRequestSchema = RequestSchema.extend({
956
- method: z.literal("logging/setLevel"),
940
+ method: z.literal('logging/setLevel'),
957
941
  params: BaseRequestParamsSchema.extend({
958
942
  /**
959
943
  * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
960
944
  */
961
- level: LoggingLevelSchema,
962
- }),
945
+ level: LoggingLevelSchema
946
+ })
963
947
  });
964
948
  /**
965
949
  * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
966
950
  */
967
951
  export const LoggingMessageNotificationSchema = NotificationSchema.extend({
968
- method: z.literal("notifications/message"),
952
+ method: z.literal('notifications/message'),
969
953
  params: BaseNotificationParamsSchema.extend({
970
954
  /**
971
955
  * The severity of this log message.
@@ -978,8 +962,8 @@ export const LoggingMessageNotificationSchema = NotificationSchema.extend({
978
962
  /**
979
963
  * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
980
964
  */
981
- data: z.unknown(),
982
- }),
965
+ data: z.unknown()
966
+ })
983
967
  });
984
968
  /* Sampling */
985
969
  /**
@@ -990,7 +974,7 @@ export const ModelHintSchema = z
990
974
  /**
991
975
  * A hint for a model name.
992
976
  */
993
- name: z.string().optional(),
977
+ name: z.string().optional()
994
978
  })
995
979
  .passthrough();
996
980
  /**
@@ -1013,7 +997,7 @@ export const ModelPreferencesSchema = z
1013
997
  /**
1014
998
  * How much to prioritize intelligence and capabilities when selecting a model.
1015
999
  */
1016
- intelligencePriority: z.optional(z.number().min(0).max(1)),
1000
+ intelligencePriority: z.optional(z.number().min(0).max(1))
1017
1001
  })
1018
1002
  .passthrough();
1019
1003
  /**
@@ -1021,15 +1005,15 @@ export const ModelPreferencesSchema = z
1021
1005
  */
1022
1006
  export const SamplingMessageSchema = z
1023
1007
  .object({
1024
- role: z.enum(["user", "assistant"]),
1025
- content: z.union([TextContentSchema, ImageContentSchema, AudioContentSchema]),
1008
+ role: z.enum(['user', 'assistant']),
1009
+ content: z.union([TextContentSchema, ImageContentSchema, AudioContentSchema])
1026
1010
  })
1027
1011
  .passthrough();
1028
1012
  /**
1029
1013
  * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
1030
1014
  */
1031
1015
  export const CreateMessageRequestSchema = RequestSchema.extend({
1032
- method: z.literal("sampling/createMessage"),
1016
+ method: z.literal('sampling/createMessage'),
1033
1017
  params: BaseRequestParamsSchema.extend({
1034
1018
  messages: z.array(SamplingMessageSchema),
1035
1019
  /**
@@ -1039,7 +1023,7 @@ export const CreateMessageRequestSchema = RequestSchema.extend({
1039
1023
  /**
1040
1024
  * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
1041
1025
  */
1042
- includeContext: z.optional(z.enum(["none", "thisServer", "allServers"])),
1026
+ includeContext: z.optional(z.enum(['none', 'thisServer', 'allServers'])),
1043
1027
  temperature: z.optional(z.number()),
1044
1028
  /**
1045
1029
  * The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
@@ -1053,8 +1037,8 @@ export const CreateMessageRequestSchema = RequestSchema.extend({
1053
1037
  /**
1054
1038
  * The server's preferences for which model to select.
1055
1039
  */
1056
- modelPreferences: z.optional(ModelPreferencesSchema),
1057
- }),
1040
+ modelPreferences: z.optional(ModelPreferencesSchema)
1041
+ })
1058
1042
  });
1059
1043
  /**
1060
1044
  * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
@@ -1067,13 +1051,9 @@ export const CreateMessageResultSchema = ResultSchema.extend({
1067
1051
  /**
1068
1052
  * The reason why sampling stopped.
1069
1053
  */
1070
- stopReason: z.optional(z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string())),
1071
- role: z.enum(["user", "assistant"]),
1072
- content: z.discriminatedUnion("type", [
1073
- TextContentSchema,
1074
- ImageContentSchema,
1075
- AudioContentSchema
1076
- ]),
1054
+ stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())),
1055
+ role: z.enum(['user', 'assistant']),
1056
+ content: z.discriminatedUnion('type', [TextContentSchema, ImageContentSchema, AudioContentSchema])
1077
1057
  });
1078
1058
  /* Elicitation */
1079
1059
  /**
@@ -1081,10 +1061,10 @@ export const CreateMessageResultSchema = ResultSchema.extend({
1081
1061
  */
1082
1062
  export const BooleanSchemaSchema = z
1083
1063
  .object({
1084
- type: z.literal("boolean"),
1064
+ type: z.literal('boolean'),
1085
1065
  title: z.optional(z.string()),
1086
1066
  description: z.optional(z.string()),
1087
- default: z.optional(z.boolean()),
1067
+ default: z.optional(z.boolean())
1088
1068
  })
1089
1069
  .passthrough();
1090
1070
  /**
@@ -1092,12 +1072,12 @@ export const BooleanSchemaSchema = z
1092
1072
  */
1093
1073
  export const StringSchemaSchema = z
1094
1074
  .object({
1095
- type: z.literal("string"),
1075
+ type: z.literal('string'),
1096
1076
  title: z.optional(z.string()),
1097
1077
  description: z.optional(z.string()),
1098
1078
  minLength: z.optional(z.number()),
1099
1079
  maxLength: z.optional(z.number()),
1100
- format: z.optional(z.enum(["email", "uri", "date", "date-time"])),
1080
+ format: z.optional(z.enum(['email', 'uri', 'date', 'date-time']))
1101
1081
  })
1102
1082
  .passthrough();
1103
1083
  /**
@@ -1105,11 +1085,11 @@ export const StringSchemaSchema = z
1105
1085
  */
1106
1086
  export const NumberSchemaSchema = z
1107
1087
  .object({
1108
- type: z.enum(["number", "integer"]),
1088
+ type: z.enum(['number', 'integer']),
1109
1089
  title: z.optional(z.string()),
1110
1090
  description: z.optional(z.string()),
1111
1091
  minimum: z.optional(z.number()),
1112
- maximum: z.optional(z.number()),
1092
+ maximum: z.optional(z.number())
1113
1093
  })
1114
1094
  .passthrough();
1115
1095
  /**
@@ -1117,28 +1097,23 @@ export const NumberSchemaSchema = z
1117
1097
  */
1118
1098
  export const EnumSchemaSchema = z
1119
1099
  .object({
1120
- type: z.literal("string"),
1100
+ type: z.literal('string'),
1121
1101
  title: z.optional(z.string()),
1122
1102
  description: z.optional(z.string()),
1123
1103
  enum: z.array(z.string()),
1124
- enumNames: z.optional(z.array(z.string())),
1104
+ enumNames: z.optional(z.array(z.string()))
1125
1105
  })
1126
1106
  .passthrough();
1127
1107
  /**
1128
1108
  * Union of all primitive schema definitions.
1129
1109
  */
1130
- export const PrimitiveSchemaDefinitionSchema = z.union([
1131
- BooleanSchemaSchema,
1132
- StringSchemaSchema,
1133
- NumberSchemaSchema,
1134
- EnumSchemaSchema,
1135
- ]);
1110
+ export const PrimitiveSchemaDefinitionSchema = z.union([BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema]);
1136
1111
  /**
1137
1112
  * A request from the server to elicit user input via the client.
1138
1113
  * The client should present the message and form fields to the user.
1139
1114
  */
1140
1115
  export const ElicitRequestSchema = RequestSchema.extend({
1141
- method: z.literal("elicitation/create"),
1116
+ method: z.literal('elicitation/create'),
1142
1117
  params: BaseRequestParamsSchema.extend({
1143
1118
  /**
1144
1119
  * The message to present to the user.
@@ -1149,12 +1124,12 @@ export const ElicitRequestSchema = RequestSchema.extend({
1149
1124
  */
1150
1125
  requestedSchema: z
1151
1126
  .object({
1152
- type: z.literal("object"),
1127
+ type: z.literal('object'),
1153
1128
  properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
1154
- required: z.optional(z.array(z.string())),
1129
+ required: z.optional(z.array(z.string()))
1155
1130
  })
1156
- .passthrough(),
1157
- }),
1131
+ .passthrough()
1132
+ })
1158
1133
  });
1159
1134
  /**
1160
1135
  * The client's response to an elicitation/create request from the server.
@@ -1163,11 +1138,11 @@ export const ElicitResultSchema = ResultSchema.extend({
1163
1138
  /**
1164
1139
  * The user's response action.
1165
1140
  */
1166
- action: z.enum(["accept", "decline", "cancel"]),
1141
+ action: z.enum(['accept', 'decline', 'cancel']),
1167
1142
  /**
1168
1143
  * The collected user input content (only present if action is "accept").
1169
1144
  */
1170
- content: z.optional(z.record(z.string(), z.unknown())),
1145
+ content: z.optional(z.record(z.string(), z.unknown()))
1171
1146
  });
1172
1147
  /* Autocomplete */
1173
1148
  /**
@@ -1175,11 +1150,11 @@ export const ElicitResultSchema = ResultSchema.extend({
1175
1150
  */
1176
1151
  export const ResourceTemplateReferenceSchema = z
1177
1152
  .object({
1178
- type: z.literal("ref/resource"),
1153
+ type: z.literal('ref/resource'),
1179
1154
  /**
1180
1155
  * The URI or URI template of the resource.
1181
1156
  */
1182
- uri: z.string(),
1157
+ uri: z.string()
1183
1158
  })
1184
1159
  .passthrough();
1185
1160
  /**
@@ -1191,18 +1166,18 @@ export const ResourceReferenceSchema = ResourceTemplateReferenceSchema;
1191
1166
  */
1192
1167
  export const PromptReferenceSchema = z
1193
1168
  .object({
1194
- type: z.literal("ref/prompt"),
1169
+ type: z.literal('ref/prompt'),
1195
1170
  /**
1196
1171
  * The name of the prompt or prompt template
1197
1172
  */
1198
- name: z.string(),
1173
+ name: z.string()
1199
1174
  })
1200
1175
  .passthrough();
1201
1176
  /**
1202
1177
  * A request from the client to the server, to ask for completion options.
1203
1178
  */
1204
1179
  export const CompleteRequestSchema = RequestSchema.extend({
1205
- method: z.literal("completion/complete"),
1180
+ method: z.literal('completion/complete'),
1206
1181
  params: BaseRequestParamsSchema.extend({
1207
1182
  ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
1208
1183
  /**
@@ -1217,16 +1192,16 @@ export const CompleteRequestSchema = RequestSchema.extend({
1217
1192
  /**
1218
1193
  * The value of the argument to use for completion matching.
1219
1194
  */
1220
- value: z.string(),
1195
+ value: z.string()
1221
1196
  })
1222
1197
  .passthrough(),
1223
1198
  context: z.optional(z.object({
1224
1199
  /**
1225
1200
  * Previously-resolved variables in a URI template or prompt.
1226
1201
  */
1227
- arguments: z.optional(z.record(z.string(), z.string())),
1228
- })),
1229
- }),
1202
+ arguments: z.optional(z.record(z.string(), z.string()))
1203
+ }))
1204
+ })
1230
1205
  });
1231
1206
  /**
1232
1207
  * The server's response to a completion/complete request
@@ -1245,9 +1220,9 @@ export const CompleteResultSchema = ResultSchema.extend({
1245
1220
  /**
1246
1221
  * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
1247
1222
  */
1248
- hasMore: z.optional(z.boolean()),
1223
+ hasMore: z.optional(z.boolean())
1249
1224
  })
1250
- .passthrough(),
1225
+ .passthrough()
1251
1226
  });
1252
1227
  /* Roots */
1253
1228
  /**
@@ -1258,7 +1233,7 @@ export const RootSchema = z
1258
1233
  /**
1259
1234
  * The URI identifying the root. This *must* start with file:// for now.
1260
1235
  */
1261
- uri: z.string().startsWith("file://"),
1236
+ uri: z.string().startsWith('file://'),
1262
1237
  /**
1263
1238
  * An optional name for the root.
1264
1239
  */
@@ -1267,26 +1242,26 @@ export const RootSchema = z
1267
1242
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
1268
1243
  * for notes on _meta usage.
1269
1244
  */
1270
- _meta: z.optional(z.object({}).passthrough()),
1245
+ _meta: z.optional(z.object({}).passthrough())
1271
1246
  })
1272
1247
  .passthrough();
1273
1248
  /**
1274
1249
  * Sent from the server to request a list of root URIs from the client.
1275
1250
  */
1276
1251
  export const ListRootsRequestSchema = RequestSchema.extend({
1277
- method: z.literal("roots/list"),
1252
+ method: z.literal('roots/list')
1278
1253
  });
1279
1254
  /**
1280
1255
  * The client's response to a roots/list request from the server.
1281
1256
  */
1282
1257
  export const ListRootsResultSchema = ResultSchema.extend({
1283
- roots: z.array(RootSchema),
1258
+ roots: z.array(RootSchema)
1284
1259
  });
1285
1260
  /**
1286
1261
  * A notification from the client to the server, informing it that the list of roots has changed.
1287
1262
  */
1288
1263
  export const RootsListChangedNotificationSchema = NotificationSchema.extend({
1289
- method: z.literal("notifications/roots/list_changed"),
1264
+ method: z.literal('notifications/roots/list_changed')
1290
1265
  });
1291
1266
  /* Client messages */
1292
1267
  export const ClientRequestSchema = z.union([
@@ -1302,27 +1277,17 @@ export const ClientRequestSchema = z.union([
1302
1277
  SubscribeRequestSchema,
1303
1278
  UnsubscribeRequestSchema,
1304
1279
  CallToolRequestSchema,
1305
- ListToolsRequestSchema,
1280
+ ListToolsRequestSchema
1306
1281
  ]);
1307
1282
  export const ClientNotificationSchema = z.union([
1308
1283
  CancelledNotificationSchema,
1309
1284
  ProgressNotificationSchema,
1310
1285
  InitializedNotificationSchema,
1311
- RootsListChangedNotificationSchema,
1312
- ]);
1313
- export const ClientResultSchema = z.union([
1314
- EmptyResultSchema,
1315
- CreateMessageResultSchema,
1316
- ElicitResultSchema,
1317
- ListRootsResultSchema,
1286
+ RootsListChangedNotificationSchema
1318
1287
  ]);
1288
+ export const ClientResultSchema = z.union([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
1319
1289
  /* Server messages */
1320
- export const ServerRequestSchema = z.union([
1321
- PingRequestSchema,
1322
- CreateMessageRequestSchema,
1323
- ElicitRequestSchema,
1324
- ListRootsRequestSchema,
1325
- ]);
1290
+ export const ServerRequestSchema = z.union([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
1326
1291
  export const ServerNotificationSchema = z.union([
1327
1292
  CancelledNotificationSchema,
1328
1293
  ProgressNotificationSchema,
@@ -1330,7 +1295,7 @@ export const ServerNotificationSchema = z.union([
1330
1295
  ResourceUpdatedNotificationSchema,
1331
1296
  ResourceListChangedNotificationSchema,
1332
1297
  ToolListChangedNotificationSchema,
1333
- PromptListChangedNotificationSchema,
1298
+ PromptListChangedNotificationSchema
1334
1299
  ]);
1335
1300
  export const ServerResultSchema = z.union([
1336
1301
  EmptyResultSchema,
@@ -1342,14 +1307,14 @@ export const ServerResultSchema = z.union([
1342
1307
  ListResourceTemplatesResultSchema,
1343
1308
  ReadResourceResultSchema,
1344
1309
  CallToolResultSchema,
1345
- ListToolsResultSchema,
1310
+ ListToolsResultSchema
1346
1311
  ]);
1347
1312
  export class McpError extends Error {
1348
1313
  constructor(code, message, data) {
1349
1314
  super(`MCP error ${code}: ${message}`);
1350
1315
  this.code = code;
1351
1316
  this.data = data;
1352
- this.name = "McpError";
1317
+ this.name = 'McpError';
1353
1318
  }
1354
1319
  }
1355
1320
  //# sourceMappingURL=types.js.map