@modelcontextprotocol/sdk 1.21.2 → 1.23.0-beta.0

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 (242) hide show
  1. package/README.md +92 -11
  2. package/dist/cjs/client/auth.d.ts +11 -1
  3. package/dist/cjs/client/auth.d.ts.map +1 -1
  4. package/dist/cjs/client/auth.js +71 -19
  5. package/dist/cjs/client/auth.js.map +1 -1
  6. package/dist/cjs/client/index.d.ts +252 -1478
  7. package/dist/cjs/client/index.d.ts.map +1 -1
  8. package/dist/cjs/client/index.js +130 -0
  9. package/dist/cjs/client/index.js.map +1 -1
  10. package/dist/cjs/client/sse.d.ts +1 -0
  11. package/dist/cjs/client/sse.d.ts.map +1 -1
  12. package/dist/cjs/client/sse.js +5 -3
  13. package/dist/cjs/client/sse.js.map +1 -1
  14. package/dist/cjs/client/streamableHttp.d.ts +2 -1
  15. package/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  16. package/dist/cjs/client/streamableHttp.js +35 -15
  17. package/dist/cjs/client/streamableHttp.js.map +1 -1
  18. package/dist/cjs/examples/client/elicitationUrlExample.d.ts +2 -0
  19. package/dist/cjs/examples/client/elicitationUrlExample.d.ts.map +1 -0
  20. package/dist/cjs/examples/client/elicitationUrlExample.js +693 -0
  21. package/dist/cjs/examples/client/elicitationUrlExample.js.map +1 -0
  22. package/dist/cjs/examples/client/simpleOAuthClient.js +13 -52
  23. package/dist/cjs/examples/client/simpleOAuthClient.js.map +1 -1
  24. package/dist/cjs/examples/client/simpleOAuthClientProvider.d.ts +26 -0
  25. package/dist/cjs/examples/client/simpleOAuthClientProvider.d.ts.map +1 -0
  26. package/dist/cjs/examples/client/simpleOAuthClientProvider.js +51 -0
  27. package/dist/cjs/examples/client/simpleOAuthClientProvider.js.map +1 -0
  28. package/dist/cjs/examples/client/simpleStreamableHttp.js +11 -6
  29. package/dist/cjs/examples/client/simpleStreamableHttp.js.map +1 -1
  30. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +4 -4
  31. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  32. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js +16 -0
  33. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  34. package/dist/cjs/examples/server/elicitationFormExample.d.ts +2 -0
  35. package/dist/cjs/examples/server/elicitationFormExample.d.ts.map +1 -0
  36. package/dist/cjs/examples/server/{elicitationExample.js → elicitationFormExample.js} +16 -12
  37. package/dist/cjs/examples/server/elicitationFormExample.js.map +1 -0
  38. package/dist/cjs/examples/server/elicitationUrlExample.d.ts +2 -0
  39. package/dist/cjs/examples/server/elicitationUrlExample.d.ts.map +1 -0
  40. package/dist/cjs/examples/server/elicitationUrlExample.js +655 -0
  41. package/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -0
  42. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js +26 -3
  43. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  44. package/dist/cjs/examples/server/mcpServerOutputSchema.js +34 -11
  45. package/dist/cjs/examples/server/mcpServerOutputSchema.js.map +1 -1
  46. package/dist/cjs/examples/server/simpleSseServer.js +26 -3
  47. package/dist/cjs/examples/server/simpleSseServer.js.map +1 -1
  48. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js +27 -4
  49. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  50. package/dist/cjs/examples/server/simpleStreamableHttp.js +34 -10
  51. package/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
  52. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +26 -3
  53. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  54. package/dist/cjs/examples/server/toolWithSampleServer.js +30 -8
  55. package/dist/cjs/examples/server/toolWithSampleServer.js.map +1 -1
  56. package/dist/cjs/server/auth/handlers/authorize.js +34 -11
  57. package/dist/cjs/server/auth/handlers/authorize.js.map +1 -1
  58. package/dist/cjs/server/auth/handlers/token.js +35 -12
  59. package/dist/cjs/server/auth/handlers/token.js.map +1 -1
  60. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  61. package/dist/cjs/server/auth/middleware/bearerAuth.js +13 -8
  62. package/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
  63. package/dist/cjs/server/auth/middleware/clientAuth.js +27 -4
  64. package/dist/cjs/server/auth/middleware/clientAuth.js.map +1 -1
  65. package/dist/cjs/server/auth/router.js +1 -1
  66. package/dist/cjs/server/auth/router.js.map +1 -1
  67. package/dist/cjs/server/completable.d.ts +30 -16
  68. package/dist/cjs/server/completable.d.ts.map +1 -1
  69. package/dist/cjs/server/completable.js +38 -55
  70. package/dist/cjs/server/completable.js.map +1 -1
  71. package/dist/cjs/server/index.d.ts +213 -71
  72. package/dist/cjs/server/index.d.ts.map +1 -1
  73. package/dist/cjs/server/index.js +61 -16
  74. package/dist/cjs/server/index.js.map +1 -1
  75. package/dist/cjs/server/mcp.d.ts +14 -16
  76. package/dist/cjs/server/mcp.d.ts.map +1 -1
  77. package/dist/cjs/server/mcp.js +105 -41
  78. package/dist/cjs/server/mcp.js.map +1 -1
  79. package/dist/cjs/server/zod-compat.d.ts +82 -0
  80. package/dist/cjs/server/zod-compat.d.ts.map +1 -0
  81. package/dist/cjs/server/zod-compat.js +252 -0
  82. package/dist/cjs/server/zod-compat.js.map +1 -0
  83. package/dist/cjs/server/zod-json-schema-compat.d.ts +12 -0
  84. package/dist/cjs/server/zod-json-schema-compat.d.ts.map +1 -0
  85. package/dist/cjs/server/zod-json-schema-compat.js +80 -0
  86. package/dist/cjs/server/zod-json-schema-compat.js.map +1 -0
  87. package/dist/cjs/shared/auth.d.ts +116 -502
  88. package/dist/cjs/shared/auth.d.ts.map +1 -1
  89. package/dist/cjs/shared/auth.js +133 -112
  90. package/dist/cjs/shared/auth.js.map +1 -1
  91. package/dist/cjs/shared/metadataUtils.d.ts +5 -1
  92. package/dist/cjs/shared/metadataUtils.d.ts.map +1 -1
  93. package/dist/cjs/shared/metadataUtils.js +2 -5
  94. package/dist/cjs/shared/metadataUtils.js.map +1 -1
  95. package/dist/cjs/shared/protocol.d.ts +7 -10
  96. package/dist/cjs/shared/protocol.d.ts.map +1 -1
  97. package/dist/cjs/shared/protocol.js +39 -16
  98. package/dist/cjs/shared/protocol.js.map +1 -1
  99. package/dist/cjs/shared/toolNameValidation.d.ts +31 -0
  100. package/dist/cjs/shared/toolNameValidation.d.ts.map +1 -0
  101. package/dist/cjs/shared/toolNameValidation.js +97 -0
  102. package/dist/cjs/shared/toolNameValidation.js.map +1 -0
  103. package/dist/cjs/shared/transport.d.ts +15 -1
  104. package/dist/cjs/shared/transport.d.ts.map +1 -1
  105. package/dist/cjs/shared/transport.js +40 -0
  106. package/dist/cjs/shared/transport.js.map +1 -1
  107. package/dist/cjs/shared/zodTestMatrix.d.ts +16 -0
  108. package/dist/cjs/shared/zodTestMatrix.d.ts.map +1 -0
  109. package/dist/cjs/shared/zodTestMatrix.js +43 -0
  110. package/dist/cjs/shared/zodTestMatrix.js.map +1 -0
  111. package/dist/cjs/spec.types.d.ts +823 -261
  112. package/dist/cjs/spec.types.d.ts.map +1 -1
  113. package/dist/cjs/spec.types.js +5 -8
  114. package/dist/cjs/spec.types.js.map +1 -1
  115. package/dist/cjs/types.d.ts +3828 -59205
  116. package/dist/cjs/types.d.ts.map +1 -1
  117. package/dist/cjs/types.js +817 -487
  118. package/dist/cjs/types.js.map +1 -1
  119. package/dist/esm/client/auth.d.ts +11 -1
  120. package/dist/esm/client/auth.d.ts.map +1 -1
  121. package/dist/esm/client/auth.js +71 -20
  122. package/dist/esm/client/auth.js.map +1 -1
  123. package/dist/esm/client/index.d.ts +252 -1478
  124. package/dist/esm/client/index.d.ts.map +1 -1
  125. package/dist/esm/client/index.js +130 -1
  126. package/dist/esm/client/index.js.map +1 -1
  127. package/dist/esm/client/sse.d.ts +1 -0
  128. package/dist/esm/client/sse.d.ts.map +1 -1
  129. package/dist/esm/client/sse.js +5 -3
  130. package/dist/esm/client/sse.js.map +1 -1
  131. package/dist/esm/client/streamableHttp.d.ts +2 -1
  132. package/dist/esm/client/streamableHttp.d.ts.map +1 -1
  133. package/dist/esm/client/streamableHttp.js +35 -15
  134. package/dist/esm/client/streamableHttp.js.map +1 -1
  135. package/dist/esm/examples/client/elicitationUrlExample.d.ts +2 -0
  136. package/dist/esm/examples/client/elicitationUrlExample.d.ts.map +1 -0
  137. package/dist/esm/examples/client/elicitationUrlExample.js +691 -0
  138. package/dist/esm/examples/client/elicitationUrlExample.js.map +1 -0
  139. package/dist/esm/examples/client/simpleOAuthClient.js +12 -51
  140. package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -1
  141. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts +26 -0
  142. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts.map +1 -0
  143. package/dist/esm/examples/client/simpleOAuthClientProvider.js +47 -0
  144. package/dist/esm/examples/client/simpleOAuthClientProvider.js.map +1 -0
  145. package/dist/esm/examples/client/simpleStreamableHttp.js +12 -7
  146. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
  147. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +4 -4
  148. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  149. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js +16 -0
  150. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  151. package/dist/esm/examples/server/elicitationFormExample.d.ts +2 -0
  152. package/dist/esm/examples/server/elicitationFormExample.d.ts.map +1 -0
  153. package/dist/esm/examples/server/{elicitationExample.js → elicitationFormExample.js} +16 -12
  154. package/dist/esm/examples/server/elicitationFormExample.js.map +1 -0
  155. package/dist/esm/examples/server/elicitationUrlExample.d.ts +2 -0
  156. package/dist/esm/examples/server/elicitationUrlExample.d.ts.map +1 -0
  157. package/dist/esm/examples/server/elicitationUrlExample.js +650 -0
  158. package/dist/esm/examples/server/elicitationUrlExample.js.map +1 -0
  159. package/dist/esm/examples/server/jsonResponseStreamableHttp.js +1 -1
  160. package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  161. package/dist/esm/examples/server/mcpServerOutputSchema.js +1 -1
  162. package/dist/esm/examples/server/mcpServerOutputSchema.js.map +1 -1
  163. package/dist/esm/examples/server/simpleSseServer.js +1 -1
  164. package/dist/esm/examples/server/simpleSseServer.js.map +1 -1
  165. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +1 -1
  166. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  167. package/dist/esm/examples/server/simpleStreamableHttp.js +4 -3
  168. package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  169. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +1 -1
  170. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  171. package/dist/esm/examples/server/toolWithSampleServer.js +6 -7
  172. package/dist/esm/examples/server/toolWithSampleServer.js.map +1 -1
  173. package/dist/esm/server/auth/handlers/authorize.js +1 -1
  174. package/dist/esm/server/auth/handlers/authorize.js.map +1 -1
  175. package/dist/esm/server/auth/handlers/token.js +1 -1
  176. package/dist/esm/server/auth/handlers/token.js.map +1 -1
  177. package/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  178. package/dist/esm/server/auth/middleware/bearerAuth.js +13 -8
  179. package/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  180. package/dist/esm/server/auth/middleware/clientAuth.js +1 -1
  181. package/dist/esm/server/auth/middleware/clientAuth.js.map +1 -1
  182. package/dist/esm/server/auth/router.js +1 -1
  183. package/dist/esm/server/auth/router.js.map +1 -1
  184. package/dist/esm/server/completable.d.ts +30 -16
  185. package/dist/esm/server/completable.d.ts.map +1 -1
  186. package/dist/esm/server/completable.js +34 -53
  187. package/dist/esm/server/completable.js.map +1 -1
  188. package/dist/esm/server/index.d.ts +213 -71
  189. package/dist/esm/server/index.d.ts.map +1 -1
  190. package/dist/esm/server/index.js +61 -16
  191. package/dist/esm/server/index.js.map +1 -1
  192. package/dist/esm/server/mcp.d.ts +14 -16
  193. package/dist/esm/server/mcp.d.ts.map +1 -1
  194. package/dist/esm/server/mcp.js +107 -43
  195. package/dist/esm/server/mcp.js.map +1 -1
  196. package/dist/esm/server/zod-compat.d.ts +82 -0
  197. package/dist/esm/server/zod-compat.d.ts.map +1 -0
  198. package/dist/esm/server/zod-compat.js +217 -0
  199. package/dist/esm/server/zod-compat.js.map +1 -0
  200. package/dist/esm/server/zod-json-schema-compat.d.ts +12 -0
  201. package/dist/esm/server/zod-json-schema-compat.d.ts.map +1 -0
  202. package/dist/esm/server/zod-json-schema-compat.js +52 -0
  203. package/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  204. package/dist/esm/shared/auth.d.ts +116 -502
  205. package/dist/esm/shared/auth.d.ts.map +1 -1
  206. package/dist/esm/shared/auth.js +17 -19
  207. package/dist/esm/shared/auth.js.map +1 -1
  208. package/dist/esm/shared/metadataUtils.d.ts +5 -1
  209. package/dist/esm/shared/metadataUtils.d.ts.map +1 -1
  210. package/dist/esm/shared/metadataUtils.js +2 -5
  211. package/dist/esm/shared/metadataUtils.js.map +1 -1
  212. package/dist/esm/shared/protocol.d.ts +7 -10
  213. package/dist/esm/shared/protocol.d.ts.map +1 -1
  214. package/dist/esm/shared/protocol.js +39 -16
  215. package/dist/esm/shared/protocol.js.map +1 -1
  216. package/dist/esm/shared/toolNameValidation.d.ts +31 -0
  217. package/dist/esm/shared/toolNameValidation.d.ts.map +1 -0
  218. package/dist/esm/shared/toolNameValidation.js +92 -0
  219. package/dist/esm/shared/toolNameValidation.js.map +1 -0
  220. package/dist/esm/shared/transport.d.ts +15 -1
  221. package/dist/esm/shared/transport.d.ts.map +1 -1
  222. package/dist/esm/shared/transport.js +38 -1
  223. package/dist/esm/shared/transport.js.map +1 -1
  224. package/dist/esm/shared/zodTestMatrix.d.ts +16 -0
  225. package/dist/esm/shared/zodTestMatrix.d.ts.map +1 -0
  226. package/dist/esm/shared/zodTestMatrix.js +17 -0
  227. package/dist/esm/shared/zodTestMatrix.js.map +1 -0
  228. package/dist/esm/spec.types.d.ts +823 -261
  229. package/dist/esm/spec.types.d.ts.map +1 -1
  230. package/dist/esm/spec.types.js +4 -7
  231. package/dist/esm/spec.types.js.map +1 -1
  232. package/dist/esm/types.d.ts +3828 -59205
  233. package/dist/esm/types.d.ts.map +1 -1
  234. package/dist/esm/types.js +664 -360
  235. package/dist/esm/types.js.map +1 -1
  236. package/package.json +13 -12
  237. package/dist/cjs/examples/server/elicitationExample.d.ts +0 -2
  238. package/dist/cjs/examples/server/elicitationExample.d.ts.map +0 -1
  239. package/dist/cjs/examples/server/elicitationExample.js.map +0 -1
  240. package/dist/esm/examples/server/elicitationExample.d.ts +0 -2
  241. package/dist/esm/examples/server/elicitationExample.d.ts.map +0 -1
  242. package/dist/esm/examples/server/elicitationExample.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Source: https://github.com/modelcontextprotocol/modelcontextprotocol
5
5
  * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts
6
- * Last updated from commit: 50671e92e71da830b101c7d1162b44fbddcbef30
6
+ * Last updated from commit: 4528444698f76e6d0337e58d2941d5d3485d779d
7
7
  *
8
8
  * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates.
9
9
  * To update this file, run: npm run fetch:spec-types
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
13
13
  *
14
- * @internal
14
+ * @category JSON-RPC
15
15
  */
16
16
  export type JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResponse | JSONRPCError;
17
17
  /** @internal */
@@ -20,26 +20,46 @@ export declare const LATEST_PROTOCOL_VERSION = "DRAFT-2025-v3";
20
20
  export declare const JSONRPC_VERSION = "2.0";
21
21
  /**
22
22
  * A progress token, used to associate progress notifications with the original request.
23
+ *
24
+ * @category Common Types
23
25
  */
24
26
  export type ProgressToken = string | number;
25
27
  /**
26
28
  * An opaque token used to represent a cursor for pagination.
29
+ *
30
+ * @category Common Types
27
31
  */
28
32
  export type Cursor = string;
33
+ /**
34
+ * Common params for any request.
35
+ *
36
+ * @internal
37
+ */
38
+ export interface RequestParams {
39
+ /**
40
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
41
+ */
42
+ _meta?: {
43
+ /**
44
+ * 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.
45
+ */
46
+ progressToken?: ProgressToken;
47
+ [key: string]: unknown;
48
+ };
49
+ }
29
50
  /** @internal */
30
51
  export interface Request {
31
52
  method: string;
32
53
  params?: {
33
- /**
34
- * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
35
- */
36
- _meta?: {
37
- /**
38
- * 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.
39
- */
40
- progressToken?: ProgressToken;
41
- [key: string]: unknown;
42
- };
54
+ [key: string]: any;
55
+ };
56
+ }
57
+ /** @internal */
58
+ export interface NotificationParams {
59
+ /**
60
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
61
+ */
62
+ _meta?: {
43
63
  [key: string]: unknown;
44
64
  };
45
65
  }
@@ -47,15 +67,12 @@ export interface Request {
47
67
  export interface Notification {
48
68
  method: string;
49
69
  params?: {
50
- /**
51
- * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
52
- */
53
- _meta?: {
54
- [key: string]: unknown;
55
- };
56
- [key: string]: unknown;
70
+ [key: string]: any;
57
71
  };
58
72
  }
73
+ /**
74
+ * @category Common Types
75
+ */
59
76
  export interface Result {
60
77
  /**
61
78
  * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
@@ -65,6 +82,9 @@ export interface Result {
65
82
  };
66
83
  [key: string]: unknown;
67
84
  }
85
+ /**
86
+ * @category Common Types
87
+ */
68
88
  export interface Error {
69
89
  /**
70
90
  * The error type that occurred.
@@ -81,10 +101,14 @@ export interface Error {
81
101
  }
82
102
  /**
83
103
  * A uniquely identifying ID for a request in JSON-RPC.
104
+ *
105
+ * @category Common Types
84
106
  */
85
107
  export type RequestId = string | number;
86
108
  /**
87
109
  * A request that expects a response.
110
+ *
111
+ * @category JSON-RPC
88
112
  */
89
113
  export interface JSONRPCRequest extends Request {
90
114
  jsonrpc: typeof JSONRPC_VERSION;
@@ -92,40 +116,76 @@ export interface JSONRPCRequest extends Request {
92
116
  }
93
117
  /**
94
118
  * A notification which does not expect a response.
119
+ *
120
+ * @category JSON-RPC
95
121
  */
96
122
  export interface JSONRPCNotification extends Notification {
97
123
  jsonrpc: typeof JSONRPC_VERSION;
98
124
  }
99
125
  /**
100
126
  * A successful (non-error) response to a request.
127
+ *
128
+ * @category JSON-RPC
101
129
  */
102
130
  export interface JSONRPCResponse {
103
131
  jsonrpc: typeof JSONRPC_VERSION;
104
132
  id: RequestId;
105
133
  result: Result;
106
134
  }
107
- /** @internal */
108
135
  export declare const PARSE_ERROR = -32700;
109
- /** @internal */
110
136
  export declare const INVALID_REQUEST = -32600;
111
- /** @internal */
112
137
  export declare const METHOD_NOT_FOUND = -32601;
113
- /** @internal */
114
138
  export declare const INVALID_PARAMS = -32602;
115
- /** @internal */
116
139
  export declare const INTERNAL_ERROR = -32603;
140
+ /** @internal */
141
+ export declare const URL_ELICITATION_REQUIRED = -32042;
117
142
  /**
118
143
  * A response to a request that indicates an error occurred.
144
+ *
145
+ * @category JSON-RPC
119
146
  */
120
147
  export interface JSONRPCError {
121
148
  jsonrpc: typeof JSONRPC_VERSION;
122
149
  id: RequestId;
123
150
  error: Error;
124
151
  }
152
+ /**
153
+ * An error response that indicates that the server requires the client to provide additional information via an elicitation request.
154
+ *
155
+ * @internal
156
+ */
157
+ export interface URLElicitationRequiredError extends Omit<JSONRPCError, "error"> {
158
+ error: Error & {
159
+ code: typeof URL_ELICITATION_REQUIRED;
160
+ data: {
161
+ elicitations: ElicitRequestURLParams[];
162
+ [key: string]: unknown;
163
+ };
164
+ };
165
+ }
125
166
  /**
126
167
  * A response that indicates success but carries no data.
168
+ *
169
+ * @category Common Types
127
170
  */
128
171
  export type EmptyResult = Result;
172
+ /**
173
+ * Parameters for a `notifications/cancelled` notification.
174
+ *
175
+ * @category `notifications/cancelled`
176
+ */
177
+ export interface CancelledNotificationParams extends NotificationParams {
178
+ /**
179
+ * The ID of the request to cancel.
180
+ *
181
+ * This MUST correspond to the ID of a request previously issued in the same direction.
182
+ */
183
+ requestId: RequestId;
184
+ /**
185
+ * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
186
+ */
187
+ reason?: string;
188
+ }
129
189
  /**
130
190
  * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
131
191
  *
@@ -135,43 +195,38 @@ export type EmptyResult = Result;
135
195
  *
136
196
  * A client MUST NOT attempt to cancel its `initialize` request.
137
197
  *
138
- * @category notifications/cancelled
198
+ * @category `notifications/cancelled`
139
199
  */
140
200
  export interface CancelledNotification extends JSONRPCNotification {
141
201
  method: "notifications/cancelled";
142
- params: {
143
- /**
144
- * The ID of the request to cancel.
145
- *
146
- * This MUST correspond to the ID of a request previously issued in the same direction.
147
- */
148
- requestId: RequestId;
149
- /**
150
- * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
151
- */
152
- reason?: string;
153
- };
202
+ params: CancelledNotificationParams;
203
+ }
204
+ /**
205
+ * Parameters for an `initialize` request.
206
+ *
207
+ * @category `initialize`
208
+ */
209
+ export interface InitializeRequestParams extends RequestParams {
210
+ /**
211
+ * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
212
+ */
213
+ protocolVersion: string;
214
+ capabilities: ClientCapabilities;
215
+ clientInfo: Implementation;
154
216
  }
155
217
  /**
156
218
  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
157
219
  *
158
- * @category initialize
220
+ * @category `initialize`
159
221
  */
160
222
  export interface InitializeRequest extends JSONRPCRequest {
161
223
  method: "initialize";
162
- params: {
163
- /**
164
- * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
165
- */
166
- protocolVersion: string;
167
- capabilities: ClientCapabilities;
168
- clientInfo: Implementation;
169
- };
224
+ params: InitializeRequestParams;
170
225
  }
171
226
  /**
172
227
  * After receiving an initialize request from the client, the server sends this response.
173
228
  *
174
- * @category initialize
229
+ * @category `initialize`
175
230
  */
176
231
  export interface InitializeResult extends Result {
177
232
  /**
@@ -190,13 +245,16 @@ export interface InitializeResult extends Result {
190
245
  /**
191
246
  * This notification is sent from the client to the server after initialization has finished.
192
247
  *
193
- * @category notifications/initialized
248
+ * @category `notifications/initialized`
194
249
  */
195
250
  export interface InitializedNotification extends JSONRPCNotification {
196
251
  method: "notifications/initialized";
252
+ params?: NotificationParams;
197
253
  }
198
254
  /**
199
255
  * 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.
256
+ *
257
+ * @category `initialize`
200
258
  */
201
259
  export interface ClientCapabilities {
202
260
  /**
@@ -217,14 +275,29 @@ export interface ClientCapabilities {
217
275
  /**
218
276
  * Present if the client supports sampling from an LLM.
219
277
  */
220
- sampling?: object;
278
+ sampling?: {
279
+ /**
280
+ * Whether the client supports context inclusion via includeContext parameter.
281
+ * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
282
+ */
283
+ context?: object;
284
+ /**
285
+ * Whether the client supports tool use via tools and toolChoice parameters.
286
+ */
287
+ tools?: object;
288
+ };
221
289
  /**
222
290
  * Present if the client supports elicitation from the server.
223
291
  */
224
- elicitation?: object;
292
+ elicitation?: {
293
+ form?: object;
294
+ url?: object;
295
+ };
225
296
  }
226
297
  /**
227
298
  * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
299
+ *
300
+ * @category `initialize`
228
301
  */
229
302
  export interface ServerCapabilities {
230
303
  /**
@@ -275,6 +348,8 @@ export interface ServerCapabilities {
275
348
  }
276
349
  /**
277
350
  * An optionally-sized icon that can be displayed in a user interface.
351
+ *
352
+ * @category Common Types
278
353
  */
279
354
  export interface Icon {
280
355
  /**
@@ -309,7 +384,7 @@ export interface Icon {
309
384
  *
310
385
  * If not provided, the client should assume the icon can be used with any theme.
311
386
  */
312
- theme?: 'light' | 'dark';
387
+ theme?: "light" | "dark";
313
388
  }
314
389
  /**
315
390
  * Base interface to add `icons` property.
@@ -351,7 +426,9 @@ export interface BaseMetadata {
351
426
  title?: string;
352
427
  }
353
428
  /**
354
- * Describes the MCP implementation
429
+ * Describes the MCP implementation.
430
+ *
431
+ * @category `initialize`
355
432
  */
356
433
  export interface Implementation extends BaseMetadata, Icons {
357
434
  version: string;
@@ -365,50 +442,63 @@ export interface Implementation extends BaseMetadata, Icons {
365
442
  /**
366
443
  * 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.
367
444
  *
368
- * @category ping
445
+ * @category `ping`
369
446
  */
370
447
  export interface PingRequest extends JSONRPCRequest {
371
448
  method: "ping";
449
+ params?: RequestParams;
450
+ }
451
+ /**
452
+ * Parameters for a `notifications/progress` notification.
453
+ *
454
+ * @category `notifications/progress`
455
+ */
456
+ export interface ProgressNotificationParams extends NotificationParams {
457
+ /**
458
+ * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
459
+ */
460
+ progressToken: ProgressToken;
461
+ /**
462
+ * The progress thus far. This should increase every time progress is made, even if the total is unknown.
463
+ *
464
+ * @TJS-type number
465
+ */
466
+ progress: number;
467
+ /**
468
+ * Total number of items to process (or total progress required), if known.
469
+ *
470
+ * @TJS-type number
471
+ */
472
+ total?: number;
473
+ /**
474
+ * An optional message describing the current progress.
475
+ */
476
+ message?: string;
372
477
  }
373
478
  /**
374
479
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
375
480
  *
376
- * @category notifications/progress
481
+ * @category `notifications/progress`
377
482
  */
378
483
  export interface ProgressNotification extends JSONRPCNotification {
379
484
  method: "notifications/progress";
380
- params: {
381
- /**
382
- * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
383
- */
384
- progressToken: ProgressToken;
385
- /**
386
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
387
- *
388
- * @TJS-type number
389
- */
390
- progress: number;
391
- /**
392
- * Total number of items to process (or total progress required), if known.
393
- *
394
- * @TJS-type number
395
- */
396
- total?: number;
397
- /**
398
- * An optional message describing the current progress.
399
- */
400
- message?: string;
401
- };
485
+ params: ProgressNotificationParams;
486
+ }
487
+ /**
488
+ * Common parameters for paginated requests.
489
+ *
490
+ * @internal
491
+ */
492
+ export interface PaginatedRequestParams extends RequestParams {
493
+ /**
494
+ * An opaque token representing the current pagination position.
495
+ * If provided, the server should return results starting after this cursor.
496
+ */
497
+ cursor?: Cursor;
402
498
  }
403
499
  /** @internal */
404
500
  export interface PaginatedRequest extends JSONRPCRequest {
405
- params?: {
406
- /**
407
- * An opaque token representing the current pagination position.
408
- * If provided, the server should return results starting after this cursor.
409
- */
410
- cursor?: Cursor;
411
- };
501
+ params?: PaginatedRequestParams;
412
502
  }
413
503
  /** @internal */
414
504
  export interface PaginatedResult extends Result {
@@ -421,7 +511,7 @@ export interface PaginatedResult extends Result {
421
511
  /**
422
512
  * Sent from the client to request a list of resources the server has.
423
513
  *
424
- * @category resources/list
514
+ * @category `resources/list`
425
515
  */
426
516
  export interface ListResourcesRequest extends PaginatedRequest {
427
517
  method: "resources/list";
@@ -429,7 +519,7 @@ export interface ListResourcesRequest extends PaginatedRequest {
429
519
  /**
430
520
  * The server's response to a resources/list request from the client.
431
521
  *
432
- * @category resources/list
522
+ * @category `resources/list`
433
523
  */
434
524
  export interface ListResourcesResult extends PaginatedResult {
435
525
  resources: Resource[];
@@ -437,7 +527,7 @@ export interface ListResourcesResult extends PaginatedResult {
437
527
  /**
438
528
  * Sent from the client to request a list of resource templates the server has.
439
529
  *
440
- * @category resources/templates/list
530
+ * @category `resources/templates/list`
441
531
  */
442
532
  export interface ListResourceTemplatesRequest extends PaginatedRequest {
443
533
  method: "resources/templates/list";
@@ -445,31 +535,44 @@ export interface ListResourceTemplatesRequest extends PaginatedRequest {
445
535
  /**
446
536
  * The server's response to a resources/templates/list request from the client.
447
537
  *
448
- * @category resources/templates/list
538
+ * @category `resources/templates/list`
449
539
  */
450
540
  export interface ListResourceTemplatesResult extends PaginatedResult {
451
541
  resourceTemplates: ResourceTemplate[];
452
542
  }
543
+ /**
544
+ * Common parameters when working with resources.
545
+ *
546
+ * @internal
547
+ */
548
+ export interface ResourceRequestParams extends RequestParams {
549
+ /**
550
+ * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
551
+ *
552
+ * @format uri
553
+ */
554
+ uri: string;
555
+ }
556
+ /**
557
+ * Parameters for a `resources/read` request.
558
+ *
559
+ * @category `resources/read`
560
+ */
561
+ export interface ReadResourceRequestParams extends ResourceRequestParams {
562
+ }
453
563
  /**
454
564
  * Sent from the client to the server, to read a specific resource URI.
455
565
  *
456
- * @category resources/read
566
+ * @category `resources/read`
457
567
  */
458
568
  export interface ReadResourceRequest extends JSONRPCRequest {
459
569
  method: "resources/read";
460
- params: {
461
- /**
462
- * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
463
- *
464
- * @format uri
465
- */
466
- uri: string;
467
- };
570
+ params: ReadResourceRequestParams;
468
571
  }
469
572
  /**
470
573
  * The server's response to a resources/read request from the client.
471
574
  *
472
- * @category resources/read
575
+ * @category `resources/read`
473
576
  */
474
577
  export interface ReadResourceResult extends Result {
475
578
  contents: (TextResourceContents | BlobResourceContents)[];
@@ -477,61 +580,70 @@ export interface ReadResourceResult extends Result {
477
580
  /**
478
581
  * 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.
479
582
  *
480
- * @category notifications/resources/list_changed
583
+ * @category `notifications/resources/list_changed`
481
584
  */
482
585
  export interface ResourceListChangedNotification extends JSONRPCNotification {
483
586
  method: "notifications/resources/list_changed";
587
+ params?: NotificationParams;
588
+ }
589
+ /**
590
+ * Parameters for a `resources/subscribe` request.
591
+ *
592
+ * @category `resources/subscribe`
593
+ */
594
+ export interface SubscribeRequestParams extends ResourceRequestParams {
484
595
  }
485
596
  /**
486
597
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
487
598
  *
488
- * @category resources/subscribe
599
+ * @category `resources/subscribe`
489
600
  */
490
601
  export interface SubscribeRequest extends JSONRPCRequest {
491
602
  method: "resources/subscribe";
492
- params: {
493
- /**
494
- * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
495
- *
496
- * @format uri
497
- */
498
- uri: string;
499
- };
603
+ params: SubscribeRequestParams;
604
+ }
605
+ /**
606
+ * Parameters for a `resources/unsubscribe` request.
607
+ *
608
+ * @category `resources/unsubscribe`
609
+ */
610
+ export interface UnsubscribeRequestParams extends ResourceRequestParams {
500
611
  }
501
612
  /**
502
613
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
503
614
  *
504
- * @category resources/unsubscribe
615
+ * @category `resources/unsubscribe`
505
616
  */
506
617
  export interface UnsubscribeRequest extends JSONRPCRequest {
507
618
  method: "resources/unsubscribe";
508
- params: {
509
- /**
510
- * The URI of the resource to unsubscribe from.
511
- *
512
- * @format uri
513
- */
514
- uri: string;
515
- };
619
+ params: UnsubscribeRequestParams;
620
+ }
621
+ /**
622
+ * Parameters for a `notifications/resources/updated` notification.
623
+ *
624
+ * @category `notifications/resources/updated`
625
+ */
626
+ export interface ResourceUpdatedNotificationParams extends NotificationParams {
627
+ /**
628
+ * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
629
+ *
630
+ * @format uri
631
+ */
632
+ uri: string;
516
633
  }
517
634
  /**
518
635
  * 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.
519
636
  *
520
- * @category notifications/resources/updated
637
+ * @category `notifications/resources/updated`
521
638
  */
522
639
  export interface ResourceUpdatedNotification extends JSONRPCNotification {
523
640
  method: "notifications/resources/updated";
524
- params: {
525
- /**
526
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
527
- *
528
- * @format uri
529
- */
530
- uri: string;
531
- };
641
+ params: ResourceUpdatedNotificationParams;
532
642
  }
533
643
  /**
534
644
  * A known resource that the server is capable of reading.
645
+ *
646
+ * @category `resources/list`
535
647
  */
536
648
  export interface Resource extends BaseMetadata, Icons {
537
649
  /**
@@ -569,6 +681,8 @@ export interface Resource extends BaseMetadata, Icons {
569
681
  }
570
682
  /**
571
683
  * A template description for resources available on the server.
684
+ *
685
+ * @category `resources/templates/list`
572
686
  */
573
687
  export interface ResourceTemplate extends BaseMetadata, Icons {
574
688
  /**
@@ -600,6 +714,8 @@ export interface ResourceTemplate extends BaseMetadata, Icons {
600
714
  }
601
715
  /**
602
716
  * The contents of a specific resource or sub-resource.
717
+ *
718
+ * @internal
603
719
  */
604
720
  export interface ResourceContents {
605
721
  /**
@@ -619,12 +735,18 @@ export interface ResourceContents {
619
735
  [key: string]: unknown;
620
736
  };
621
737
  }
738
+ /**
739
+ * @category Content
740
+ */
622
741
  export interface TextResourceContents extends ResourceContents {
623
742
  /**
624
743
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
625
744
  */
626
745
  text: string;
627
746
  }
747
+ /**
748
+ * @category Content
749
+ */
628
750
  export interface BlobResourceContents extends ResourceContents {
629
751
  /**
630
752
  * A base64-encoded string representing the binary data of the item.
@@ -636,7 +758,7 @@ export interface BlobResourceContents extends ResourceContents {
636
758
  /**
637
759
  * Sent from the client to request a list of prompts and prompt templates the server has.
638
760
  *
639
- * @category prompts/list
761
+ * @category `prompts/list`
640
762
  */
641
763
  export interface ListPromptsRequest extends PaginatedRequest {
642
764
  method: "prompts/list";
@@ -644,35 +766,41 @@ export interface ListPromptsRequest extends PaginatedRequest {
644
766
  /**
645
767
  * The server's response to a prompts/list request from the client.
646
768
  *
647
- * @category prompts/list
769
+ * @category `prompts/list`
648
770
  */
649
771
  export interface ListPromptsResult extends PaginatedResult {
650
772
  prompts: Prompt[];
651
773
  }
774
+ /**
775
+ * Parameters for a `prompts/get` request.
776
+ *
777
+ * @category `prompts/get`
778
+ */
779
+ export interface GetPromptRequestParams extends RequestParams {
780
+ /**
781
+ * The name of the prompt or prompt template.
782
+ */
783
+ name: string;
784
+ /**
785
+ * Arguments to use for templating the prompt.
786
+ */
787
+ arguments?: {
788
+ [key: string]: string;
789
+ };
790
+ }
652
791
  /**
653
792
  * Used by the client to get a prompt provided by the server.
654
793
  *
655
- * @category prompts/get
794
+ * @category `prompts/get`
656
795
  */
657
796
  export interface GetPromptRequest extends JSONRPCRequest {
658
797
  method: "prompts/get";
659
- params: {
660
- /**
661
- * The name of the prompt or prompt template.
662
- */
663
- name: string;
664
- /**
665
- * Arguments to use for templating the prompt.
666
- */
667
- arguments?: {
668
- [key: string]: string;
669
- };
670
- };
798
+ params: GetPromptRequestParams;
671
799
  }
672
800
  /**
673
801
  * The server's response to a prompts/get request from the client.
674
802
  *
675
- * @category prompts/get
803
+ * @category `prompts/get`
676
804
  */
677
805
  export interface GetPromptResult extends Result {
678
806
  /**
@@ -683,6 +811,8 @@ export interface GetPromptResult extends Result {
683
811
  }
684
812
  /**
685
813
  * A prompt or prompt template that the server offers.
814
+ *
815
+ * @category `prompts/list`
686
816
  */
687
817
  export interface Prompt extends BaseMetadata, Icons {
688
818
  /**
@@ -702,6 +832,8 @@ export interface Prompt extends BaseMetadata, Icons {
702
832
  }
703
833
  /**
704
834
  * Describes an argument that a prompt can accept.
835
+ *
836
+ * @category `prompts/list`
705
837
  */
706
838
  export interface PromptArgument extends BaseMetadata {
707
839
  /**
@@ -715,6 +847,8 @@ export interface PromptArgument extends BaseMetadata {
715
847
  }
716
848
  /**
717
849
  * The sender or recipient of messages and data in a conversation.
850
+ *
851
+ * @category Common Types
718
852
  */
719
853
  export type Role = "user" | "assistant";
720
854
  /**
@@ -722,6 +856,8 @@ export type Role = "user" | "assistant";
722
856
  *
723
857
  * This is similar to `SamplingMessage`, but also supports the embedding of
724
858
  * resources from the MCP server.
859
+ *
860
+ * @category `prompts/get`
725
861
  */
726
862
  export interface PromptMessage {
727
863
  role: Role;
@@ -731,6 +867,8 @@ export interface PromptMessage {
731
867
  * A resource that the server is capable of reading, included in a prompt or tool call result.
732
868
  *
733
869
  * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
870
+ *
871
+ * @category Content
734
872
  */
735
873
  export interface ResourceLink extends Resource {
736
874
  type: "resource_link";
@@ -740,6 +878,8 @@ export interface ResourceLink extends Resource {
740
878
  *
741
879
  * It is up to the client how best to render embedded resources for the benefit
742
880
  * of the LLM and/or the user.
881
+ *
882
+ * @category Content
743
883
  */
744
884
  export interface EmbeddedResource {
745
885
  type: "resource";
@@ -758,15 +898,16 @@ export interface EmbeddedResource {
758
898
  /**
759
899
  * 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.
760
900
  *
761
- * @category notifications/prompts/list_changed
901
+ * @category `notifications/prompts/list_changed`
762
902
  */
763
903
  export interface PromptListChangedNotification extends JSONRPCNotification {
764
904
  method: "notifications/prompts/list_changed";
905
+ params?: NotificationParams;
765
906
  }
766
907
  /**
767
908
  * Sent from the client to request a list of tools the server has.
768
909
  *
769
- * @category tools/list
910
+ * @category `tools/list`
770
911
  */
771
912
  export interface ListToolsRequest extends PaginatedRequest {
772
913
  method: "tools/list";
@@ -774,7 +915,7 @@ export interface ListToolsRequest extends PaginatedRequest {
774
915
  /**
775
916
  * The server's response to a tools/list request from the client.
776
917
  *
777
- * @category tools/list
918
+ * @category `tools/list`
778
919
  */
779
920
  export interface ListToolsResult extends PaginatedResult {
780
921
  tools: Tool[];
@@ -782,7 +923,7 @@ export interface ListToolsResult extends PaginatedResult {
782
923
  /**
783
924
  * The server's response to a tool call.
784
925
  *
785
- * @category tools/call
926
+ * @category `tools/call`
786
927
  */
787
928
  export interface CallToolResult extends Result {
788
929
  /**
@@ -811,27 +952,40 @@ export interface CallToolResult extends Result {
811
952
  */
812
953
  isError?: boolean;
813
954
  }
955
+ /**
956
+ * Parameters for a `tools/call` request.
957
+ *
958
+ * @category `tools/call`
959
+ */
960
+ export interface CallToolRequestParams extends RequestParams {
961
+ /**
962
+ * The name of the tool.
963
+ */
964
+ name: string;
965
+ /**
966
+ * Arguments to use for the tool call.
967
+ */
968
+ arguments?: {
969
+ [key: string]: unknown;
970
+ };
971
+ }
814
972
  /**
815
973
  * Used by the client to invoke a tool provided by the server.
816
974
  *
817
- * @category tools/call
975
+ * @category `tools/call`
818
976
  */
819
977
  export interface CallToolRequest extends JSONRPCRequest {
820
978
  method: "tools/call";
821
- params: {
822
- name: string;
823
- arguments?: {
824
- [key: string]: unknown;
825
- };
826
- };
979
+ params: CallToolRequestParams;
827
980
  }
828
981
  /**
829
982
  * 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.
830
983
  *
831
- * @category notifications/tools/list_changed
984
+ * @category `notifications/tools/list_changed`
832
985
  */
833
986
  export interface ToolListChangedNotification extends JSONRPCNotification {
834
987
  method: "notifications/tools/list_changed";
988
+ params?: NotificationParams;
835
989
  }
836
990
  /**
837
991
  * Additional properties describing a Tool to clients.
@@ -842,6 +996,8 @@ export interface ToolListChangedNotification extends JSONRPCNotification {
842
996
  *
843
997
  * Clients should never make tool use decisions based on ToolAnnotations
844
998
  * received from untrusted servers.
999
+ *
1000
+ * @category `tools/list`
845
1001
  */
846
1002
  export interface ToolAnnotations {
847
1003
  /**
@@ -884,6 +1040,8 @@ export interface ToolAnnotations {
884
1040
  }
885
1041
  /**
886
1042
  * Definition for a tool the client can call.
1043
+ *
1044
+ * @category `tools/list`
887
1045
  */
888
1046
  export interface Tool extends BaseMetadata, Icons {
889
1047
  /**
@@ -926,91 +1084,140 @@ export interface Tool extends BaseMetadata, Icons {
926
1084
  [key: string]: unknown;
927
1085
  };
928
1086
  }
1087
+ /**
1088
+ * Parameters for a `logging/setLevel` request.
1089
+ *
1090
+ * @category `logging/setLevel`
1091
+ */
1092
+ export interface SetLevelRequestParams extends RequestParams {
1093
+ /**
1094
+ * 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/message.
1095
+ */
1096
+ level: LoggingLevel;
1097
+ }
929
1098
  /**
930
1099
  * A request from the client to the server, to enable or adjust logging.
931
1100
  *
932
- * @category logging/setLevel
1101
+ * @category `logging/setLevel`
933
1102
  */
934
1103
  export interface SetLevelRequest extends JSONRPCRequest {
935
1104
  method: "logging/setLevel";
936
- params: {
937
- /**
938
- * 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/message.
939
- */
940
- level: LoggingLevel;
941
- };
1105
+ params: SetLevelRequestParams;
1106
+ }
1107
+ /**
1108
+ * Parameters for a `notifications/message` notification.
1109
+ *
1110
+ * @category `notifications/message`
1111
+ */
1112
+ export interface LoggingMessageNotificationParams extends NotificationParams {
1113
+ /**
1114
+ * The severity of this log message.
1115
+ */
1116
+ level: LoggingLevel;
1117
+ /**
1118
+ * An optional name of the logger issuing this message.
1119
+ */
1120
+ logger?: string;
1121
+ /**
1122
+ * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
1123
+ */
1124
+ data: unknown;
942
1125
  }
943
1126
  /**
944
1127
  * JSONRPCNotification 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.
945
1128
  *
946
- * @category notifications/message
1129
+ * @category `notifications/message`
947
1130
  */
948
1131
  export interface LoggingMessageNotification extends JSONRPCNotification {
949
1132
  method: "notifications/message";
950
- params: {
951
- /**
952
- * The severity of this log message.
953
- */
954
- level: LoggingLevel;
955
- /**
956
- * An optional name of the logger issuing this message.
957
- */
958
- logger?: string;
959
- /**
960
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
961
- */
962
- data: unknown;
963
- };
1133
+ params: LoggingMessageNotificationParams;
964
1134
  }
965
1135
  /**
966
1136
  * The severity of a log message.
967
1137
  *
968
1138
  * These map to syslog message severities, as specified in RFC-5424:
969
1139
  * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
1140
+ *
1141
+ * @category Common Types
970
1142
  */
971
1143
  export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
1144
+ /**
1145
+ * Parameters for a `sampling/createMessage` request.
1146
+ *
1147
+ * @category `sampling/createMessage`
1148
+ */
1149
+ export interface CreateMessageRequestParams extends RequestParams {
1150
+ messages: SamplingMessage[];
1151
+ /**
1152
+ * The server's preferences for which model to select. The client MAY ignore these preferences.
1153
+ */
1154
+ modelPreferences?: ModelPreferences;
1155
+ /**
1156
+ * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1157
+ */
1158
+ systemPrompt?: string;
1159
+ /**
1160
+ * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
1161
+ * The client MAY ignore this request.
1162
+ *
1163
+ * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
1164
+ * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
1165
+ */
1166
+ includeContext?: "none" | "thisServer" | "allServers";
1167
+ /**
1168
+ * @TJS-type number
1169
+ */
1170
+ temperature?: number;
1171
+ /**
1172
+ * The requested maximum number of tokens to sample (to prevent runaway completions).
1173
+ *
1174
+ * The client MAY choose to sample fewer tokens than the requested maximum.
1175
+ */
1176
+ maxTokens: number;
1177
+ stopSequences?: string[];
1178
+ /**
1179
+ * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1180
+ */
1181
+ metadata?: object;
1182
+ /**
1183
+ * Tools that the model may use during generation.
1184
+ * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
1185
+ */
1186
+ tools?: Tool[];
1187
+ /**
1188
+ * Controls how the model uses tools.
1189
+ * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
1190
+ * Default is `{ mode: "auto" }`.
1191
+ */
1192
+ toolChoice?: ToolChoice;
1193
+ }
1194
+ /**
1195
+ * Controls tool selection behavior for sampling requests.
1196
+ *
1197
+ * @category `sampling/createMessage`
1198
+ */
1199
+ export interface ToolChoice {
1200
+ /**
1201
+ * Controls the tool use ability of the model:
1202
+ * - "auto": Model decides whether to use tools (default)
1203
+ * - "required": Model MUST use at least one tool before completing
1204
+ * - "none": Model MUST NOT use any tools
1205
+ */
1206
+ mode?: "auto" | "required" | "none";
1207
+ }
972
1208
  /**
973
1209
  * 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.
974
1210
  *
975
- * @category sampling/createMessage
1211
+ * @category `sampling/createMessage`
976
1212
  */
977
1213
  export interface CreateMessageRequest extends JSONRPCRequest {
978
1214
  method: "sampling/createMessage";
979
- params: {
980
- messages: SamplingMessage[];
981
- /**
982
- * The server's preferences for which model to select. The client MAY ignore these preferences.
983
- */
984
- modelPreferences?: ModelPreferences;
985
- /**
986
- * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
987
- */
988
- systemPrompt?: string;
989
- /**
990
- * 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.
991
- */
992
- includeContext?: "none" | "thisServer" | "allServers";
993
- /**
994
- * @TJS-type number
995
- */
996
- temperature?: number;
997
- /**
998
- * The requested maximum number of tokens to sample (to prevent runaway completions).
999
- *
1000
- * The client MAY choose to sample fewer tokens than the requested maximum.
1001
- */
1002
- maxTokens: number;
1003
- stopSequences?: string[];
1004
- /**
1005
- * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1006
- */
1007
- metadata?: object;
1008
- };
1215
+ params: CreateMessageRequestParams;
1009
1216
  }
1010
1217
  /**
1011
1218
  * 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.
1012
1219
  *
1013
- * @category sampling/createMessage
1220
+ * @category `sampling/createMessage`
1014
1221
  */
1015
1222
  export interface CreateMessageResult extends Result, SamplingMessage {
1016
1223
  /**
@@ -1019,18 +1226,37 @@ export interface CreateMessageResult extends Result, SamplingMessage {
1019
1226
  model: string;
1020
1227
  /**
1021
1228
  * The reason why sampling stopped, if known.
1229
+ *
1230
+ * Standard values:
1231
+ * - "endTurn": Natural end of the assistant's turn
1232
+ * - "stopSequence": A stop sequence was encountered
1233
+ * - "maxTokens": Maximum token limit was reached
1234
+ * - "toolUse": The model wants to use one or more tools
1235
+ *
1236
+ * This field is an open string to allow for provider-specific stop reasons.
1022
1237
  */
1023
- stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
1238
+ stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string;
1024
1239
  }
1025
1240
  /**
1026
1241
  * Describes a message issued to or received from an LLM API.
1242
+ *
1243
+ * @category `sampling/createMessage`
1027
1244
  */
1028
1245
  export interface SamplingMessage {
1029
1246
  role: Role;
1030
- content: TextContent | ImageContent | AudioContent;
1247
+ content: SamplingMessageContentBlock | SamplingMessageContentBlock[];
1248
+ /**
1249
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1250
+ */
1251
+ _meta?: {
1252
+ [key: string]: unknown;
1253
+ };
1031
1254
  }
1255
+ export type SamplingMessageContentBlock = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
1032
1256
  /**
1033
1257
  * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
1258
+ *
1259
+ * @category Common Types
1034
1260
  */
1035
1261
  export interface Annotations {
1036
1262
  /**
@@ -1061,9 +1287,14 @@ export interface Annotations {
1061
1287
  */
1062
1288
  lastModified?: string;
1063
1289
  }
1290
+ /**
1291
+ * @category Content
1292
+ */
1064
1293
  export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource;
1065
1294
  /**
1066
1295
  * Text provided to or from an LLM.
1296
+ *
1297
+ * @category Content
1067
1298
  */
1068
1299
  export interface TextContent {
1069
1300
  type: "text";
@@ -1084,6 +1315,8 @@ export interface TextContent {
1084
1315
  }
1085
1316
  /**
1086
1317
  * An image provided to or from an LLM.
1318
+ *
1319
+ * @category Content
1087
1320
  */
1088
1321
  export interface ImageContent {
1089
1322
  type: "image";
@@ -1110,6 +1343,8 @@ export interface ImageContent {
1110
1343
  }
1111
1344
  /**
1112
1345
  * Audio provided to or from an LLM.
1346
+ *
1347
+ * @category Content
1113
1348
  */
1114
1349
  export interface AudioContent {
1115
1350
  type: "audio";
@@ -1134,6 +1369,84 @@ export interface AudioContent {
1134
1369
  [key: string]: unknown;
1135
1370
  };
1136
1371
  }
1372
+ /**
1373
+ * A request from the assistant to call a tool.
1374
+ *
1375
+ * @category `sampling/createMessage`
1376
+ */
1377
+ export interface ToolUseContent {
1378
+ type: "tool_use";
1379
+ /**
1380
+ * A unique identifier for this tool use.
1381
+ *
1382
+ * This ID is used to match tool results to their corresponding tool uses.
1383
+ */
1384
+ id: string;
1385
+ /**
1386
+ * The name of the tool to call.
1387
+ */
1388
+ name: string;
1389
+ /**
1390
+ * The arguments to pass to the tool, conforming to the tool's input schema.
1391
+ */
1392
+ input: {
1393
+ [key: string]: unknown;
1394
+ };
1395
+ /**
1396
+ * Optional metadata about the tool use. Clients SHOULD preserve this field when
1397
+ * including tool uses in subsequent sampling requests to enable caching optimizations.
1398
+ *
1399
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1400
+ */
1401
+ _meta?: {
1402
+ [key: string]: unknown;
1403
+ };
1404
+ }
1405
+ /**
1406
+ * The result of a tool use, provided by the user back to the assistant.
1407
+ *
1408
+ * @category `sampling/createMessage`
1409
+ */
1410
+ export interface ToolResultContent {
1411
+ type: "tool_result";
1412
+ /**
1413
+ * The ID of the tool use this result corresponds to.
1414
+ *
1415
+ * This MUST match the ID from a previous ToolUseContent.
1416
+ */
1417
+ toolUseId: string;
1418
+ /**
1419
+ * The unstructured result content of the tool use.
1420
+ *
1421
+ * This has the same format as CallToolResult.content and can include text, images,
1422
+ * audio, resource links, and embedded resources.
1423
+ */
1424
+ content: ContentBlock[];
1425
+ /**
1426
+ * An optional structured result object.
1427
+ *
1428
+ * If the tool defined an outputSchema, this SHOULD conform to that schema.
1429
+ */
1430
+ structuredContent?: {
1431
+ [key: string]: unknown;
1432
+ };
1433
+ /**
1434
+ * Whether the tool use resulted in an error.
1435
+ *
1436
+ * If true, the content typically describes the error that occurred.
1437
+ * Default: false
1438
+ */
1439
+ isError?: boolean;
1440
+ /**
1441
+ * Optional metadata about the tool result. Clients SHOULD preserve this field when
1442
+ * including tool results in subsequent sampling requests to enable caching optimizations.
1443
+ *
1444
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1445
+ */
1446
+ _meta?: {
1447
+ [key: string]: unknown;
1448
+ };
1449
+ }
1137
1450
  /**
1138
1451
  * The server's preferences for model selection, requested of the client during sampling.
1139
1452
  *
@@ -1146,6 +1459,8 @@ export interface AudioContent {
1146
1459
  * These preferences are always advisory. The client MAY ignore them. It is also
1147
1460
  * up to the client to decide how to interpret these preferences and how to
1148
1461
  * balance them against other considerations.
1462
+ *
1463
+ * @category `sampling/createMessage`
1149
1464
  */
1150
1465
  export interface ModelPreferences {
1151
1466
  /**
@@ -1194,6 +1509,8 @@ export interface ModelPreferences {
1194
1509
  *
1195
1510
  * Keys not declared here are currently left unspecified by the spec and are up
1196
1511
  * to the client to interpret.
1512
+ *
1513
+ * @category `sampling/createMessage`
1197
1514
  */
1198
1515
  export interface ModelHint {
1199
1516
  /**
@@ -1210,44 +1527,50 @@ export interface ModelHint {
1210
1527
  name?: string;
1211
1528
  }
1212
1529
  /**
1213
- * A request from the client to the server, to ask for completion options.
1530
+ * Parameters for a `completion/complete` request.
1214
1531
  *
1215
- * @category completion/complete
1532
+ * @category `completion/complete`
1216
1533
  */
1217
- export interface CompleteRequest extends JSONRPCRequest {
1218
- method: "completion/complete";
1219
- params: {
1220
- ref: PromptReference | ResourceTemplateReference;
1534
+ export interface CompleteRequestParams extends RequestParams {
1535
+ ref: PromptReference | ResourceTemplateReference;
1536
+ /**
1537
+ * The argument's information
1538
+ */
1539
+ argument: {
1221
1540
  /**
1222
- * The argument's information
1541
+ * The name of the argument
1223
1542
  */
1224
- argument: {
1225
- /**
1226
- * The name of the argument
1227
- */
1228
- name: string;
1229
- /**
1230
- * The value of the argument to use for completion matching.
1231
- */
1232
- value: string;
1233
- };
1543
+ name: string;
1234
1544
  /**
1235
- * Additional, optional context for completions
1545
+ * The value of the argument to use for completion matching.
1236
1546
  */
1237
- context?: {
1238
- /**
1239
- * Previously-resolved variables in a URI template or prompt.
1240
- */
1241
- arguments?: {
1242
- [key: string]: string;
1243
- };
1547
+ value: string;
1548
+ };
1549
+ /**
1550
+ * Additional, optional context for completions
1551
+ */
1552
+ context?: {
1553
+ /**
1554
+ * Previously-resolved variables in a URI template or prompt.
1555
+ */
1556
+ arguments?: {
1557
+ [key: string]: string;
1244
1558
  };
1245
1559
  };
1246
1560
  }
1561
+ /**
1562
+ * A request from the client to the server, to ask for completion options.
1563
+ *
1564
+ * @category `completion/complete`
1565
+ */
1566
+ export interface CompleteRequest extends JSONRPCRequest {
1567
+ method: "completion/complete";
1568
+ params: CompleteRequestParams;
1569
+ }
1247
1570
  /**
1248
1571
  * The server's response to a completion/complete request
1249
1572
  *
1250
- * @category completion/complete
1573
+ * @category `completion/complete`
1251
1574
  */
1252
1575
  export interface CompleteResult extends Result {
1253
1576
  completion: {
@@ -1267,6 +1590,8 @@ export interface CompleteResult extends Result {
1267
1590
  }
1268
1591
  /**
1269
1592
  * A reference to a resource or resource template definition.
1593
+ *
1594
+ * @category `completion/complete`
1270
1595
  */
1271
1596
  export interface ResourceTemplateReference {
1272
1597
  type: "ref/resource";
@@ -1279,6 +1604,8 @@ export interface ResourceTemplateReference {
1279
1604
  }
1280
1605
  /**
1281
1606
  * Identifies a prompt.
1607
+ *
1608
+ * @category `completion/complete`
1282
1609
  */
1283
1610
  export interface PromptReference extends BaseMetadata {
1284
1611
  type: "ref/prompt";
@@ -1292,23 +1619,26 @@ export interface PromptReference extends BaseMetadata {
1292
1619
  * This request is typically used when the server needs to understand the file system
1293
1620
  * structure or access specific locations that the client has permission to read from.
1294
1621
  *
1295
- * @category roots/list
1622
+ * @category `roots/list`
1296
1623
  */
1297
1624
  export interface ListRootsRequest extends JSONRPCRequest {
1298
1625
  method: "roots/list";
1626
+ params?: RequestParams;
1299
1627
  }
1300
1628
  /**
1301
1629
  * The client's response to a roots/list request from the server.
1302
1630
  * This result contains an array of Root objects, each representing a root directory
1303
1631
  * or file that the server can operate on.
1304
1632
  *
1305
- * @category roots/list
1633
+ * @category `roots/list`
1306
1634
  */
1307
1635
  export interface ListRootsResult extends Result {
1308
1636
  roots: Root[];
1309
1637
  }
1310
1638
  /**
1311
1639
  * Represents a root directory or file that the server can operate on.
1640
+ *
1641
+ * @category `roots/list`
1312
1642
  */
1313
1643
  export interface Root {
1314
1644
  /**
@@ -1337,41 +1667,89 @@ export interface Root {
1337
1667
  * This notification should be sent whenever the client adds, removes, or modifies any root.
1338
1668
  * The server should then request an updated list of roots using the ListRootsRequest.
1339
1669
  *
1340
- * @category notifications/roots/list_changed
1670
+ * @category `notifications/roots/list_changed`
1341
1671
  */
1342
1672
  export interface RootsListChangedNotification extends JSONRPCNotification {
1343
1673
  method: "notifications/roots/list_changed";
1674
+ params?: NotificationParams;
1344
1675
  }
1676
+ /**
1677
+ * The parameters for a request to elicit non-sensitive information from the user via a form in the client.
1678
+ *
1679
+ * @category `elicitation/create`
1680
+ */
1681
+ export interface ElicitRequestFormParams extends RequestParams {
1682
+ /**
1683
+ * The elicitation mode.
1684
+ */
1685
+ mode: "form";
1686
+ /**
1687
+ * The message to present to the user describing what information is being requested.
1688
+ */
1689
+ message: string;
1690
+ /**
1691
+ * A restricted subset of JSON Schema.
1692
+ * Only top-level properties are allowed, without nesting.
1693
+ */
1694
+ requestedSchema: {
1695
+ type: "object";
1696
+ properties: {
1697
+ [key: string]: PrimitiveSchemaDefinition;
1698
+ };
1699
+ required?: string[];
1700
+ };
1701
+ }
1702
+ /**
1703
+ * The parameters for a request to elicit information from the user via a URL in the client.
1704
+ *
1705
+ * @category `elicitation/create`
1706
+ */
1707
+ export interface ElicitRequestURLParams extends RequestParams {
1708
+ /**
1709
+ * The elicitation mode.
1710
+ */
1711
+ mode: "url";
1712
+ /**
1713
+ * The message to present to the user explaining why the interaction is needed.
1714
+ */
1715
+ message: string;
1716
+ /**
1717
+ * The ID of the elicitation, which must be unique within the context of the server.
1718
+ * The client MUST treat this ID as an opaque value.
1719
+ */
1720
+ elicitationId: string;
1721
+ /**
1722
+ * The URL that the user should navigate to.
1723
+ *
1724
+ * @format uri
1725
+ */
1726
+ url: string;
1727
+ }
1728
+ /**
1729
+ * The parameters for a request to elicit additional information from the user via the client.
1730
+ *
1731
+ * @category `elicitation/create`
1732
+ */
1733
+ export type ElicitRequestParams = ElicitRequestFormParams | ElicitRequestURLParams;
1345
1734
  /**
1346
1735
  * A request from the server to elicit additional information from the user via the client.
1347
1736
  *
1348
- * @category elicitation/create
1737
+ * @category `elicitation/create`
1349
1738
  */
1350
1739
  export interface ElicitRequest extends JSONRPCRequest {
1351
1740
  method: "elicitation/create";
1352
- params: {
1353
- /**
1354
- * The message to present to the user.
1355
- */
1356
- message: string;
1357
- /**
1358
- * A restricted subset of JSON Schema.
1359
- * Only top-level properties are allowed, without nesting.
1360
- */
1361
- requestedSchema: {
1362
- type: "object";
1363
- properties: {
1364
- [key: string]: PrimitiveSchemaDefinition;
1365
- };
1366
- required?: string[];
1367
- };
1368
- };
1741
+ params: ElicitRequestParams;
1369
1742
  }
1370
1743
  /**
1371
1744
  * Restricted schema definitions that only allow primitive types
1372
1745
  * without nested objects or arrays.
1746
+ *
1747
+ * @category `elicitation/create`
1373
1748
  */
1374
1749
  export type PrimitiveSchemaDefinition = StringSchema | NumberSchema | BooleanSchema | EnumSchema;
1750
+ /**
1751
+ * @category `elicitation/create`
1752
+ */
1375
1753
  export interface StringSchema {
1376
1754
  type: "string";
1377
1755
  title?: string;
@@ -1381,6 +1759,9 @@ export interface StringSchema {
1381
1759
  format?: "email" | "uri" | "date" | "date-time";
1382
1760
  default?: string;
1383
1761
  }
1762
+ /**
1763
+ * @category `elicitation/create`
1764
+ */
1384
1765
  export interface NumberSchema {
1385
1766
  type: "number" | "integer";
1386
1767
  title?: string;
@@ -1389,24 +1770,190 @@ export interface NumberSchema {
1389
1770
  maximum?: number;
1390
1771
  default?: number;
1391
1772
  }
1773
+ /**
1774
+ * @category `elicitation/create`
1775
+ */
1392
1776
  export interface BooleanSchema {
1393
1777
  type: "boolean";
1394
1778
  title?: string;
1395
1779
  description?: string;
1396
1780
  default?: boolean;
1397
1781
  }
1398
- export interface EnumSchema {
1782
+ /**
1783
+ * Schema for single-selection enumeration without display titles for options.
1784
+ *
1785
+ * @category `elicitation/create`
1786
+ */
1787
+ export interface UntitledSingleSelectEnumSchema {
1399
1788
  type: "string";
1789
+ /**
1790
+ * Optional title for the enum field.
1791
+ */
1400
1792
  title?: string;
1793
+ /**
1794
+ * Optional description for the enum field.
1795
+ */
1401
1796
  description?: string;
1797
+ /**
1798
+ * Array of enum values to choose from.
1799
+ */
1402
1800
  enum: string[];
1801
+ /**
1802
+ * Optional default value.
1803
+ */
1804
+ default?: string;
1805
+ }
1806
+ /**
1807
+ * Schema for single-selection enumeration with display titles for each option.
1808
+ *
1809
+ * @category `elicitation/create`
1810
+ */
1811
+ export interface TitledSingleSelectEnumSchema {
1812
+ type: "string";
1813
+ /**
1814
+ * Optional title for the enum field.
1815
+ */
1816
+ title?: string;
1817
+ /**
1818
+ * Optional description for the enum field.
1819
+ */
1820
+ description?: string;
1821
+ /**
1822
+ * Array of enum options with values and display labels.
1823
+ */
1824
+ oneOf: Array<{
1825
+ /**
1826
+ * The enum value.
1827
+ */
1828
+ const: string;
1829
+ /**
1830
+ * Display label for this option.
1831
+ */
1832
+ title: string;
1833
+ }>;
1834
+ /**
1835
+ * Optional default value.
1836
+ */
1837
+ default?: string;
1838
+ }
1839
+ /**
1840
+ * @category `elicitation/create`
1841
+ */
1842
+ export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema;
1843
+ /**
1844
+ * Schema for multiple-selection enumeration without display titles for options.
1845
+ *
1846
+ * @category `elicitation/create`
1847
+ */
1848
+ export interface UntitledMultiSelectEnumSchema {
1849
+ type: "array";
1850
+ /**
1851
+ * Optional title for the enum field.
1852
+ */
1853
+ title?: string;
1854
+ /**
1855
+ * Optional description for the enum field.
1856
+ */
1857
+ description?: string;
1858
+ /**
1859
+ * Minimum number of items to select.
1860
+ */
1861
+ minItems?: number;
1862
+ /**
1863
+ * Maximum number of items to select.
1864
+ */
1865
+ maxItems?: number;
1866
+ /**
1867
+ * Schema for the array items.
1868
+ */
1869
+ items: {
1870
+ type: "string";
1871
+ /**
1872
+ * Array of enum values to choose from.
1873
+ */
1874
+ enum: string[];
1875
+ };
1876
+ /**
1877
+ * Optional default value.
1878
+ */
1879
+ default?: string[];
1880
+ }
1881
+ /**
1882
+ * Schema for multiple-selection enumeration with display titles for each option.
1883
+ *
1884
+ * @category `elicitation/create`
1885
+ */
1886
+ export interface TitledMultiSelectEnumSchema {
1887
+ type: "array";
1888
+ /**
1889
+ * Optional title for the enum field.
1890
+ */
1891
+ title?: string;
1892
+ /**
1893
+ * Optional description for the enum field.
1894
+ */
1895
+ description?: string;
1896
+ /**
1897
+ * Minimum number of items to select.
1898
+ */
1899
+ minItems?: number;
1900
+ /**
1901
+ * Maximum number of items to select.
1902
+ */
1903
+ maxItems?: number;
1904
+ /**
1905
+ * Schema for array items with enum options and display labels.
1906
+ */
1907
+ items: {
1908
+ /**
1909
+ * Array of enum options with values and display labels.
1910
+ */
1911
+ anyOf: Array<{
1912
+ /**
1913
+ * The constant enum value.
1914
+ */
1915
+ const: string;
1916
+ /**
1917
+ * Display title for this option.
1918
+ */
1919
+ title: string;
1920
+ }>;
1921
+ };
1922
+ /**
1923
+ * Optional default value.
1924
+ */
1925
+ default?: string[];
1926
+ }
1927
+ /**
1928
+ * @category `elicitation/create`
1929
+ */
1930
+ export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema;
1931
+ /**
1932
+ * Use TitledSingleSelectEnumSchema instead.
1933
+ * This interface will be removed in a future version.
1934
+ *
1935
+ * @category `elicitation/create`
1936
+ */
1937
+ export interface LegacyTitledEnumSchema {
1938
+ type: "string";
1939
+ title?: string;
1940
+ description?: string;
1941
+ enum: string[];
1942
+ /**
1943
+ * (Legacy) Display names for enum values.
1944
+ * Non-standard according to JSON schema 2020-12.
1945
+ */
1403
1946
  enumNames?: string[];
1404
1947
  default?: string;
1405
1948
  }
1949
+ /**
1950
+ * @category `elicitation/create`
1951
+ */
1952
+ export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema;
1406
1953
  /**
1407
1954
  * The client's response to an elicitation request.
1408
1955
  *
1409
- * @category elicitation/create
1956
+ * @category `elicitation/create`
1410
1957
  */
1411
1958
  export interface ElicitResult extends Result {
1412
1959
  /**
@@ -1417,11 +1964,26 @@ export interface ElicitResult extends Result {
1417
1964
  */
1418
1965
  action: "accept" | "decline" | "cancel";
1419
1966
  /**
1420
- * The submitted form data, only present when action is "accept".
1967
+ * The submitted form data, only present when action is "accept" and mode was "form".
1421
1968
  * Contains values matching the requested schema.
1969
+ * Omitted for out-of-band mode responses.
1422
1970
  */
1423
1971
  content?: {
1424
- [key: string]: string | number | boolean;
1972
+ [key: string]: string | number | boolean | string[];
1973
+ };
1974
+ }
1975
+ /**
1976
+ * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
1977
+ *
1978
+ * @category `notifications/elicitation/complete`
1979
+ */
1980
+ export interface ElicitationCompleteNotification extends JSONRPCNotification {
1981
+ method: "notifications/elicitation/complete";
1982
+ params: {
1983
+ /**
1984
+ * The ID of the elicitation that completed.
1985
+ */
1986
+ elicitationId: string;
1425
1987
  };
1426
1988
  }
1427
1989
  /** @internal */
@@ -1433,7 +1995,7 @@ export type ClientResult = EmptyResult | CreateMessageResult | ListRootsResult |
1433
1995
  /** @internal */
1434
1996
  export type ServerRequest = PingRequest | CreateMessageRequest | ListRootsRequest | ElicitRequest;
1435
1997
  /** @internal */
1436
- export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification;
1998
+ export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification | ElicitationCompleteNotification;
1437
1999
  /** @internal */
1438
2000
  export type ServerResult = EmptyResult | InitializeResult | CompleteResult | GetPromptResult | ListPromptsResult | ListResourceTemplatesResult | ListResourcesResult | ReadResourceResult | CallToolResult | ListToolsResult;
1439
2001
  //# sourceMappingURL=spec.types.d.ts.map