@modelcontextprotocol/sdk 1.22.0 → 1.23.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 (258) 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 +122 -662
  7. package/dist/cjs/client/index.d.ts.map +1 -1
  8. package/dist/cjs/client/index.js +72 -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 +14 -2
  15. package/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  16. package/dist/cjs/client/streamableHttp.js +79 -19
  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/client/ssePollingClient.d.ts +2 -0
  31. package/dist/cjs/examples/client/ssePollingClient.d.ts.map +1 -0
  32. package/dist/cjs/examples/client/ssePollingClient.js +95 -0
  33. package/dist/cjs/examples/client/ssePollingClient.js.map +1 -0
  34. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +4 -4
  35. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  36. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js +16 -0
  37. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  38. package/dist/cjs/examples/server/elicitationFormExample.d.ts +2 -0
  39. package/dist/cjs/examples/server/elicitationFormExample.d.ts.map +1 -0
  40. package/dist/cjs/examples/server/{elicitationExample.js → elicitationFormExample.js} +14 -8
  41. package/dist/cjs/examples/server/elicitationFormExample.js.map +1 -0
  42. package/dist/cjs/examples/server/elicitationUrlExample.d.ts +2 -0
  43. package/dist/cjs/examples/server/elicitationUrlExample.d.ts.map +1 -0
  44. package/dist/cjs/examples/server/elicitationUrlExample.js +655 -0
  45. package/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -0
  46. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js +26 -3
  47. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  48. package/dist/cjs/examples/server/mcpServerOutputSchema.js +34 -11
  49. package/dist/cjs/examples/server/mcpServerOutputSchema.js.map +1 -1
  50. package/dist/cjs/examples/server/simpleSseServer.js +26 -3
  51. package/dist/cjs/examples/server/simpleSseServer.js.map +1 -1
  52. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js +27 -4
  53. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  54. package/dist/cjs/examples/server/simpleStreamableHttp.js +34 -10
  55. package/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
  56. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +26 -3
  57. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  58. package/dist/cjs/examples/server/ssePollingExample.d.ts +2 -0
  59. package/dist/cjs/examples/server/ssePollingExample.d.ts.map +1 -0
  60. package/dist/cjs/examples/server/ssePollingExample.js +116 -0
  61. package/dist/cjs/examples/server/ssePollingExample.js.map +1 -0
  62. package/dist/cjs/examples/server/toolWithSampleServer.js +30 -8
  63. package/dist/cjs/examples/server/toolWithSampleServer.js.map +1 -1
  64. package/dist/cjs/server/auth/handlers/authorize.js +34 -11
  65. package/dist/cjs/server/auth/handlers/authorize.js.map +1 -1
  66. package/dist/cjs/server/auth/handlers/token.js +35 -12
  67. package/dist/cjs/server/auth/handlers/token.js.map +1 -1
  68. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  69. package/dist/cjs/server/auth/middleware/bearerAuth.js +13 -8
  70. package/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
  71. package/dist/cjs/server/auth/middleware/clientAuth.js +27 -4
  72. package/dist/cjs/server/auth/middleware/clientAuth.js.map +1 -1
  73. package/dist/cjs/server/auth/router.js +1 -1
  74. package/dist/cjs/server/auth/router.js.map +1 -1
  75. package/dist/cjs/server/completable.d.ts +30 -16
  76. package/dist/cjs/server/completable.d.ts.map +1 -1
  77. package/dist/cjs/server/completable.js +38 -55
  78. package/dist/cjs/server/completable.js.map +1 -1
  79. package/dist/cjs/server/index.d.ts +176 -50
  80. package/dist/cjs/server/index.d.ts.map +1 -1
  81. package/dist/cjs/server/index.js +99 -13
  82. package/dist/cjs/server/index.js.map +1 -1
  83. package/dist/cjs/server/mcp.d.ts +14 -16
  84. package/dist/cjs/server/mcp.d.ts.map +1 -1
  85. package/dist/cjs/server/mcp.js +83 -40
  86. package/dist/cjs/server/mcp.js.map +1 -1
  87. package/dist/cjs/server/streamableHttp.d.ts +27 -0
  88. package/dist/cjs/server/streamableHttp.d.ts.map +1 -1
  89. package/dist/cjs/server/streamableHttp.js +70 -5
  90. package/dist/cjs/server/streamableHttp.js.map +1 -1
  91. package/dist/cjs/server/zod-compat.d.ts +82 -0
  92. package/dist/cjs/server/zod-compat.d.ts.map +1 -0
  93. package/dist/cjs/server/zod-compat.js +252 -0
  94. package/dist/cjs/server/zod-compat.js.map +1 -0
  95. package/dist/cjs/server/zod-json-schema-compat.d.ts +12 -0
  96. package/dist/cjs/server/zod-json-schema-compat.d.ts.map +1 -0
  97. package/dist/cjs/server/zod-json-schema-compat.js +80 -0
  98. package/dist/cjs/server/zod-json-schema-compat.js.map +1 -0
  99. package/dist/cjs/shared/auth.d.ts +116 -502
  100. package/dist/cjs/shared/auth.d.ts.map +1 -1
  101. package/dist/cjs/shared/auth.js +133 -112
  102. package/dist/cjs/shared/auth.js.map +1 -1
  103. package/dist/cjs/shared/protocol.d.ts +5 -9
  104. package/dist/cjs/shared/protocol.d.ts.map +1 -1
  105. package/dist/cjs/shared/protocol.js +24 -10
  106. package/dist/cjs/shared/protocol.js.map +1 -1
  107. package/dist/cjs/shared/transport.d.ts +14 -0
  108. package/dist/cjs/shared/transport.d.ts.map +1 -1
  109. package/dist/cjs/shared/transport.js +40 -0
  110. package/dist/cjs/shared/transport.js.map +1 -1
  111. package/dist/cjs/shared/zodTestMatrix.d.ts +16 -0
  112. package/dist/cjs/shared/zodTestMatrix.d.ts.map +1 -0
  113. package/dist/cjs/shared/zodTestMatrix.js +43 -0
  114. package/dist/cjs/shared/zodTestMatrix.js.map +1 -0
  115. package/dist/cjs/spec.types.d.ts +393 -70
  116. package/dist/cjs/spec.types.d.ts.map +1 -1
  117. package/dist/cjs/spec.types.js +5 -7
  118. package/dist/cjs/spec.types.js.map +1 -1
  119. package/dist/cjs/types.d.ts +3580 -23866
  120. package/dist/cjs/types.d.ts.map +1 -1
  121. package/dist/cjs/types.js +574 -340
  122. package/dist/cjs/types.js.map +1 -1
  123. package/dist/cjs/validation/cfworker-provider.d.ts +0 -1
  124. package/dist/cjs/validation/cfworker-provider.d.ts.map +1 -1
  125. package/dist/cjs/validation/cfworker-provider.js +0 -1
  126. package/dist/cjs/validation/cfworker-provider.js.map +1 -1
  127. package/dist/esm/client/auth.d.ts +11 -1
  128. package/dist/esm/client/auth.d.ts.map +1 -1
  129. package/dist/esm/client/auth.js +71 -20
  130. package/dist/esm/client/auth.js.map +1 -1
  131. package/dist/esm/client/index.d.ts +122 -662
  132. package/dist/esm/client/index.d.ts.map +1 -1
  133. package/dist/esm/client/index.js +71 -15
  134. package/dist/esm/client/index.js.map +1 -1
  135. package/dist/esm/client/sse.d.ts +1 -0
  136. package/dist/esm/client/sse.d.ts.map +1 -1
  137. package/dist/esm/client/sse.js +5 -3
  138. package/dist/esm/client/sse.js.map +1 -1
  139. package/dist/esm/client/streamableHttp.d.ts +14 -2
  140. package/dist/esm/client/streamableHttp.d.ts.map +1 -1
  141. package/dist/esm/client/streamableHttp.js +79 -19
  142. package/dist/esm/client/streamableHttp.js.map +1 -1
  143. package/dist/esm/examples/client/elicitationUrlExample.d.ts +2 -0
  144. package/dist/esm/examples/client/elicitationUrlExample.d.ts.map +1 -0
  145. package/dist/esm/examples/client/elicitationUrlExample.js +691 -0
  146. package/dist/esm/examples/client/elicitationUrlExample.js.map +1 -0
  147. package/dist/esm/examples/client/simpleOAuthClient.js +12 -51
  148. package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -1
  149. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts +26 -0
  150. package/dist/esm/examples/client/simpleOAuthClientProvider.d.ts.map +1 -0
  151. package/dist/esm/examples/client/simpleOAuthClientProvider.js +47 -0
  152. package/dist/esm/examples/client/simpleOAuthClientProvider.js.map +1 -0
  153. package/dist/esm/examples/client/simpleStreamableHttp.js +11 -6
  154. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
  155. package/dist/esm/examples/client/ssePollingClient.d.ts +2 -0
  156. package/dist/esm/examples/client/ssePollingClient.d.ts.map +1 -0
  157. package/dist/esm/examples/client/ssePollingClient.js +93 -0
  158. package/dist/esm/examples/client/ssePollingClient.js.map +1 -0
  159. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +4 -4
  160. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  161. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js +16 -0
  162. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js.map +1 -1
  163. package/dist/esm/examples/server/elicitationFormExample.d.ts +2 -0
  164. package/dist/esm/examples/server/elicitationFormExample.d.ts.map +1 -0
  165. package/dist/esm/examples/server/{elicitationExample.js → elicitationFormExample.js} +14 -8
  166. package/dist/esm/examples/server/elicitationFormExample.js.map +1 -0
  167. package/dist/esm/examples/server/elicitationUrlExample.d.ts +2 -0
  168. package/dist/esm/examples/server/elicitationUrlExample.d.ts.map +1 -0
  169. package/dist/esm/examples/server/elicitationUrlExample.js +650 -0
  170. package/dist/esm/examples/server/elicitationUrlExample.js.map +1 -0
  171. package/dist/esm/examples/server/jsonResponseStreamableHttp.js +1 -1
  172. package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  173. package/dist/esm/examples/server/mcpServerOutputSchema.js +1 -1
  174. package/dist/esm/examples/server/mcpServerOutputSchema.js.map +1 -1
  175. package/dist/esm/examples/server/simpleSseServer.js +1 -1
  176. package/dist/esm/examples/server/simpleSseServer.js.map +1 -1
  177. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +1 -1
  178. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
  179. package/dist/esm/examples/server/simpleStreamableHttp.js +4 -3
  180. package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  181. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +1 -1
  182. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  183. package/dist/esm/examples/server/ssePollingExample.d.ts +2 -0
  184. package/dist/esm/examples/server/ssePollingExample.d.ts.map +1 -0
  185. package/dist/esm/examples/server/ssePollingExample.js +111 -0
  186. package/dist/esm/examples/server/ssePollingExample.js.map +1 -0
  187. package/dist/esm/examples/server/toolWithSampleServer.js +6 -7
  188. package/dist/esm/examples/server/toolWithSampleServer.js.map +1 -1
  189. package/dist/esm/server/auth/handlers/authorize.js +1 -1
  190. package/dist/esm/server/auth/handlers/authorize.js.map +1 -1
  191. package/dist/esm/server/auth/handlers/token.js +1 -1
  192. package/dist/esm/server/auth/handlers/token.js.map +1 -1
  193. package/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  194. package/dist/esm/server/auth/middleware/bearerAuth.js +13 -8
  195. package/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  196. package/dist/esm/server/auth/middleware/clientAuth.js +1 -1
  197. package/dist/esm/server/auth/middleware/clientAuth.js.map +1 -1
  198. package/dist/esm/server/auth/router.js +1 -1
  199. package/dist/esm/server/auth/router.js.map +1 -1
  200. package/dist/esm/server/completable.d.ts +30 -16
  201. package/dist/esm/server/completable.d.ts.map +1 -1
  202. package/dist/esm/server/completable.js +34 -53
  203. package/dist/esm/server/completable.js.map +1 -1
  204. package/dist/esm/server/index.d.ts +176 -50
  205. package/dist/esm/server/index.d.ts.map +1 -1
  206. package/dist/esm/server/index.js +99 -13
  207. package/dist/esm/server/index.js.map +1 -1
  208. package/dist/esm/server/mcp.d.ts +14 -16
  209. package/dist/esm/server/mcp.d.ts.map +1 -1
  210. package/dist/esm/server/mcp.js +84 -41
  211. package/dist/esm/server/mcp.js.map +1 -1
  212. package/dist/esm/server/streamableHttp.d.ts +27 -0
  213. package/dist/esm/server/streamableHttp.d.ts.map +1 -1
  214. package/dist/esm/server/streamableHttp.js +70 -5
  215. package/dist/esm/server/streamableHttp.js.map +1 -1
  216. package/dist/esm/server/zod-compat.d.ts +82 -0
  217. package/dist/esm/server/zod-compat.d.ts.map +1 -0
  218. package/dist/esm/server/zod-compat.js +217 -0
  219. package/dist/esm/server/zod-compat.js.map +1 -0
  220. package/dist/esm/server/zod-json-schema-compat.d.ts +12 -0
  221. package/dist/esm/server/zod-json-schema-compat.d.ts.map +1 -0
  222. package/dist/esm/server/zod-json-schema-compat.js +52 -0
  223. package/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  224. package/dist/esm/shared/auth.d.ts +116 -502
  225. package/dist/esm/shared/auth.d.ts.map +1 -1
  226. package/dist/esm/shared/auth.js +17 -19
  227. package/dist/esm/shared/auth.js.map +1 -1
  228. package/dist/esm/shared/protocol.d.ts +5 -9
  229. package/dist/esm/shared/protocol.d.ts.map +1 -1
  230. package/dist/esm/shared/protocol.js +24 -10
  231. package/dist/esm/shared/protocol.js.map +1 -1
  232. package/dist/esm/shared/transport.d.ts +14 -0
  233. package/dist/esm/shared/transport.d.ts.map +1 -1
  234. package/dist/esm/shared/transport.js +38 -1
  235. package/dist/esm/shared/transport.js.map +1 -1
  236. package/dist/esm/shared/zodTestMatrix.d.ts +16 -0
  237. package/dist/esm/shared/zodTestMatrix.d.ts.map +1 -0
  238. package/dist/esm/shared/zodTestMatrix.js +17 -0
  239. package/dist/esm/shared/zodTestMatrix.js.map +1 -0
  240. package/dist/esm/spec.types.d.ts +393 -70
  241. package/dist/esm/spec.types.d.ts.map +1 -1
  242. package/dist/esm/spec.types.js +4 -6
  243. package/dist/esm/spec.types.js.map +1 -1
  244. package/dist/esm/types.d.ts +3580 -23866
  245. package/dist/esm/types.d.ts.map +1 -1
  246. package/dist/esm/types.js +282 -72
  247. package/dist/esm/types.js.map +1 -1
  248. package/dist/esm/validation/cfworker-provider.d.ts +0 -1
  249. package/dist/esm/validation/cfworker-provider.d.ts.map +1 -1
  250. package/dist/esm/validation/cfworker-provider.js +0 -1
  251. package/dist/esm/validation/cfworker-provider.js.map +1 -1
  252. package/package.json +13 -12
  253. package/dist/cjs/examples/server/elicitationExample.d.ts +0 -2
  254. package/dist/cjs/examples/server/elicitationExample.d.ts.map +0 -1
  255. package/dist/cjs/examples/server/elicitationExample.js.map +0 -1
  256. package/dist/esm/examples/server/elicitationExample.d.ts +0 -2
  257. package/dist/esm/examples/server/elicitationExample.d.ts.map +0 -1
  258. 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: 7dcdd69262bd488ddec071bf4eefedabf1742023
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,10 +426,20 @@ 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;
435
+ /**
436
+ * An optional human-readable description of what this implementation does.
437
+ *
438
+ * This can be used by clients or servers to provide context about their purpose
439
+ * and capabilities. For example, a server might describe the types of resources
440
+ * or tools it provides, while a client might describe its intended use case.
441
+ */
442
+ description?: string;
379
443
  /**
380
444
  * An optional URL of the website for this implementation.
381
445
  *
@@ -386,7 +450,7 @@ export interface Implementation extends BaseMetadata, Icons {
386
450
  /**
387
451
  * 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
452
  *
389
- * @category ping
453
+ * @category `ping`
390
454
  */
391
455
  export interface PingRequest extends JSONRPCRequest {
392
456
  method: "ping";
@@ -395,7 +459,7 @@ export interface PingRequest extends JSONRPCRequest {
395
459
  /**
396
460
  * Parameters for a `notifications/progress` notification.
397
461
  *
398
- * @category notifications/progress
462
+ * @category `notifications/progress`
399
463
  */
400
464
  export interface ProgressNotificationParams extends NotificationParams {
401
465
  /**
@@ -422,7 +486,7 @@ export interface ProgressNotificationParams extends NotificationParams {
422
486
  /**
423
487
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
424
488
  *
425
- * @category notifications/progress
489
+ * @category `notifications/progress`
426
490
  */
427
491
  export interface ProgressNotification extends JSONRPCNotification {
428
492
  method: "notifications/progress";
@@ -430,6 +494,8 @@ export interface ProgressNotification extends JSONRPCNotification {
430
494
  }
431
495
  /**
432
496
  * Common parameters for paginated requests.
497
+ *
498
+ * @internal
433
499
  */
434
500
  export interface PaginatedRequestParams extends RequestParams {
435
501
  /**
@@ -453,7 +519,7 @@ export interface PaginatedResult extends Result {
453
519
  /**
454
520
  * Sent from the client to request a list of resources the server has.
455
521
  *
456
- * @category resources/list
522
+ * @category `resources/list`
457
523
  */
458
524
  export interface ListResourcesRequest extends PaginatedRequest {
459
525
  method: "resources/list";
@@ -461,7 +527,7 @@ export interface ListResourcesRequest extends PaginatedRequest {
461
527
  /**
462
528
  * The server's response to a resources/list request from the client.
463
529
  *
464
- * @category resources/list
530
+ * @category `resources/list`
465
531
  */
466
532
  export interface ListResourcesResult extends PaginatedResult {
467
533
  resources: Resource[];
@@ -469,7 +535,7 @@ export interface ListResourcesResult extends PaginatedResult {
469
535
  /**
470
536
  * Sent from the client to request a list of resource templates the server has.
471
537
  *
472
- * @category resources/templates/list
538
+ * @category `resources/templates/list`
473
539
  */
474
540
  export interface ListResourceTemplatesRequest extends PaginatedRequest {
475
541
  method: "resources/templates/list";
@@ -477,7 +543,7 @@ export interface ListResourceTemplatesRequest extends PaginatedRequest {
477
543
  /**
478
544
  * The server's response to a resources/templates/list request from the client.
479
545
  *
480
- * @category resources/templates/list
546
+ * @category `resources/templates/list`
481
547
  */
482
548
  export interface ListResourceTemplatesResult extends PaginatedResult {
483
549
  resourceTemplates: ResourceTemplate[];
@@ -498,14 +564,14 @@ export interface ResourceRequestParams extends RequestParams {
498
564
  /**
499
565
  * Parameters for a `resources/read` request.
500
566
  *
501
- * @category resources/read
567
+ * @category `resources/read`
502
568
  */
503
569
  export interface ReadResourceRequestParams extends ResourceRequestParams {
504
570
  }
505
571
  /**
506
572
  * Sent from the client to the server, to read a specific resource URI.
507
573
  *
508
- * @category resources/read
574
+ * @category `resources/read`
509
575
  */
510
576
  export interface ReadResourceRequest extends JSONRPCRequest {
511
577
  method: "resources/read";
@@ -514,7 +580,7 @@ export interface ReadResourceRequest extends JSONRPCRequest {
514
580
  /**
515
581
  * The server's response to a resources/read request from the client.
516
582
  *
517
- * @category resources/read
583
+ * @category `resources/read`
518
584
  */
519
585
  export interface ReadResourceResult extends Result {
520
586
  contents: (TextResourceContents | BlobResourceContents)[];
@@ -522,7 +588,7 @@ export interface ReadResourceResult extends Result {
522
588
  /**
523
589
  * 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
590
  *
525
- * @category notifications/resources/list_changed
591
+ * @category `notifications/resources/list_changed`
526
592
  */
527
593
  export interface ResourceListChangedNotification extends JSONRPCNotification {
528
594
  method: "notifications/resources/list_changed";
@@ -531,14 +597,14 @@ export interface ResourceListChangedNotification extends JSONRPCNotification {
531
597
  /**
532
598
  * Parameters for a `resources/subscribe` request.
533
599
  *
534
- * @category resources/subscribe
600
+ * @category `resources/subscribe`
535
601
  */
536
602
  export interface SubscribeRequestParams extends ResourceRequestParams {
537
603
  }
538
604
  /**
539
605
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
540
606
  *
541
- * @category resources/subscribe
607
+ * @category `resources/subscribe`
542
608
  */
543
609
  export interface SubscribeRequest extends JSONRPCRequest {
544
610
  method: "resources/subscribe";
@@ -547,14 +613,14 @@ export interface SubscribeRequest extends JSONRPCRequest {
547
613
  /**
548
614
  * Parameters for a `resources/unsubscribe` request.
549
615
  *
550
- * @category resources/unsubscribe
616
+ * @category `resources/unsubscribe`
551
617
  */
552
618
  export interface UnsubscribeRequestParams extends ResourceRequestParams {
553
619
  }
554
620
  /**
555
621
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
556
622
  *
557
- * @category resources/unsubscribe
623
+ * @category `resources/unsubscribe`
558
624
  */
559
625
  export interface UnsubscribeRequest extends JSONRPCRequest {
560
626
  method: "resources/unsubscribe";
@@ -563,7 +629,7 @@ export interface UnsubscribeRequest extends JSONRPCRequest {
563
629
  /**
564
630
  * Parameters for a `notifications/resources/updated` notification.
565
631
  *
566
- * @category notifications/resources/updated
632
+ * @category `notifications/resources/updated`
567
633
  */
568
634
  export interface ResourceUpdatedNotificationParams extends NotificationParams {
569
635
  /**
@@ -576,7 +642,7 @@ export interface ResourceUpdatedNotificationParams extends NotificationParams {
576
642
  /**
577
643
  * 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
644
  *
579
- * @category notifications/resources/updated
645
+ * @category `notifications/resources/updated`
580
646
  */
581
647
  export interface ResourceUpdatedNotification extends JSONRPCNotification {
582
648
  method: "notifications/resources/updated";
@@ -584,6 +650,8 @@ export interface ResourceUpdatedNotification extends JSONRPCNotification {
584
650
  }
585
651
  /**
586
652
  * A known resource that the server is capable of reading.
653
+ *
654
+ * @category `resources/list`
587
655
  */
588
656
  export interface Resource extends BaseMetadata, Icons {
589
657
  /**
@@ -621,6 +689,8 @@ export interface Resource extends BaseMetadata, Icons {
621
689
  }
622
690
  /**
623
691
  * A template description for resources available on the server.
692
+ *
693
+ * @category `resources/templates/list`
624
694
  */
625
695
  export interface ResourceTemplate extends BaseMetadata, Icons {
626
696
  /**
@@ -652,6 +722,8 @@ export interface ResourceTemplate extends BaseMetadata, Icons {
652
722
  }
653
723
  /**
654
724
  * The contents of a specific resource or sub-resource.
725
+ *
726
+ * @internal
655
727
  */
656
728
  export interface ResourceContents {
657
729
  /**
@@ -671,12 +743,18 @@ export interface ResourceContents {
671
743
  [key: string]: unknown;
672
744
  };
673
745
  }
746
+ /**
747
+ * @category Content
748
+ */
674
749
  export interface TextResourceContents extends ResourceContents {
675
750
  /**
676
751
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
677
752
  */
678
753
  text: string;
679
754
  }
755
+ /**
756
+ * @category Content
757
+ */
680
758
  export interface BlobResourceContents extends ResourceContents {
681
759
  /**
682
760
  * A base64-encoded string representing the binary data of the item.
@@ -688,7 +766,7 @@ export interface BlobResourceContents extends ResourceContents {
688
766
  /**
689
767
  * Sent from the client to request a list of prompts and prompt templates the server has.
690
768
  *
691
- * @category prompts/list
769
+ * @category `prompts/list`
692
770
  */
693
771
  export interface ListPromptsRequest extends PaginatedRequest {
694
772
  method: "prompts/list";
@@ -696,7 +774,7 @@ export interface ListPromptsRequest extends PaginatedRequest {
696
774
  /**
697
775
  * The server's response to a prompts/list request from the client.
698
776
  *
699
- * @category prompts/list
777
+ * @category `prompts/list`
700
778
  */
701
779
  export interface ListPromptsResult extends PaginatedResult {
702
780
  prompts: Prompt[];
@@ -704,7 +782,7 @@ export interface ListPromptsResult extends PaginatedResult {
704
782
  /**
705
783
  * Parameters for a `prompts/get` request.
706
784
  *
707
- * @category prompts/get
785
+ * @category `prompts/get`
708
786
  */
709
787
  export interface GetPromptRequestParams extends RequestParams {
710
788
  /**
@@ -721,7 +799,7 @@ export interface GetPromptRequestParams extends RequestParams {
721
799
  /**
722
800
  * Used by the client to get a prompt provided by the server.
723
801
  *
724
- * @category prompts/get
802
+ * @category `prompts/get`
725
803
  */
726
804
  export interface GetPromptRequest extends JSONRPCRequest {
727
805
  method: "prompts/get";
@@ -730,7 +808,7 @@ export interface GetPromptRequest extends JSONRPCRequest {
730
808
  /**
731
809
  * The server's response to a prompts/get request from the client.
732
810
  *
733
- * @category prompts/get
811
+ * @category `prompts/get`
734
812
  */
735
813
  export interface GetPromptResult extends Result {
736
814
  /**
@@ -741,6 +819,8 @@ export interface GetPromptResult extends Result {
741
819
  }
742
820
  /**
743
821
  * A prompt or prompt template that the server offers.
822
+ *
823
+ * @category `prompts/list`
744
824
  */
745
825
  export interface Prompt extends BaseMetadata, Icons {
746
826
  /**
@@ -760,6 +840,8 @@ export interface Prompt extends BaseMetadata, Icons {
760
840
  }
761
841
  /**
762
842
  * Describes an argument that a prompt can accept.
843
+ *
844
+ * @category `prompts/list`
763
845
  */
764
846
  export interface PromptArgument extends BaseMetadata {
765
847
  /**
@@ -773,6 +855,8 @@ export interface PromptArgument extends BaseMetadata {
773
855
  }
774
856
  /**
775
857
  * The sender or recipient of messages and data in a conversation.
858
+ *
859
+ * @category Common Types
776
860
  */
777
861
  export type Role = "user" | "assistant";
778
862
  /**
@@ -780,6 +864,8 @@ export type Role = "user" | "assistant";
780
864
  *
781
865
  * This is similar to `SamplingMessage`, but also supports the embedding of
782
866
  * resources from the MCP server.
867
+ *
868
+ * @category `prompts/get`
783
869
  */
784
870
  export interface PromptMessage {
785
871
  role: Role;
@@ -789,6 +875,8 @@ export interface PromptMessage {
789
875
  * A resource that the server is capable of reading, included in a prompt or tool call result.
790
876
  *
791
877
  * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
878
+ *
879
+ * @category Content
792
880
  */
793
881
  export interface ResourceLink extends Resource {
794
882
  type: "resource_link";
@@ -798,6 +886,8 @@ export interface ResourceLink extends Resource {
798
886
  *
799
887
  * It is up to the client how best to render embedded resources for the benefit
800
888
  * of the LLM and/or the user.
889
+ *
890
+ * @category Content
801
891
  */
802
892
  export interface EmbeddedResource {
803
893
  type: "resource";
@@ -816,7 +906,7 @@ export interface EmbeddedResource {
816
906
  /**
817
907
  * 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
908
  *
819
- * @category notifications/prompts/list_changed
909
+ * @category `notifications/prompts/list_changed`
820
910
  */
821
911
  export interface PromptListChangedNotification extends JSONRPCNotification {
822
912
  method: "notifications/prompts/list_changed";
@@ -825,7 +915,7 @@ export interface PromptListChangedNotification extends JSONRPCNotification {
825
915
  /**
826
916
  * Sent from the client to request a list of tools the server has.
827
917
  *
828
- * @category tools/list
918
+ * @category `tools/list`
829
919
  */
830
920
  export interface ListToolsRequest extends PaginatedRequest {
831
921
  method: "tools/list";
@@ -833,7 +923,7 @@ export interface ListToolsRequest extends PaginatedRequest {
833
923
  /**
834
924
  * The server's response to a tools/list request from the client.
835
925
  *
836
- * @category tools/list
926
+ * @category `tools/list`
837
927
  */
838
928
  export interface ListToolsResult extends PaginatedResult {
839
929
  tools: Tool[];
@@ -841,7 +931,7 @@ export interface ListToolsResult extends PaginatedResult {
841
931
  /**
842
932
  * The server's response to a tool call.
843
933
  *
844
- * @category tools/call
934
+ * @category `tools/call`
845
935
  */
846
936
  export interface CallToolResult extends Result {
847
937
  /**
@@ -873,7 +963,7 @@ export interface CallToolResult extends Result {
873
963
  /**
874
964
  * Parameters for a `tools/call` request.
875
965
  *
876
- * @category tools/call
966
+ * @category `tools/call`
877
967
  */
878
968
  export interface CallToolRequestParams extends RequestParams {
879
969
  /**
@@ -890,7 +980,7 @@ export interface CallToolRequestParams extends RequestParams {
890
980
  /**
891
981
  * Used by the client to invoke a tool provided by the server.
892
982
  *
893
- * @category tools/call
983
+ * @category `tools/call`
894
984
  */
895
985
  export interface CallToolRequest extends JSONRPCRequest {
896
986
  method: "tools/call";
@@ -899,7 +989,7 @@ export interface CallToolRequest extends JSONRPCRequest {
899
989
  /**
900
990
  * 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
991
  *
902
- * @category notifications/tools/list_changed
992
+ * @category `notifications/tools/list_changed`
903
993
  */
904
994
  export interface ToolListChangedNotification extends JSONRPCNotification {
905
995
  method: "notifications/tools/list_changed";
@@ -914,6 +1004,8 @@ export interface ToolListChangedNotification extends JSONRPCNotification {
914
1004
  *
915
1005
  * Clients should never make tool use decisions based on ToolAnnotations
916
1006
  * received from untrusted servers.
1007
+ *
1008
+ * @category `tools/list`
917
1009
  */
918
1010
  export interface ToolAnnotations {
919
1011
  /**
@@ -956,6 +1048,8 @@ export interface ToolAnnotations {
956
1048
  }
957
1049
  /**
958
1050
  * Definition for a tool the client can call.
1051
+ *
1052
+ * @category `tools/list`
959
1053
  */
960
1054
  export interface Tool extends BaseMetadata, Icons {
961
1055
  /**
@@ -1001,7 +1095,7 @@ export interface Tool extends BaseMetadata, Icons {
1001
1095
  /**
1002
1096
  * Parameters for a `logging/setLevel` request.
1003
1097
  *
1004
- * @category logging/setLevel
1098
+ * @category `logging/setLevel`
1005
1099
  */
1006
1100
  export interface SetLevelRequestParams extends RequestParams {
1007
1101
  /**
@@ -1012,7 +1106,7 @@ export interface SetLevelRequestParams extends RequestParams {
1012
1106
  /**
1013
1107
  * A request from the client to the server, to enable or adjust logging.
1014
1108
  *
1015
- * @category logging/setLevel
1109
+ * @category `logging/setLevel`
1016
1110
  */
1017
1111
  export interface SetLevelRequest extends JSONRPCRequest {
1018
1112
  method: "logging/setLevel";
@@ -1021,7 +1115,7 @@ export interface SetLevelRequest extends JSONRPCRequest {
1021
1115
  /**
1022
1116
  * Parameters for a `notifications/message` notification.
1023
1117
  *
1024
- * @category notifications/message
1118
+ * @category `notifications/message`
1025
1119
  */
1026
1120
  export interface LoggingMessageNotificationParams extends NotificationParams {
1027
1121
  /**
@@ -1040,7 +1134,7 @@ export interface LoggingMessageNotificationParams extends NotificationParams {
1040
1134
  /**
1041
1135
  * 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
1136
  *
1043
- * @category notifications/message
1137
+ * @category `notifications/message`
1044
1138
  */
1045
1139
  export interface LoggingMessageNotification extends JSONRPCNotification {
1046
1140
  method: "notifications/message";
@@ -1051,12 +1145,14 @@ export interface LoggingMessageNotification extends JSONRPCNotification {
1051
1145
  *
1052
1146
  * These map to syslog message severities, as specified in RFC-5424:
1053
1147
  * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
1148
+ *
1149
+ * @category Common Types
1054
1150
  */
1055
1151
  export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
1056
1152
  /**
1057
1153
  * Parameters for a `sampling/createMessage` request.
1058
1154
  *
1059
- * @category sampling/createMessage
1155
+ * @category `sampling/createMessage`
1060
1156
  */
1061
1157
  export interface CreateMessageRequestParams extends RequestParams {
1062
1158
  messages: SamplingMessage[];
@@ -1069,7 +1165,11 @@ export interface CreateMessageRequestParams extends RequestParams {
1069
1165
  */
1070
1166
  systemPrompt?: string;
1071
1167
  /**
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.
1168
+ * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
1169
+ * The client MAY ignore this request.
1170
+ *
1171
+ * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
1172
+ * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
1073
1173
  */
1074
1174
  includeContext?: "none" | "thisServer" | "allServers";
1075
1175
  /**
@@ -1087,11 +1187,36 @@ export interface CreateMessageRequestParams extends RequestParams {
1087
1187
  * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1088
1188
  */
1089
1189
  metadata?: object;
1190
+ /**
1191
+ * Tools that the model may use during generation.
1192
+ * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
1193
+ */
1194
+ tools?: Tool[];
1195
+ /**
1196
+ * Controls how the model uses tools.
1197
+ * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
1198
+ * Default is `{ mode: "auto" }`.
1199
+ */
1200
+ toolChoice?: ToolChoice;
1201
+ }
1202
+ /**
1203
+ * Controls tool selection behavior for sampling requests.
1204
+ *
1205
+ * @category `sampling/createMessage`
1206
+ */
1207
+ export interface ToolChoice {
1208
+ /**
1209
+ * Controls the tool use ability of the model:
1210
+ * - "auto": Model decides whether to use tools (default)
1211
+ * - "required": Model MUST use at least one tool before completing
1212
+ * - "none": Model MUST NOT use any tools
1213
+ */
1214
+ mode?: "auto" | "required" | "none";
1090
1215
  }
1091
1216
  /**
1092
1217
  * 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
1218
  *
1094
- * @category sampling/createMessage
1219
+ * @category `sampling/createMessage`
1095
1220
  */
1096
1221
  export interface CreateMessageRequest extends JSONRPCRequest {
1097
1222
  method: "sampling/createMessage";
@@ -1100,7 +1225,7 @@ export interface CreateMessageRequest extends JSONRPCRequest {
1100
1225
  /**
1101
1226
  * 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
1227
  *
1103
- * @category sampling/createMessage
1228
+ * @category `sampling/createMessage`
1104
1229
  */
1105
1230
  export interface CreateMessageResult extends Result, SamplingMessage {
1106
1231
  /**
@@ -1109,22 +1234,41 @@ export interface CreateMessageResult extends Result, SamplingMessage {
1109
1234
  model: string;
1110
1235
  /**
1111
1236
  * The reason why sampling stopped, if known.
1237
+ *
1238
+ * Standard values:
1239
+ * - "endTurn": Natural end of the assistant's turn
1240
+ * - "stopSequence": A stop sequence was encountered
1241
+ * - "maxTokens": Maximum token limit was reached
1242
+ * - "toolUse": The model wants to use one or more tools
1243
+ *
1244
+ * This field is an open string to allow for provider-specific stop reasons.
1112
1245
  */
1113
- stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
1246
+ stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string;
1114
1247
  }
1115
1248
  /**
1116
1249
  * Describes a message issued to or received from an LLM API.
1250
+ *
1251
+ * @category `sampling/createMessage`
1117
1252
  */
1118
1253
  export interface SamplingMessage {
1119
1254
  role: Role;
1120
- content: TextContent | ImageContent | AudioContent;
1255
+ content: SamplingMessageContentBlock | SamplingMessageContentBlock[];
1256
+ /**
1257
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1258
+ */
1259
+ _meta?: {
1260
+ [key: string]: unknown;
1261
+ };
1121
1262
  }
1263
+ export type SamplingMessageContentBlock = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
1122
1264
  /**
1123
1265
  * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
1266
+ *
1267
+ * @category Common Types
1124
1268
  */
1125
1269
  export interface Annotations {
1126
1270
  /**
1127
- * Describes who the intended customer of this object or data is.
1271
+ * Describes who the intended audience of this object or data is.
1128
1272
  *
1129
1273
  * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`).
1130
1274
  */
@@ -1151,9 +1295,14 @@ export interface Annotations {
1151
1295
  */
1152
1296
  lastModified?: string;
1153
1297
  }
1298
+ /**
1299
+ * @category Content
1300
+ */
1154
1301
  export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource;
1155
1302
  /**
1156
1303
  * Text provided to or from an LLM.
1304
+ *
1305
+ * @category Content
1157
1306
  */
1158
1307
  export interface TextContent {
1159
1308
  type: "text";
@@ -1174,6 +1323,8 @@ export interface TextContent {
1174
1323
  }
1175
1324
  /**
1176
1325
  * An image provided to or from an LLM.
1326
+ *
1327
+ * @category Content
1177
1328
  */
1178
1329
  export interface ImageContent {
1179
1330
  type: "image";
@@ -1200,6 +1351,8 @@ export interface ImageContent {
1200
1351
  }
1201
1352
  /**
1202
1353
  * Audio provided to or from an LLM.
1354
+ *
1355
+ * @category Content
1203
1356
  */
1204
1357
  export interface AudioContent {
1205
1358
  type: "audio";
@@ -1224,6 +1377,84 @@ export interface AudioContent {
1224
1377
  [key: string]: unknown;
1225
1378
  };
1226
1379
  }
1380
+ /**
1381
+ * A request from the assistant to call a tool.
1382
+ *
1383
+ * @category `sampling/createMessage`
1384
+ */
1385
+ export interface ToolUseContent {
1386
+ type: "tool_use";
1387
+ /**
1388
+ * A unique identifier for this tool use.
1389
+ *
1390
+ * This ID is used to match tool results to their corresponding tool uses.
1391
+ */
1392
+ id: string;
1393
+ /**
1394
+ * The name of the tool to call.
1395
+ */
1396
+ name: string;
1397
+ /**
1398
+ * The arguments to pass to the tool, conforming to the tool's input schema.
1399
+ */
1400
+ input: {
1401
+ [key: string]: unknown;
1402
+ };
1403
+ /**
1404
+ * Optional metadata about the tool use. Clients SHOULD preserve this field when
1405
+ * including tool uses in subsequent sampling requests to enable caching optimizations.
1406
+ *
1407
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1408
+ */
1409
+ _meta?: {
1410
+ [key: string]: unknown;
1411
+ };
1412
+ }
1413
+ /**
1414
+ * The result of a tool use, provided by the user back to the assistant.
1415
+ *
1416
+ * @category `sampling/createMessage`
1417
+ */
1418
+ export interface ToolResultContent {
1419
+ type: "tool_result";
1420
+ /**
1421
+ * The ID of the tool use this result corresponds to.
1422
+ *
1423
+ * This MUST match the ID from a previous ToolUseContent.
1424
+ */
1425
+ toolUseId: string;
1426
+ /**
1427
+ * The unstructured result content of the tool use.
1428
+ *
1429
+ * This has the same format as CallToolResult.content and can include text, images,
1430
+ * audio, resource links, and embedded resources.
1431
+ */
1432
+ content: ContentBlock[];
1433
+ /**
1434
+ * An optional structured result object.
1435
+ *
1436
+ * If the tool defined an outputSchema, this SHOULD conform to that schema.
1437
+ */
1438
+ structuredContent?: {
1439
+ [key: string]: unknown;
1440
+ };
1441
+ /**
1442
+ * Whether the tool use resulted in an error.
1443
+ *
1444
+ * If true, the content typically describes the error that occurred.
1445
+ * Default: false
1446
+ */
1447
+ isError?: boolean;
1448
+ /**
1449
+ * Optional metadata about the tool result. Clients SHOULD preserve this field when
1450
+ * including tool results in subsequent sampling requests to enable caching optimizations.
1451
+ *
1452
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
1453
+ */
1454
+ _meta?: {
1455
+ [key: string]: unknown;
1456
+ };
1457
+ }
1227
1458
  /**
1228
1459
  * The server's preferences for model selection, requested of the client during sampling.
1229
1460
  *
@@ -1236,6 +1467,8 @@ export interface AudioContent {
1236
1467
  * These preferences are always advisory. The client MAY ignore them. It is also
1237
1468
  * up to the client to decide how to interpret these preferences and how to
1238
1469
  * balance them against other considerations.
1470
+ *
1471
+ * @category `sampling/createMessage`
1239
1472
  */
1240
1473
  export interface ModelPreferences {
1241
1474
  /**
@@ -1284,6 +1517,8 @@ export interface ModelPreferences {
1284
1517
  *
1285
1518
  * Keys not declared here are currently left unspecified by the spec and are up
1286
1519
  * to the client to interpret.
1520
+ *
1521
+ * @category `sampling/createMessage`
1287
1522
  */
1288
1523
  export interface ModelHint {
1289
1524
  /**
@@ -1302,7 +1537,7 @@ export interface ModelHint {
1302
1537
  /**
1303
1538
  * Parameters for a `completion/complete` request.
1304
1539
  *
1305
- * @category completion/complete
1540
+ * @category `completion/complete`
1306
1541
  */
1307
1542
  export interface CompleteRequestParams extends RequestParams {
1308
1543
  ref: PromptReference | ResourceTemplateReference;
@@ -1334,7 +1569,7 @@ export interface CompleteRequestParams extends RequestParams {
1334
1569
  /**
1335
1570
  * A request from the client to the server, to ask for completion options.
1336
1571
  *
1337
- * @category completion/complete
1572
+ * @category `completion/complete`
1338
1573
  */
1339
1574
  export interface CompleteRequest extends JSONRPCRequest {
1340
1575
  method: "completion/complete";
@@ -1343,7 +1578,7 @@ export interface CompleteRequest extends JSONRPCRequest {
1343
1578
  /**
1344
1579
  * The server's response to a completion/complete request
1345
1580
  *
1346
- * @category completion/complete
1581
+ * @category `completion/complete`
1347
1582
  */
1348
1583
  export interface CompleteResult extends Result {
1349
1584
  completion: {
@@ -1363,6 +1598,8 @@ export interface CompleteResult extends Result {
1363
1598
  }
1364
1599
  /**
1365
1600
  * A reference to a resource or resource template definition.
1601
+ *
1602
+ * @category `completion/complete`
1366
1603
  */
1367
1604
  export interface ResourceTemplateReference {
1368
1605
  type: "ref/resource";
@@ -1375,6 +1612,8 @@ export interface ResourceTemplateReference {
1375
1612
  }
1376
1613
  /**
1377
1614
  * Identifies a prompt.
1615
+ *
1616
+ * @category `completion/complete`
1378
1617
  */
1379
1618
  export interface PromptReference extends BaseMetadata {
1380
1619
  type: "ref/prompt";
@@ -1388,7 +1627,7 @@ export interface PromptReference extends BaseMetadata {
1388
1627
  * This request is typically used when the server needs to understand the file system
1389
1628
  * structure or access specific locations that the client has permission to read from.
1390
1629
  *
1391
- * @category roots/list
1630
+ * @category `roots/list`
1392
1631
  */
1393
1632
  export interface ListRootsRequest extends JSONRPCRequest {
1394
1633
  method: "roots/list";
@@ -1399,13 +1638,15 @@ export interface ListRootsRequest extends JSONRPCRequest {
1399
1638
  * This result contains an array of Root objects, each representing a root directory
1400
1639
  * or file that the server can operate on.
1401
1640
  *
1402
- * @category roots/list
1641
+ * @category `roots/list`
1403
1642
  */
1404
1643
  export interface ListRootsResult extends Result {
1405
1644
  roots: Root[];
1406
1645
  }
1407
1646
  /**
1408
1647
  * Represents a root directory or file that the server can operate on.
1648
+ *
1649
+ * @category `roots/list`
1409
1650
  */
1410
1651
  export interface Root {
1411
1652
  /**
@@ -1434,20 +1675,24 @@ export interface Root {
1434
1675
  * This notification should be sent whenever the client adds, removes, or modifies any root.
1435
1676
  * The server should then request an updated list of roots using the ListRootsRequest.
1436
1677
  *
1437
- * @category notifications/roots/list_changed
1678
+ * @category `notifications/roots/list_changed`
1438
1679
  */
1439
1680
  export interface RootsListChangedNotification extends JSONRPCNotification {
1440
1681
  method: "notifications/roots/list_changed";
1441
1682
  params?: NotificationParams;
1442
1683
  }
1443
1684
  /**
1444
- * Parameters for an `elicitation/create` request.
1685
+ * The parameters for a request to elicit non-sensitive information from the user via a form in the client.
1445
1686
  *
1446
- * @category elicitation/create
1687
+ * @category `elicitation/create`
1447
1688
  */
1448
- export interface ElicitRequestParams extends RequestParams {
1689
+ export interface ElicitRequestFormParams extends RequestParams {
1690
+ /**
1691
+ * The elicitation mode.
1692
+ */
1693
+ mode?: "form";
1449
1694
  /**
1450
- * The message to present to the user.
1695
+ * The message to present to the user describing what information is being requested.
1451
1696
  */
1452
1697
  message: string;
1453
1698
  /**
@@ -1455,6 +1700,7 @@ export interface ElicitRequestParams extends RequestParams {
1455
1700
  * Only top-level properties are allowed, without nesting.
1456
1701
  */
1457
1702
  requestedSchema: {
1703
+ $schema?: string;
1458
1704
  type: "object";
1459
1705
  properties: {
1460
1706
  [key: string]: PrimitiveSchemaDefinition;
@@ -1462,10 +1708,42 @@ export interface ElicitRequestParams extends RequestParams {
1462
1708
  required?: string[];
1463
1709
  };
1464
1710
  }
1711
+ /**
1712
+ * The parameters for a request to elicit information from the user via a URL in the client.
1713
+ *
1714
+ * @category `elicitation/create`
1715
+ */
1716
+ export interface ElicitRequestURLParams extends RequestParams {
1717
+ /**
1718
+ * The elicitation mode.
1719
+ */
1720
+ mode: "url";
1721
+ /**
1722
+ * The message to present to the user explaining why the interaction is needed.
1723
+ */
1724
+ message: string;
1725
+ /**
1726
+ * The ID of the elicitation, which must be unique within the context of the server.
1727
+ * The client MUST treat this ID as an opaque value.
1728
+ */
1729
+ elicitationId: string;
1730
+ /**
1731
+ * The URL that the user should navigate to.
1732
+ *
1733
+ * @format uri
1734
+ */
1735
+ url: string;
1736
+ }
1737
+ /**
1738
+ * The parameters for a request to elicit additional information from the user via the client.
1739
+ *
1740
+ * @category `elicitation/create`
1741
+ */
1742
+ export type ElicitRequestParams = ElicitRequestFormParams | ElicitRequestURLParams;
1465
1743
  /**
1466
1744
  * A request from the server to elicit additional information from the user via the client.
1467
1745
  *
1468
- * @category elicitation/create
1746
+ * @category `elicitation/create`
1469
1747
  */
1470
1748
  export interface ElicitRequest extends JSONRPCRequest {
1471
1749
  method: "elicitation/create";
@@ -1474,8 +1752,13 @@ export interface ElicitRequest extends JSONRPCRequest {
1474
1752
  /**
1475
1753
  * Restricted schema definitions that only allow primitive types
1476
1754
  * without nested objects or arrays.
1755
+ *
1756
+ * @category `elicitation/create`
1477
1757
  */
1478
1758
  export type PrimitiveSchemaDefinition = StringSchema | NumberSchema | BooleanSchema | EnumSchema;
1759
+ /**
1760
+ * @category `elicitation/create`
1761
+ */
1479
1762
  export interface StringSchema {
1480
1763
  type: "string";
1481
1764
  title?: string;
@@ -1485,6 +1768,9 @@ export interface StringSchema {
1485
1768
  format?: "email" | "uri" | "date" | "date-time";
1486
1769
  default?: string;
1487
1770
  }
1771
+ /**
1772
+ * @category `elicitation/create`
1773
+ */
1488
1774
  export interface NumberSchema {
1489
1775
  type: "number" | "integer";
1490
1776
  title?: string;
@@ -1493,6 +1779,9 @@ export interface NumberSchema {
1493
1779
  maximum?: number;
1494
1780
  default?: number;
1495
1781
  }
1782
+ /**
1783
+ * @category `elicitation/create`
1784
+ */
1496
1785
  export interface BooleanSchema {
1497
1786
  type: "boolean";
1498
1787
  title?: string;
@@ -1501,6 +1790,8 @@ export interface BooleanSchema {
1501
1790
  }
1502
1791
  /**
1503
1792
  * Schema for single-selection enumeration without display titles for options.
1793
+ *
1794
+ * @category `elicitation/create`
1504
1795
  */
1505
1796
  export interface UntitledSingleSelectEnumSchema {
1506
1797
  type: "string";
@@ -1523,6 +1814,8 @@ export interface UntitledSingleSelectEnumSchema {
1523
1814
  }
1524
1815
  /**
1525
1816
  * Schema for single-selection enumeration with display titles for each option.
1817
+ *
1818
+ * @category `elicitation/create`
1526
1819
  */
1527
1820
  export interface TitledSingleSelectEnumSchema {
1528
1821
  type: "string";
@@ -1552,9 +1845,14 @@ export interface TitledSingleSelectEnumSchema {
1552
1845
  */
1553
1846
  default?: string;
1554
1847
  }
1848
+ /**
1849
+ * @category `elicitation/create`
1850
+ */
1555
1851
  export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema;
1556
1852
  /**
1557
1853
  * Schema for multiple-selection enumeration without display titles for options.
1854
+ *
1855
+ * @category `elicitation/create`
1558
1856
  */
1559
1857
  export interface UntitledMultiSelectEnumSchema {
1560
1858
  type: "array";
@@ -1591,6 +1889,8 @@ export interface UntitledMultiSelectEnumSchema {
1591
1889
  }
1592
1890
  /**
1593
1891
  * Schema for multiple-selection enumeration with display titles for each option.
1892
+ *
1893
+ * @category `elicitation/create`
1594
1894
  */
1595
1895
  export interface TitledMultiSelectEnumSchema {
1596
1896
  type: "array";
@@ -1633,10 +1933,15 @@ export interface TitledMultiSelectEnumSchema {
1633
1933
  */
1634
1934
  default?: string[];
1635
1935
  }
1936
+ /**
1937
+ * @category `elicitation/create`
1938
+ */
1636
1939
  export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema;
1637
1940
  /**
1638
1941
  * Use TitledSingleSelectEnumSchema instead.
1639
1942
  * This interface will be removed in a future version.
1943
+ *
1944
+ * @category `elicitation/create`
1640
1945
  */
1641
1946
  export interface LegacyTitledEnumSchema {
1642
1947
  type: "string";
@@ -1650,11 +1955,14 @@ export interface LegacyTitledEnumSchema {
1650
1955
  enumNames?: string[];
1651
1956
  default?: string;
1652
1957
  }
1958
+ /**
1959
+ * @category `elicitation/create`
1960
+ */
1653
1961
  export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema;
1654
1962
  /**
1655
1963
  * The client's response to an elicitation request.
1656
1964
  *
1657
- * @category elicitation/create
1965
+ * @category `elicitation/create`
1658
1966
  */
1659
1967
  export interface ElicitResult extends Result {
1660
1968
  /**
@@ -1665,13 +1973,28 @@ export interface ElicitResult extends Result {
1665
1973
  */
1666
1974
  action: "accept" | "decline" | "cancel";
1667
1975
  /**
1668
- * The submitted form data, only present when action is "accept".
1976
+ * The submitted form data, only present when action is "accept" and mode was "form".
1669
1977
  * Contains values matching the requested schema.
1978
+ * Omitted for out-of-band mode responses.
1670
1979
  */
1671
1980
  content?: {
1672
1981
  [key: string]: string | number | boolean | string[];
1673
1982
  };
1674
1983
  }
1984
+ /**
1985
+ * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
1986
+ *
1987
+ * @category `notifications/elicitation/complete`
1988
+ */
1989
+ export interface ElicitationCompleteNotification extends JSONRPCNotification {
1990
+ method: "notifications/elicitation/complete";
1991
+ params: {
1992
+ /**
1993
+ * The ID of the elicitation that completed.
1994
+ */
1995
+ elicitationId: string;
1996
+ };
1997
+ }
1675
1998
  /** @internal */
1676
1999
  export type ClientRequest = PingRequest | InitializeRequest | CompleteRequest | SetLevelRequest | GetPromptRequest | ListPromptsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | SubscribeRequest | UnsubscribeRequest | CallToolRequest | ListToolsRequest;
1677
2000
  /** @internal */
@@ -1681,7 +2004,7 @@ export type ClientResult = EmptyResult | CreateMessageResult | ListRootsResult |
1681
2004
  /** @internal */
1682
2005
  export type ServerRequest = PingRequest | CreateMessageRequest | ListRootsRequest | ElicitRequest;
1683
2006
  /** @internal */
1684
- export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification;
2007
+ export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification | ElicitationCompleteNotification;
1685
2008
  /** @internal */
1686
2009
  export type ServerResult = EmptyResult | InitializeResult | CompleteResult | GetPromptResult | ListPromptsResult | ListResourceTemplatesResult | ListResourcesResult | ReadResourceResult | CallToolResult | ListToolsResult;
1687
2010
  //# sourceMappingURL=spec.types.d.ts.map