@modelcontextprotocol/sdk 1.22.0 → 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 (226) 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 +120 -661
  7. package/dist/cjs/client/index.d.ts.map +1 -1
  8. package/dist/cjs/client/index.js +71 -15
  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 +10 -5
  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} +14 -8
  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 +192 -50
  72. package/dist/cjs/server/index.d.ts.map +1 -1
  73. package/dist/cjs/server/index.js +58 -13
  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 +83 -40
  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/protocol.d.ts +5 -9
  92. package/dist/cjs/shared/protocol.d.ts.map +1 -1
  93. package/dist/cjs/shared/protocol.js +24 -10
  94. package/dist/cjs/shared/protocol.js.map +1 -1
  95. package/dist/cjs/shared/transport.d.ts +14 -0
  96. package/dist/cjs/shared/transport.d.ts.map +1 -1
  97. package/dist/cjs/shared/transport.js +40 -0
  98. package/dist/cjs/shared/transport.js.map +1 -1
  99. package/dist/cjs/shared/zodTestMatrix.d.ts +16 -0
  100. package/dist/cjs/shared/zodTestMatrix.d.ts.map +1 -0
  101. package/dist/cjs/shared/zodTestMatrix.js +43 -0
  102. package/dist/cjs/shared/zodTestMatrix.js.map +1 -0
  103. package/dist/cjs/spec.types.d.ts +383 -69
  104. package/dist/cjs/spec.types.d.ts.map +1 -1
  105. package/dist/cjs/spec.types.js +5 -7
  106. package/dist/cjs/spec.types.js.map +1 -1
  107. package/dist/cjs/types.d.ts +3584 -23864
  108. package/dist/cjs/types.d.ts.map +1 -1
  109. package/dist/cjs/types.js +564 -336
  110. package/dist/cjs/types.js.map +1 -1
  111. package/dist/esm/client/auth.d.ts +11 -1
  112. package/dist/esm/client/auth.d.ts.map +1 -1
  113. package/dist/esm/client/auth.js +71 -20
  114. package/dist/esm/client/auth.js.map +1 -1
  115. package/dist/esm/client/index.d.ts +120 -661
  116. package/dist/esm/client/index.d.ts.map +1 -1
  117. package/dist/esm/client/index.js +70 -15
  118. package/dist/esm/client/index.js.map +1 -1
  119. package/dist/esm/client/sse.d.ts +1 -0
  120. package/dist/esm/client/sse.d.ts.map +1 -1
  121. package/dist/esm/client/sse.js +5 -3
  122. package/dist/esm/client/sse.js.map +1 -1
  123. package/dist/esm/client/streamableHttp.d.ts +2 -1
  124. package/dist/esm/client/streamableHttp.d.ts.map +1 -1
  125. package/dist/esm/client/streamableHttp.js +35 -15
  126. package/dist/esm/client/streamableHttp.js.map +1 -1
  127. package/dist/esm/examples/client/elicitationUrlExample.d.ts +2 -0
  128. package/dist/esm/examples/client/elicitationUrlExample.d.ts.map +1 -0
  129. package/dist/esm/examples/client/elicitationUrlExample.js +691 -0
  130. package/dist/esm/examples/client/elicitationUrlExample.js.map +1 -0
  131. package/dist/esm/examples/client/simpleOAuthClient.js +12 -51
  132. package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -1
  133. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts +26 -0
  134. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts.map +1 -0
  135. package/dist/esm/examples/client/simpleOAuthClientProvider.js +47 -0
  136. package/dist/esm/examples/client/simpleOAuthClientProvider.js.map +1 -0
  137. package/dist/esm/examples/client/simpleStreamableHttp.js +11 -6
  138. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
  139. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +4 -4
  140. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  141. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js +16 -0
  142. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  143. package/dist/esm/examples/server/elicitationFormExample.d.ts +2 -0
  144. package/dist/esm/examples/server/elicitationFormExample.d.ts.map +1 -0
  145. package/dist/esm/examples/server/{elicitationExample.js → elicitationFormExample.js} +14 -8
  146. package/dist/esm/examples/server/elicitationFormExample.js.map +1 -0
  147. package/dist/esm/examples/server/elicitationUrlExample.d.ts +2 -0
  148. package/dist/esm/examples/server/elicitationUrlExample.d.ts.map +1 -0
  149. package/dist/esm/examples/server/elicitationUrlExample.js +650 -0
  150. package/dist/esm/examples/server/elicitationUrlExample.js.map +1 -0
  151. package/dist/esm/examples/server/jsonResponseStreamableHttp.js +1 -1
  152. package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  153. package/dist/esm/examples/server/mcpServerOutputSchema.js +1 -1
  154. package/dist/esm/examples/server/mcpServerOutputSchema.js.map +1 -1
  155. package/dist/esm/examples/server/simpleSseServer.js +1 -1
  156. package/dist/esm/examples/server/simpleSseServer.js.map +1 -1
  157. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +1 -1
  158. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  159. package/dist/esm/examples/server/simpleStreamableHttp.js +4 -3
  160. package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  161. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +1 -1
  162. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  163. package/dist/esm/examples/server/toolWithSampleServer.js +6 -7
  164. package/dist/esm/examples/server/toolWithSampleServer.js.map +1 -1
  165. package/dist/esm/server/auth/handlers/authorize.js +1 -1
  166. package/dist/esm/server/auth/handlers/authorize.js.map +1 -1
  167. package/dist/esm/server/auth/handlers/token.js +1 -1
  168. package/dist/esm/server/auth/handlers/token.js.map +1 -1
  169. package/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  170. package/dist/esm/server/auth/middleware/bearerAuth.js +13 -8
  171. package/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  172. package/dist/esm/server/auth/middleware/clientAuth.js +1 -1
  173. package/dist/esm/server/auth/middleware/clientAuth.js.map +1 -1
  174. package/dist/esm/server/auth/router.js +1 -1
  175. package/dist/esm/server/auth/router.js.map +1 -1
  176. package/dist/esm/server/completable.d.ts +30 -16
  177. package/dist/esm/server/completable.d.ts.map +1 -1
  178. package/dist/esm/server/completable.js +34 -53
  179. package/dist/esm/server/completable.js.map +1 -1
  180. package/dist/esm/server/index.d.ts +192 -50
  181. package/dist/esm/server/index.d.ts.map +1 -1
  182. package/dist/esm/server/index.js +58 -13
  183. package/dist/esm/server/index.js.map +1 -1
  184. package/dist/esm/server/mcp.d.ts +14 -16
  185. package/dist/esm/server/mcp.d.ts.map +1 -1
  186. package/dist/esm/server/mcp.js +84 -41
  187. package/dist/esm/server/mcp.js.map +1 -1
  188. package/dist/esm/server/zod-compat.d.ts +82 -0
  189. package/dist/esm/server/zod-compat.d.ts.map +1 -0
  190. package/dist/esm/server/zod-compat.js +217 -0
  191. package/dist/esm/server/zod-compat.js.map +1 -0
  192. package/dist/esm/server/zod-json-schema-compat.d.ts +12 -0
  193. package/dist/esm/server/zod-json-schema-compat.d.ts.map +1 -0
  194. package/dist/esm/server/zod-json-schema-compat.js +52 -0
  195. package/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  196. package/dist/esm/shared/auth.d.ts +116 -502
  197. package/dist/esm/shared/auth.d.ts.map +1 -1
  198. package/dist/esm/shared/auth.js +17 -19
  199. package/dist/esm/shared/auth.js.map +1 -1
  200. package/dist/esm/shared/protocol.d.ts +5 -9
  201. package/dist/esm/shared/protocol.d.ts.map +1 -1
  202. package/dist/esm/shared/protocol.js +24 -10
  203. package/dist/esm/shared/protocol.js.map +1 -1
  204. package/dist/esm/shared/transport.d.ts +14 -0
  205. package/dist/esm/shared/transport.d.ts.map +1 -1
  206. package/dist/esm/shared/transport.js +38 -1
  207. package/dist/esm/shared/transport.js.map +1 -1
  208. package/dist/esm/shared/zodTestMatrix.d.ts +16 -0
  209. package/dist/esm/shared/zodTestMatrix.d.ts.map +1 -0
  210. package/dist/esm/shared/zodTestMatrix.js +17 -0
  211. package/dist/esm/shared/zodTestMatrix.js.map +1 -0
  212. package/dist/esm/spec.types.d.ts +383 -69
  213. package/dist/esm/spec.types.d.ts.map +1 -1
  214. package/dist/esm/spec.types.js +4 -6
  215. package/dist/esm/spec.types.js.map +1 -1
  216. package/dist/esm/types.d.ts +3584 -23864
  217. package/dist/esm/types.d.ts.map +1 -1
  218. package/dist/esm/types.js +268 -64
  219. package/dist/esm/types.js.map +1 -1
  220. package/package.json +13 -12
  221. package/dist/cjs/examples/server/elicitationExample.d.ts +0 -2
  222. package/dist/cjs/examples/server/elicitationExample.d.ts.map +0 -1
  223. package/dist/cjs/examples/server/elicitationExample.js.map +0 -1
  224. package/dist/esm/examples/server/elicitationExample.d.ts +0 -2
  225. package/dist/esm/examples/server/elicitationExample.d.ts.map +0 -1
  226. 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: 11ad2a720d8e2f54881235f734121db0bda39052
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,14 +20,20 @@ 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;
29
33
  /**
30
34
  * Common params for any request.
35
+ *
36
+ * @internal
31
37
  */
32
38
  export interface RequestParams {
33
39
  /**
@@ -64,6 +70,9 @@ export interface Notification {
64
70
  [key: string]: any;
65
71
  };
66
72
  }
73
+ /**
74
+ * @category Common Types
75
+ */
67
76
  export interface Result {
68
77
  /**
69
78
  * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
@@ -73,6 +82,9 @@ export interface Result {
73
82
  };
74
83
  [key: string]: unknown;
75
84
  }
85
+ /**
86
+ * @category Common Types
87
+ */
76
88
  export interface Error {
77
89
  /**
78
90
  * The error type that occurred.
@@ -89,10 +101,14 @@ export interface Error {
89
101
  }
90
102
  /**
91
103
  * A uniquely identifying ID for a request in JSON-RPC.
104
+ *
105
+ * @category Common Types
92
106
  */
93
107
  export type RequestId = string | number;
94
108
  /**
95
109
  * A request that expects a response.
110
+ *
111
+ * @category JSON-RPC
96
112
  */
97
113
  export interface JSONRPCRequest extends Request {
98
114
  jsonrpc: typeof JSONRPC_VERSION;
@@ -100,44 +116,63 @@ export interface JSONRPCRequest extends Request {
100
116
  }
101
117
  /**
102
118
  * A notification which does not expect a response.
119
+ *
120
+ * @category JSON-RPC
103
121
  */
104
122
  export interface JSONRPCNotification extends Notification {
105
123
  jsonrpc: typeof JSONRPC_VERSION;
106
124
  }
107
125
  /**
108
126
  * A successful (non-error) response to a request.
127
+ *
128
+ * @category JSON-RPC
109
129
  */
110
130
  export interface JSONRPCResponse {
111
131
  jsonrpc: typeof JSONRPC_VERSION;
112
132
  id: RequestId;
113
133
  result: Result;
114
134
  }
115
- /** @internal */
116
135
  export declare const PARSE_ERROR = -32700;
117
- /** @internal */
118
136
  export declare const INVALID_REQUEST = -32600;
119
- /** @internal */
120
137
  export declare const METHOD_NOT_FOUND = -32601;
121
- /** @internal */
122
138
  export declare const INVALID_PARAMS = -32602;
123
- /** @internal */
124
139
  export declare const INTERNAL_ERROR = -32603;
140
+ /** @internal */
141
+ export declare const URL_ELICITATION_REQUIRED = -32042;
125
142
  /**
126
143
  * A response to a request that indicates an error occurred.
144
+ *
145
+ * @category JSON-RPC
127
146
  */
128
147
  export interface JSONRPCError {
129
148
  jsonrpc: typeof JSONRPC_VERSION;
130
149
  id: RequestId;
131
150
  error: Error;
132
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
+ }
133
166
  /**
134
167
  * A response that indicates success but carries no data.
168
+ *
169
+ * @category Common Types
135
170
  */
136
171
  export type EmptyResult = Result;
137
172
  /**
138
173
  * Parameters for a `notifications/cancelled` notification.
139
174
  *
140
- * @category notifications/cancelled
175
+ * @category `notifications/cancelled`
141
176
  */
142
177
  export interface CancelledNotificationParams extends NotificationParams {
143
178
  /**
@@ -160,7 +195,7 @@ export interface CancelledNotificationParams extends NotificationParams {
160
195
  *
161
196
  * A client MUST NOT attempt to cancel its `initialize` request.
162
197
  *
163
- * @category notifications/cancelled
198
+ * @category `notifications/cancelled`
164
199
  */
165
200
  export interface CancelledNotification extends JSONRPCNotification {
166
201
  method: "notifications/cancelled";
@@ -169,7 +204,7 @@ export interface CancelledNotification extends JSONRPCNotification {
169
204
  /**
170
205
  * Parameters for an `initialize` request.
171
206
  *
172
- * @category initialize
207
+ * @category `initialize`
173
208
  */
174
209
  export interface InitializeRequestParams extends RequestParams {
175
210
  /**
@@ -182,7 +217,7 @@ export interface InitializeRequestParams extends RequestParams {
182
217
  /**
183
218
  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
184
219
  *
185
- * @category initialize
220
+ * @category `initialize`
186
221
  */
187
222
  export interface InitializeRequest extends JSONRPCRequest {
188
223
  method: "initialize";
@@ -191,7 +226,7 @@ export interface InitializeRequest extends JSONRPCRequest {
191
226
  /**
192
227
  * After receiving an initialize request from the client, the server sends this response.
193
228
  *
194
- * @category initialize
229
+ * @category `initialize`
195
230
  */
196
231
  export interface InitializeResult extends Result {
197
232
  /**
@@ -210,7 +245,7 @@ export interface InitializeResult extends Result {
210
245
  /**
211
246
  * This notification is sent from the client to the server after initialization has finished.
212
247
  *
213
- * @category notifications/initialized
248
+ * @category `notifications/initialized`
214
249
  */
215
250
  export interface InitializedNotification extends JSONRPCNotification {
216
251
  method: "notifications/initialized";
@@ -218,6 +253,8 @@ export interface InitializedNotification extends JSONRPCNotification {
218
253
  }
219
254
  /**
220
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`
221
258
  */
222
259
  export interface ClientCapabilities {
223
260
  /**
@@ -238,14 +275,29 @@ export interface ClientCapabilities {
238
275
  /**
239
276
  * Present if the client supports sampling from an LLM.
240
277
  */
241
- 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
+ };
242
289
  /**
243
290
  * Present if the client supports elicitation from the server.
244
291
  */
245
- elicitation?: object;
292
+ elicitation?: {
293
+ form?: object;
294
+ url?: object;
295
+ };
246
296
  }
247
297
  /**
248
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`
249
301
  */
250
302
  export interface ServerCapabilities {
251
303
  /**
@@ -296,6 +348,8 @@ export interface ServerCapabilities {
296
348
  }
297
349
  /**
298
350
  * An optionally-sized icon that can be displayed in a user interface.
351
+ *
352
+ * @category Common Types
299
353
  */
300
354
  export interface Icon {
301
355
  /**
@@ -372,7 +426,9 @@ export interface BaseMetadata {
372
426
  title?: string;
373
427
  }
374
428
  /**
375
- * Describes the MCP implementation
429
+ * Describes the MCP implementation.
430
+ *
431
+ * @category `initialize`
376
432
  */
377
433
  export interface Implementation extends BaseMetadata, Icons {
378
434
  version: string;
@@ -386,7 +442,7 @@ export interface Implementation extends BaseMetadata, Icons {
386
442
  /**
387
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.
388
444
  *
389
- * @category ping
445
+ * @category `ping`
390
446
  */
391
447
  export interface PingRequest extends JSONRPCRequest {
392
448
  method: "ping";
@@ -395,7 +451,7 @@ export interface PingRequest extends JSONRPCRequest {
395
451
  /**
396
452
  * Parameters for a `notifications/progress` notification.
397
453
  *
398
- * @category notifications/progress
454
+ * @category `notifications/progress`
399
455
  */
400
456
  export interface ProgressNotificationParams extends NotificationParams {
401
457
  /**
@@ -422,7 +478,7 @@ export interface ProgressNotificationParams extends NotificationParams {
422
478
  /**
423
479
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
424
480
  *
425
- * @category notifications/progress
481
+ * @category `notifications/progress`
426
482
  */
427
483
  export interface ProgressNotification extends JSONRPCNotification {
428
484
  method: "notifications/progress";
@@ -430,6 +486,8 @@ export interface ProgressNotification extends JSONRPCNotification {
430
486
  }
431
487
  /**
432
488
  * Common parameters for paginated requests.
489
+ *
490
+ * @internal
433
491
  */
434
492
  export interface PaginatedRequestParams extends RequestParams {
435
493
  /**
@@ -453,7 +511,7 @@ export interface PaginatedResult extends Result {
453
511
  /**
454
512
  * Sent from the client to request a list of resources the server has.
455
513
  *
456
- * @category resources/list
514
+ * @category `resources/list`
457
515
  */
458
516
  export interface ListResourcesRequest extends PaginatedRequest {
459
517
  method: "resources/list";
@@ -461,7 +519,7 @@ export interface ListResourcesRequest extends PaginatedRequest {
461
519
  /**
462
520
  * The server's response to a resources/list request from the client.
463
521
  *
464
- * @category resources/list
522
+ * @category `resources/list`
465
523
  */
466
524
  export interface ListResourcesResult extends PaginatedResult {
467
525
  resources: Resource[];
@@ -469,7 +527,7 @@ export interface ListResourcesResult extends PaginatedResult {
469
527
  /**
470
528
  * Sent from the client to request a list of resource templates the server has.
471
529
  *
472
- * @category resources/templates/list
530
+ * @category `resources/templates/list`
473
531
  */
474
532
  export interface ListResourceTemplatesRequest extends PaginatedRequest {
475
533
  method: "resources/templates/list";
@@ -477,7 +535,7 @@ export interface ListResourceTemplatesRequest extends PaginatedRequest {
477
535
  /**
478
536
  * The server's response to a resources/templates/list request from the client.
479
537
  *
480
- * @category resources/templates/list
538
+ * @category `resources/templates/list`
481
539
  */
482
540
  export interface ListResourceTemplatesResult extends PaginatedResult {
483
541
  resourceTemplates: ResourceTemplate[];
@@ -498,14 +556,14 @@ export interface ResourceRequestParams extends RequestParams {
498
556
  /**
499
557
  * Parameters for a `resources/read` request.
500
558
  *
501
- * @category resources/read
559
+ * @category `resources/read`
502
560
  */
503
561
  export interface ReadResourceRequestParams extends ResourceRequestParams {
504
562
  }
505
563
  /**
506
564
  * Sent from the client to the server, to read a specific resource URI.
507
565
  *
508
- * @category resources/read
566
+ * @category `resources/read`
509
567
  */
510
568
  export interface ReadResourceRequest extends JSONRPCRequest {
511
569
  method: "resources/read";
@@ -514,7 +572,7 @@ export interface ReadResourceRequest extends JSONRPCRequest {
514
572
  /**
515
573
  * The server's response to a resources/read request from the client.
516
574
  *
517
- * @category resources/read
575
+ * @category `resources/read`
518
576
  */
519
577
  export interface ReadResourceResult extends Result {
520
578
  contents: (TextResourceContents | BlobResourceContents)[];
@@ -522,7 +580,7 @@ export interface ReadResourceResult extends Result {
522
580
  /**
523
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.
524
582
  *
525
- * @category notifications/resources/list_changed
583
+ * @category `notifications/resources/list_changed`
526
584
  */
527
585
  export interface ResourceListChangedNotification extends JSONRPCNotification {
528
586
  method: "notifications/resources/list_changed";
@@ -531,14 +589,14 @@ export interface ResourceListChangedNotification extends JSONRPCNotification {
531
589
  /**
532
590
  * Parameters for a `resources/subscribe` request.
533
591
  *
534
- * @category resources/subscribe
592
+ * @category `resources/subscribe`
535
593
  */
536
594
  export interface SubscribeRequestParams extends ResourceRequestParams {
537
595
  }
538
596
  /**
539
597
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
540
598
  *
541
- * @category resources/subscribe
599
+ * @category `resources/subscribe`
542
600
  */
543
601
  export interface SubscribeRequest extends JSONRPCRequest {
544
602
  method: "resources/subscribe";
@@ -547,14 +605,14 @@ export interface SubscribeRequest extends JSONRPCRequest {
547
605
  /**
548
606
  * Parameters for a `resources/unsubscribe` request.
549
607
  *
550
- * @category resources/unsubscribe
608
+ * @category `resources/unsubscribe`
551
609
  */
552
610
  export interface UnsubscribeRequestParams extends ResourceRequestParams {
553
611
  }
554
612
  /**
555
613
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
556
614
  *
557
- * @category resources/unsubscribe
615
+ * @category `resources/unsubscribe`
558
616
  */
559
617
  export interface UnsubscribeRequest extends JSONRPCRequest {
560
618
  method: "resources/unsubscribe";
@@ -563,7 +621,7 @@ export interface UnsubscribeRequest extends JSONRPCRequest {
563
621
  /**
564
622
  * Parameters for a `notifications/resources/updated` notification.
565
623
  *
566
- * @category notifications/resources/updated
624
+ * @category `notifications/resources/updated`
567
625
  */
568
626
  export interface ResourceUpdatedNotificationParams extends NotificationParams {
569
627
  /**
@@ -576,7 +634,7 @@ export interface ResourceUpdatedNotificationParams extends NotificationParams {
576
634
  /**
577
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.
578
636
  *
579
- * @category notifications/resources/updated
637
+ * @category `notifications/resources/updated`
580
638
  */
581
639
  export interface ResourceUpdatedNotification extends JSONRPCNotification {
582
640
  method: "notifications/resources/updated";
@@ -584,6 +642,8 @@ export interface ResourceUpdatedNotification extends JSONRPCNotification {
584
642
  }
585
643
  /**
586
644
  * A known resource that the server is capable of reading.
645
+ *
646
+ * @category `resources/list`
587
647
  */
588
648
  export interface Resource extends BaseMetadata, Icons {
589
649
  /**
@@ -621,6 +681,8 @@ export interface Resource extends BaseMetadata, Icons {
621
681
  }
622
682
  /**
623
683
  * A template description for resources available on the server.
684
+ *
685
+ * @category `resources/templates/list`
624
686
  */
625
687
  export interface ResourceTemplate extends BaseMetadata, Icons {
626
688
  /**
@@ -652,6 +714,8 @@ export interface ResourceTemplate extends BaseMetadata, Icons {
652
714
  }
653
715
  /**
654
716
  * The contents of a specific resource or sub-resource.
717
+ *
718
+ * @internal
655
719
  */
656
720
  export interface ResourceContents {
657
721
  /**
@@ -671,12 +735,18 @@ export interface ResourceContents {
671
735
  [key: string]: unknown;
672
736
  };
673
737
  }
738
+ /**
739
+ * @category Content
740
+ */
674
741
  export interface TextResourceContents extends ResourceContents {
675
742
  /**
676
743
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
677
744
  */
678
745
  text: string;
679
746
  }
747
+ /**
748
+ * @category Content
749
+ */
680
750
  export interface BlobResourceContents extends ResourceContents {
681
751
  /**
682
752
  * A base64-encoded string representing the binary data of the item.
@@ -688,7 +758,7 @@ export interface BlobResourceContents extends ResourceContents {
688
758
  /**
689
759
  * Sent from the client to request a list of prompts and prompt templates the server has.
690
760
  *
691
- * @category prompts/list
761
+ * @category `prompts/list`
692
762
  */
693
763
  export interface ListPromptsRequest extends PaginatedRequest {
694
764
  method: "prompts/list";
@@ -696,7 +766,7 @@ export interface ListPromptsRequest extends PaginatedRequest {
696
766
  /**
697
767
  * The server's response to a prompts/list request from the client.
698
768
  *
699
- * @category prompts/list
769
+ * @category `prompts/list`
700
770
  */
701
771
  export interface ListPromptsResult extends PaginatedResult {
702
772
  prompts: Prompt[];
@@ -704,7 +774,7 @@ export interface ListPromptsResult extends PaginatedResult {
704
774
  /**
705
775
  * Parameters for a `prompts/get` request.
706
776
  *
707
- * @category prompts/get
777
+ * @category `prompts/get`
708
778
  */
709
779
  export interface GetPromptRequestParams extends RequestParams {
710
780
  /**
@@ -721,7 +791,7 @@ export interface GetPromptRequestParams extends RequestParams {
721
791
  /**
722
792
  * Used by the client to get a prompt provided by the server.
723
793
  *
724
- * @category prompts/get
794
+ * @category `prompts/get`
725
795
  */
726
796
  export interface GetPromptRequest extends JSONRPCRequest {
727
797
  method: "prompts/get";
@@ -730,7 +800,7 @@ export interface GetPromptRequest extends JSONRPCRequest {
730
800
  /**
731
801
  * The server's response to a prompts/get request from the client.
732
802
  *
733
- * @category prompts/get
803
+ * @category `prompts/get`
734
804
  */
735
805
  export interface GetPromptResult extends Result {
736
806
  /**
@@ -741,6 +811,8 @@ export interface GetPromptResult extends Result {
741
811
  }
742
812
  /**
743
813
  * A prompt or prompt template that the server offers.
814
+ *
815
+ * @category `prompts/list`
744
816
  */
745
817
  export interface Prompt extends BaseMetadata, Icons {
746
818
  /**
@@ -760,6 +832,8 @@ export interface Prompt extends BaseMetadata, Icons {
760
832
  }
761
833
  /**
762
834
  * Describes an argument that a prompt can accept.
835
+ *
836
+ * @category `prompts/list`
763
837
  */
764
838
  export interface PromptArgument extends BaseMetadata {
765
839
  /**
@@ -773,6 +847,8 @@ export interface PromptArgument extends BaseMetadata {
773
847
  }
774
848
  /**
775
849
  * The sender or recipient of messages and data in a conversation.
850
+ *
851
+ * @category Common Types
776
852
  */
777
853
  export type Role = "user" | "assistant";
778
854
  /**
@@ -780,6 +856,8 @@ export type Role = "user" | "assistant";
780
856
  *
781
857
  * This is similar to `SamplingMessage`, but also supports the embedding of
782
858
  * resources from the MCP server.
859
+ *
860
+ * @category `prompts/get`
783
861
  */
784
862
  export interface PromptMessage {
785
863
  role: Role;
@@ -789,6 +867,8 @@ export interface PromptMessage {
789
867
  * A resource that the server is capable of reading, included in a prompt or tool call result.
790
868
  *
791
869
  * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
870
+ *
871
+ * @category Content
792
872
  */
793
873
  export interface ResourceLink extends Resource {
794
874
  type: "resource_link";
@@ -798,6 +878,8 @@ export interface ResourceLink extends Resource {
798
878
  *
799
879
  * It is up to the client how best to render embedded resources for the benefit
800
880
  * of the LLM and/or the user.
881
+ *
882
+ * @category Content
801
883
  */
802
884
  export interface EmbeddedResource {
803
885
  type: "resource";
@@ -816,7 +898,7 @@ export interface EmbeddedResource {
816
898
  /**
817
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.
818
900
  *
819
- * @category notifications/prompts/list_changed
901
+ * @category `notifications/prompts/list_changed`
820
902
  */
821
903
  export interface PromptListChangedNotification extends JSONRPCNotification {
822
904
  method: "notifications/prompts/list_changed";
@@ -825,7 +907,7 @@ export interface PromptListChangedNotification extends JSONRPCNotification {
825
907
  /**
826
908
  * Sent from the client to request a list of tools the server has.
827
909
  *
828
- * @category tools/list
910
+ * @category `tools/list`
829
911
  */
830
912
  export interface ListToolsRequest extends PaginatedRequest {
831
913
  method: "tools/list";
@@ -833,7 +915,7 @@ export interface ListToolsRequest extends PaginatedRequest {
833
915
  /**
834
916
  * The server's response to a tools/list request from the client.
835
917
  *
836
- * @category tools/list
918
+ * @category `tools/list`
837
919
  */
838
920
  export interface ListToolsResult extends PaginatedResult {
839
921
  tools: Tool[];
@@ -841,7 +923,7 @@ export interface ListToolsResult extends PaginatedResult {
841
923
  /**
842
924
  * The server's response to a tool call.
843
925
  *
844
- * @category tools/call
926
+ * @category `tools/call`
845
927
  */
846
928
  export interface CallToolResult extends Result {
847
929
  /**
@@ -873,7 +955,7 @@ export interface CallToolResult extends Result {
873
955
  /**
874
956
  * Parameters for a `tools/call` request.
875
957
  *
876
- * @category tools/call
958
+ * @category `tools/call`
877
959
  */
878
960
  export interface CallToolRequestParams extends RequestParams {
879
961
  /**
@@ -890,7 +972,7 @@ export interface CallToolRequestParams extends RequestParams {
890
972
  /**
891
973
  * Used by the client to invoke a tool provided by the server.
892
974
  *
893
- * @category tools/call
975
+ * @category `tools/call`
894
976
  */
895
977
  export interface CallToolRequest extends JSONRPCRequest {
896
978
  method: "tools/call";
@@ -899,7 +981,7 @@ export interface CallToolRequest extends JSONRPCRequest {
899
981
  /**
900
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.
901
983
  *
902
- * @category notifications/tools/list_changed
984
+ * @category `notifications/tools/list_changed`
903
985
  */
904
986
  export interface ToolListChangedNotification extends JSONRPCNotification {
905
987
  method: "notifications/tools/list_changed";
@@ -914,6 +996,8 @@ export interface ToolListChangedNotification extends JSONRPCNotification {
914
996
  *
915
997
  * Clients should never make tool use decisions based on ToolAnnotations
916
998
  * received from untrusted servers.
999
+ *
1000
+ * @category `tools/list`
917
1001
  */
918
1002
  export interface ToolAnnotations {
919
1003
  /**
@@ -956,6 +1040,8 @@ export interface ToolAnnotations {
956
1040
  }
957
1041
  /**
958
1042
  * Definition for a tool the client can call.
1043
+ *
1044
+ * @category `tools/list`
959
1045
  */
960
1046
  export interface Tool extends BaseMetadata, Icons {
961
1047
  /**
@@ -1001,7 +1087,7 @@ export interface Tool extends BaseMetadata, Icons {
1001
1087
  /**
1002
1088
  * Parameters for a `logging/setLevel` request.
1003
1089
  *
1004
- * @category logging/setLevel
1090
+ * @category `logging/setLevel`
1005
1091
  */
1006
1092
  export interface SetLevelRequestParams extends RequestParams {
1007
1093
  /**
@@ -1012,7 +1098,7 @@ export interface SetLevelRequestParams extends RequestParams {
1012
1098
  /**
1013
1099
  * A request from the client to the server, to enable or adjust logging.
1014
1100
  *
1015
- * @category logging/setLevel
1101
+ * @category `logging/setLevel`
1016
1102
  */
1017
1103
  export interface SetLevelRequest extends JSONRPCRequest {
1018
1104
  method: "logging/setLevel";
@@ -1021,7 +1107,7 @@ export interface SetLevelRequest extends JSONRPCRequest {
1021
1107
  /**
1022
1108
  * Parameters for a `notifications/message` notification.
1023
1109
  *
1024
- * @category notifications/message
1110
+ * @category `notifications/message`
1025
1111
  */
1026
1112
  export interface LoggingMessageNotificationParams extends NotificationParams {
1027
1113
  /**
@@ -1040,7 +1126,7 @@ export interface LoggingMessageNotificationParams extends NotificationParams {
1040
1126
  /**
1041
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.
1042
1128
  *
1043
- * @category notifications/message
1129
+ * @category `notifications/message`
1044
1130
  */
1045
1131
  export interface LoggingMessageNotification extends JSONRPCNotification {
1046
1132
  method: "notifications/message";
@@ -1051,12 +1137,14 @@ export interface LoggingMessageNotification extends JSONRPCNotification {
1051
1137
  *
1052
1138
  * These map to syslog message severities, as specified in RFC-5424:
1053
1139
  * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
1140
+ *
1141
+ * @category Common Types
1054
1142
  */
1055
1143
  export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
1056
1144
  /**
1057
1145
  * Parameters for a `sampling/createMessage` request.
1058
1146
  *
1059
- * @category sampling/createMessage
1147
+ * @category `sampling/createMessage`
1060
1148
  */
1061
1149
  export interface CreateMessageRequestParams extends RequestParams {
1062
1150
  messages: SamplingMessage[];
@@ -1069,7 +1157,11 @@ export interface CreateMessageRequestParams extends RequestParams {
1069
1157
  */
1070
1158
  systemPrompt?: string;
1071
1159
  /**
1072
- * 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.
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.
1073
1165
  */
1074
1166
  includeContext?: "none" | "thisServer" | "allServers";
1075
1167
  /**
@@ -1087,11 +1179,36 @@ export interface CreateMessageRequestParams extends RequestParams {
1087
1179
  * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1088
1180
  */
1089
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";
1090
1207
  }
1091
1208
  /**
1092
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.
1093
1210
  *
1094
- * @category sampling/createMessage
1211
+ * @category `sampling/createMessage`
1095
1212
  */
1096
1213
  export interface CreateMessageRequest extends JSONRPCRequest {
1097
1214
  method: "sampling/createMessage";
@@ -1100,7 +1217,7 @@ export interface CreateMessageRequest extends JSONRPCRequest {
1100
1217
  /**
1101
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.
1102
1219
  *
1103
- * @category sampling/createMessage
1220
+ * @category `sampling/createMessage`
1104
1221
  */
1105
1222
  export interface CreateMessageResult extends Result, SamplingMessage {
1106
1223
  /**
@@ -1109,18 +1226,37 @@ export interface CreateMessageResult extends Result, SamplingMessage {
1109
1226
  model: string;
1110
1227
  /**
1111
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.
1112
1237
  */
1113
- stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
1238
+ stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string;
1114
1239
  }
1115
1240
  /**
1116
1241
  * Describes a message issued to or received from an LLM API.
1242
+ *
1243
+ * @category `sampling/createMessage`
1117
1244
  */
1118
1245
  export interface SamplingMessage {
1119
1246
  role: Role;
1120
- 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
+ };
1121
1254
  }
1255
+ export type SamplingMessageContentBlock = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
1122
1256
  /**
1123
1257
  * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
1258
+ *
1259
+ * @category Common Types
1124
1260
  */
1125
1261
  export interface Annotations {
1126
1262
  /**
@@ -1151,9 +1287,14 @@ export interface Annotations {
1151
1287
  */
1152
1288
  lastModified?: string;
1153
1289
  }
1290
+ /**
1291
+ * @category Content
1292
+ */
1154
1293
  export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource;
1155
1294
  /**
1156
1295
  * Text provided to or from an LLM.
1296
+ *
1297
+ * @category Content
1157
1298
  */
1158
1299
  export interface TextContent {
1159
1300
  type: "text";
@@ -1174,6 +1315,8 @@ export interface TextContent {
1174
1315
  }
1175
1316
  /**
1176
1317
  * An image provided to or from an LLM.
1318
+ *
1319
+ * @category Content
1177
1320
  */
1178
1321
  export interface ImageContent {
1179
1322
  type: "image";
@@ -1200,6 +1343,8 @@ export interface ImageContent {
1200
1343
  }
1201
1344
  /**
1202
1345
  * Audio provided to or from an LLM.
1346
+ *
1347
+ * @category Content
1203
1348
  */
1204
1349
  export interface AudioContent {
1205
1350
  type: "audio";
@@ -1224,6 +1369,84 @@ export interface AudioContent {
1224
1369
  [key: string]: unknown;
1225
1370
  };
1226
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
+ }
1227
1450
  /**
1228
1451
  * The server's preferences for model selection, requested of the client during sampling.
1229
1452
  *
@@ -1236,6 +1459,8 @@ export interface AudioContent {
1236
1459
  * These preferences are always advisory. The client MAY ignore them. It is also
1237
1460
  * up to the client to decide how to interpret these preferences and how to
1238
1461
  * balance them against other considerations.
1462
+ *
1463
+ * @category `sampling/createMessage`
1239
1464
  */
1240
1465
  export interface ModelPreferences {
1241
1466
  /**
@@ -1284,6 +1509,8 @@ export interface ModelPreferences {
1284
1509
  *
1285
1510
  * Keys not declared here are currently left unspecified by the spec and are up
1286
1511
  * to the client to interpret.
1512
+ *
1513
+ * @category `sampling/createMessage`
1287
1514
  */
1288
1515
  export interface ModelHint {
1289
1516
  /**
@@ -1302,7 +1529,7 @@ export interface ModelHint {
1302
1529
  /**
1303
1530
  * Parameters for a `completion/complete` request.
1304
1531
  *
1305
- * @category completion/complete
1532
+ * @category `completion/complete`
1306
1533
  */
1307
1534
  export interface CompleteRequestParams extends RequestParams {
1308
1535
  ref: PromptReference | ResourceTemplateReference;
@@ -1334,7 +1561,7 @@ export interface CompleteRequestParams extends RequestParams {
1334
1561
  /**
1335
1562
  * A request from the client to the server, to ask for completion options.
1336
1563
  *
1337
- * @category completion/complete
1564
+ * @category `completion/complete`
1338
1565
  */
1339
1566
  export interface CompleteRequest extends JSONRPCRequest {
1340
1567
  method: "completion/complete";
@@ -1343,7 +1570,7 @@ export interface CompleteRequest extends JSONRPCRequest {
1343
1570
  /**
1344
1571
  * The server's response to a completion/complete request
1345
1572
  *
1346
- * @category completion/complete
1573
+ * @category `completion/complete`
1347
1574
  */
1348
1575
  export interface CompleteResult extends Result {
1349
1576
  completion: {
@@ -1363,6 +1590,8 @@ export interface CompleteResult extends Result {
1363
1590
  }
1364
1591
  /**
1365
1592
  * A reference to a resource or resource template definition.
1593
+ *
1594
+ * @category `completion/complete`
1366
1595
  */
1367
1596
  export interface ResourceTemplateReference {
1368
1597
  type: "ref/resource";
@@ -1375,6 +1604,8 @@ export interface ResourceTemplateReference {
1375
1604
  }
1376
1605
  /**
1377
1606
  * Identifies a prompt.
1607
+ *
1608
+ * @category `completion/complete`
1378
1609
  */
1379
1610
  export interface PromptReference extends BaseMetadata {
1380
1611
  type: "ref/prompt";
@@ -1388,7 +1619,7 @@ export interface PromptReference extends BaseMetadata {
1388
1619
  * This request is typically used when the server needs to understand the file system
1389
1620
  * structure or access specific locations that the client has permission to read from.
1390
1621
  *
1391
- * @category roots/list
1622
+ * @category `roots/list`
1392
1623
  */
1393
1624
  export interface ListRootsRequest extends JSONRPCRequest {
1394
1625
  method: "roots/list";
@@ -1399,13 +1630,15 @@ export interface ListRootsRequest extends JSONRPCRequest {
1399
1630
  * This result contains an array of Root objects, each representing a root directory
1400
1631
  * or file that the server can operate on.
1401
1632
  *
1402
- * @category roots/list
1633
+ * @category `roots/list`
1403
1634
  */
1404
1635
  export interface ListRootsResult extends Result {
1405
1636
  roots: Root[];
1406
1637
  }
1407
1638
  /**
1408
1639
  * Represents a root directory or file that the server can operate on.
1640
+ *
1641
+ * @category `roots/list`
1409
1642
  */
1410
1643
  export interface Root {
1411
1644
  /**
@@ -1434,20 +1667,24 @@ export interface Root {
1434
1667
  * This notification should be sent whenever the client adds, removes, or modifies any root.
1435
1668
  * The server should then request an updated list of roots using the ListRootsRequest.
1436
1669
  *
1437
- * @category notifications/roots/list_changed
1670
+ * @category `notifications/roots/list_changed`
1438
1671
  */
1439
1672
  export interface RootsListChangedNotification extends JSONRPCNotification {
1440
1673
  method: "notifications/roots/list_changed";
1441
1674
  params?: NotificationParams;
1442
1675
  }
1443
1676
  /**
1444
- * Parameters for an `elicitation/create` request.
1677
+ * The parameters for a request to elicit non-sensitive information from the user via a form in the client.
1445
1678
  *
1446
- * @category elicitation/create
1679
+ * @category `elicitation/create`
1447
1680
  */
1448
- export interface ElicitRequestParams extends RequestParams {
1681
+ export interface ElicitRequestFormParams extends RequestParams {
1449
1682
  /**
1450
- * The message to present to the user.
1683
+ * The elicitation mode.
1684
+ */
1685
+ mode: "form";
1686
+ /**
1687
+ * The message to present to the user describing what information is being requested.
1451
1688
  */
1452
1689
  message: string;
1453
1690
  /**
@@ -1462,10 +1699,42 @@ export interface ElicitRequestParams extends RequestParams {
1462
1699
  required?: string[];
1463
1700
  };
1464
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;
1465
1734
  /**
1466
1735
  * A request from the server to elicit additional information from the user via the client.
1467
1736
  *
1468
- * @category elicitation/create
1737
+ * @category `elicitation/create`
1469
1738
  */
1470
1739
  export interface ElicitRequest extends JSONRPCRequest {
1471
1740
  method: "elicitation/create";
@@ -1474,8 +1743,13 @@ export interface ElicitRequest extends JSONRPCRequest {
1474
1743
  /**
1475
1744
  * Restricted schema definitions that only allow primitive types
1476
1745
  * without nested objects or arrays.
1746
+ *
1747
+ * @category `elicitation/create`
1477
1748
  */
1478
1749
  export type PrimitiveSchemaDefinition = StringSchema | NumberSchema | BooleanSchema | EnumSchema;
1750
+ /**
1751
+ * @category `elicitation/create`
1752
+ */
1479
1753
  export interface StringSchema {
1480
1754
  type: "string";
1481
1755
  title?: string;
@@ -1485,6 +1759,9 @@ export interface StringSchema {
1485
1759
  format?: "email" | "uri" | "date" | "date-time";
1486
1760
  default?: string;
1487
1761
  }
1762
+ /**
1763
+ * @category `elicitation/create`
1764
+ */
1488
1765
  export interface NumberSchema {
1489
1766
  type: "number" | "integer";
1490
1767
  title?: string;
@@ -1493,6 +1770,9 @@ export interface NumberSchema {
1493
1770
  maximum?: number;
1494
1771
  default?: number;
1495
1772
  }
1773
+ /**
1774
+ * @category `elicitation/create`
1775
+ */
1496
1776
  export interface BooleanSchema {
1497
1777
  type: "boolean";
1498
1778
  title?: string;
@@ -1501,6 +1781,8 @@ export interface BooleanSchema {
1501
1781
  }
1502
1782
  /**
1503
1783
  * Schema for single-selection enumeration without display titles for options.
1784
+ *
1785
+ * @category `elicitation/create`
1504
1786
  */
1505
1787
  export interface UntitledSingleSelectEnumSchema {
1506
1788
  type: "string";
@@ -1523,6 +1805,8 @@ export interface UntitledSingleSelectEnumSchema {
1523
1805
  }
1524
1806
  /**
1525
1807
  * Schema for single-selection enumeration with display titles for each option.
1808
+ *
1809
+ * @category `elicitation/create`
1526
1810
  */
1527
1811
  export interface TitledSingleSelectEnumSchema {
1528
1812
  type: "string";
@@ -1552,9 +1836,14 @@ export interface TitledSingleSelectEnumSchema {
1552
1836
  */
1553
1837
  default?: string;
1554
1838
  }
1839
+ /**
1840
+ * @category `elicitation/create`
1841
+ */
1555
1842
  export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema;
1556
1843
  /**
1557
1844
  * Schema for multiple-selection enumeration without display titles for options.
1845
+ *
1846
+ * @category `elicitation/create`
1558
1847
  */
1559
1848
  export interface UntitledMultiSelectEnumSchema {
1560
1849
  type: "array";
@@ -1591,6 +1880,8 @@ export interface UntitledMultiSelectEnumSchema {
1591
1880
  }
1592
1881
  /**
1593
1882
  * Schema for multiple-selection enumeration with display titles for each option.
1883
+ *
1884
+ * @category `elicitation/create`
1594
1885
  */
1595
1886
  export interface TitledMultiSelectEnumSchema {
1596
1887
  type: "array";
@@ -1633,10 +1924,15 @@ export interface TitledMultiSelectEnumSchema {
1633
1924
  */
1634
1925
  default?: string[];
1635
1926
  }
1927
+ /**
1928
+ * @category `elicitation/create`
1929
+ */
1636
1930
  export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema;
1637
1931
  /**
1638
1932
  * Use TitledSingleSelectEnumSchema instead.
1639
1933
  * This interface will be removed in a future version.
1934
+ *
1935
+ * @category `elicitation/create`
1640
1936
  */
1641
1937
  export interface LegacyTitledEnumSchema {
1642
1938
  type: "string";
@@ -1650,11 +1946,14 @@ export interface LegacyTitledEnumSchema {
1650
1946
  enumNames?: string[];
1651
1947
  default?: string;
1652
1948
  }
1949
+ /**
1950
+ * @category `elicitation/create`
1951
+ */
1653
1952
  export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema;
1654
1953
  /**
1655
1954
  * The client's response to an elicitation request.
1656
1955
  *
1657
- * @category elicitation/create
1956
+ * @category `elicitation/create`
1658
1957
  */
1659
1958
  export interface ElicitResult extends Result {
1660
1959
  /**
@@ -1665,13 +1964,28 @@ export interface ElicitResult extends Result {
1665
1964
  */
1666
1965
  action: "accept" | "decline" | "cancel";
1667
1966
  /**
1668
- * 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".
1669
1968
  * Contains values matching the requested schema.
1969
+ * Omitted for out-of-band mode responses.
1670
1970
  */
1671
1971
  content?: {
1672
1972
  [key: string]: string | number | boolean | string[];
1673
1973
  };
1674
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;
1987
+ };
1988
+ }
1675
1989
  /** @internal */
1676
1990
  export type ClientRequest = PingRequest | InitializeRequest | CompleteRequest | SetLevelRequest | GetPromptRequest | ListPromptsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | SubscribeRequest | UnsubscribeRequest | CallToolRequest | ListToolsRequest;
1677
1991
  /** @internal */
@@ -1681,7 +1995,7 @@ export type ClientResult = EmptyResult | CreateMessageResult | ListRootsResult |
1681
1995
  /** @internal */
1682
1996
  export type ServerRequest = PingRequest | CreateMessageRequest | ListRootsRequest | ElicitRequest;
1683
1997
  /** @internal */
1684
- export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification;
1998
+ export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification | ElicitationCompleteNotification;
1685
1999
  /** @internal */
1686
2000
  export type ServerResult = EmptyResult | InitializeResult | CompleteResult | GetPromptResult | ListPromptsResult | ListResourceTemplatesResult | ListResourcesResult | ReadResourceResult | CallToolResult | ListToolsResult;
1687
2001
  //# sourceMappingURL=spec.types.d.ts.map