@@ -138,6 +138,31 @@ import {
138138 ResourceUpdatedNotificationSchema ,
139139 // Task status
140140 TaskStatusNotificationSchema ,
141+ // Sampling schemas
142+ SamplingMessageSchema ,
143+ // Server/Client message type unions
144+ ServerRequestSchema ,
145+ ServerNotificationSchema ,
146+ ServerResultSchema ,
147+ ClientRequestSchema ,
148+ ClientNotificationSchema ,
149+ ClientResultSchema ,
150+ // Enum schemas
151+ SingleSelectEnumSchemaSchema ,
152+ MultiSelectEnumSchemaSchema ,
153+ UntitledSingleSelectEnumSchemaSchema ,
154+ TitledSingleSelectEnumSchemaSchema ,
155+ UntitledMultiSelectEnumSchemaSchema ,
156+ TitledMultiSelectEnumSchemaSchema ,
157+ LegacyTitledEnumSchemaSchema ,
158+ EnumSchemaSchema ,
159+ PrimitiveSchemaDefinitionSchema ,
160+ // Reference schemas
161+ PromptReferenceSchema ,
162+ ResourceTemplateReferenceSchema ,
163+ // ReadResource schemas
164+ ReadResourceRequestSchema ,
165+ ReadResourceResultSchema ,
141166} from './generated/sdk.schemas.js' ;
142167
143168// Alias RequestParamsSchema to BaseRequestParamsSchema for internal use
@@ -241,6 +266,26 @@ export {
241266 ProgressNotificationSchema ,
242267 ResourceUpdatedNotificationSchema ,
243268 TaskStatusNotificationSchema ,
269+ SamplingMessageSchema ,
270+ ServerRequestSchema ,
271+ ServerNotificationSchema ,
272+ ServerResultSchema ,
273+ ClientRequestSchema ,
274+ ClientNotificationSchema ,
275+ ClientResultSchema ,
276+ SingleSelectEnumSchemaSchema ,
277+ MultiSelectEnumSchemaSchema ,
278+ UntitledSingleSelectEnumSchemaSchema ,
279+ TitledSingleSelectEnumSchemaSchema ,
280+ UntitledMultiSelectEnumSchemaSchema ,
281+ TitledMultiSelectEnumSchemaSchema ,
282+ LegacyTitledEnumSchemaSchema ,
283+ EnumSchemaSchema ,
284+ PrimitiveSchemaDefinitionSchema ,
285+ PromptReferenceSchema ,
286+ ResourceTemplateReferenceSchema ,
287+ ReadResourceRequestSchema ,
288+ ReadResourceResultSchema ,
244289} ;
245290
246291export const LATEST_PROTOCOL_VERSION = '2025-11-25' ;
@@ -727,22 +772,8 @@ export const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
727772 */
728773export const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema ;
729774
730- /**
731- * Sent from the client to the server, to read a specific resource URI.
732- */
733- export const ReadResourceRequestSchema = RequestSchema . extend ( {
734- method : z . literal ( 'resources/read' ) ,
735- params : ReadResourceRequestParamsSchema
736- } ) ;
737-
738- /**
739- * The server's response to a resources/read request from the client.
740- */
741- export const ReadResourceResultSchema = ResultSchema . extend ( {
742- contents : z . array ( z . union ( [ TextResourceContentsSchema , BlobResourceContentsSchema ] ) )
743- } ) ;
744-
745- // Note: ResourceListChangedNotificationSchema is re-exported from generated.
775+ // Note: ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema
776+ // are re-exported from generated.
746777
747778export const SubscribeRequestParamsSchema = ResourceRequestParamsSchema ;
748779export const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema ;
@@ -1085,21 +1116,8 @@ export const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [
10851116 ToolResultContentSchema
10861117] ) ;
10871118
1088- /**
1089- * Describes a message issued to or received from an LLM API.
1090- */
1091- export const SamplingMessageSchema = z . object ( {
1092- role : RoleSchema ,
1093- content : z . union ( [ SamplingMessageContentBlockSchema , z . array ( SamplingMessageContentBlockSchema ) ] ) ,
1094- /**
1095- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
1096- * for notes on _meta usage.
1097- */
1098- _meta : z . record ( z . string ( ) , z . unknown ( ) ) . optional ( )
1099- } ) ;
1100-
1101- // Note: CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema
1102- // are re-exported from generated.
1119+ // Note: SamplingMessageSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema,
1120+ // CreateMessageResultSchema are re-exported from generated.
11031121
11041122/**
11051123 * The client's response to a sampling/create_message request when tools were provided.
@@ -1146,99 +1164,10 @@ export const StringSchemaSchema = z.object({
11461164 default : z . string ( ) . optional ( )
11471165} ) ;
11481166
1149- /**
1150- * Schema for single-selection enumeration without display titles for options.
1151- */
1152- export const UntitledSingleSelectEnumSchemaSchema = z . object ( {
1153- type : z . literal ( 'string' ) ,
1154- title : z . string ( ) . optional ( ) ,
1155- description : z . string ( ) . optional ( ) ,
1156- enum : z . array ( z . string ( ) ) ,
1157- default : z . string ( ) . optional ( )
1158- } ) ;
1159-
1160- /**
1161- * Schema for single-selection enumeration with display titles for each option.
1162- */
1163- export const TitledSingleSelectEnumSchemaSchema = z . object ( {
1164- type : z . literal ( 'string' ) ,
1165- title : z . string ( ) . optional ( ) ,
1166- description : z . string ( ) . optional ( ) ,
1167- oneOf : z . array (
1168- z . object ( {
1169- const : z . string ( ) ,
1170- title : z . string ( )
1171- } )
1172- ) ,
1173- default : z . string ( ) . optional ( )
1174- } ) ;
1175-
1176- /**
1177- * Use TitledSingleSelectEnumSchema instead.
1178- * This interface will be removed in a future version.
1179- */
1180- export const LegacyTitledEnumSchemaSchema = z . object ( {
1181- type : z . literal ( 'string' ) ,
1182- title : z . string ( ) . optional ( ) ,
1183- description : z . string ( ) . optional ( ) ,
1184- enum : z . array ( z . string ( ) ) ,
1185- enumNames : z . array ( z . string ( ) ) . optional ( ) ,
1186- default : z . string ( ) . optional ( )
1187- } ) ;
1188-
1189- // Combined single selection enumeration
1190- export const SingleSelectEnumSchemaSchema = z . union ( [ UntitledSingleSelectEnumSchemaSchema , TitledSingleSelectEnumSchemaSchema ] ) ;
1191-
1192- /**
1193- * Schema for multiple-selection enumeration without display titles for options.
1194- */
1195- export const UntitledMultiSelectEnumSchemaSchema = z . object ( {
1196- type : z . literal ( 'array' ) ,
1197- title : z . string ( ) . optional ( ) ,
1198- description : z . string ( ) . optional ( ) ,
1199- minItems : z . number ( ) . optional ( ) ,
1200- maxItems : z . number ( ) . optional ( ) ,
1201- items : z . object ( {
1202- type : z . literal ( 'string' ) ,
1203- enum : z . array ( z . string ( ) )
1204- } ) ,
1205- default : z . array ( z . string ( ) ) . optional ( )
1206- } ) ;
1207-
1208- /**
1209- * Schema for multiple-selection enumeration with display titles for each option.
1210- */
1211- export const TitledMultiSelectEnumSchemaSchema = z . object ( {
1212- type : z . literal ( 'array' ) ,
1213- title : z . string ( ) . optional ( ) ,
1214- description : z . string ( ) . optional ( ) ,
1215- minItems : z . number ( ) . optional ( ) ,
1216- maxItems : z . number ( ) . optional ( ) ,
1217- items : z . object ( {
1218- anyOf : z . array (
1219- z . object ( {
1220- const : z . string ( ) ,
1221- title : z . string ( )
1222- } )
1223- )
1224- } ) ,
1225- default : z . array ( z . string ( ) ) . optional ( )
1226- } ) ;
1227-
1228- /**
1229- * Combined schema for multiple-selection enumeration
1230- */
1231- export const MultiSelectEnumSchemaSchema = z . union ( [ UntitledMultiSelectEnumSchemaSchema , TitledMultiSelectEnumSchemaSchema ] ) ;
1232-
1233- /**
1234- * Primitive schema definition for enum fields.
1235- */
1236- export const EnumSchemaSchema = z . union ( [ LegacyTitledEnumSchemaSchema , SingleSelectEnumSchemaSchema , MultiSelectEnumSchemaSchema ] ) ;
1237-
1238- /**
1239- * Union of all primitive schema definitions.
1240- */
1241- export const PrimitiveSchemaDefinitionSchema = z . union ( [ EnumSchemaSchema , BooleanSchemaSchema , StringSchemaSchema , NumberSchemaSchema ] ) ;
1167+ // Note: Enum schemas (UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema,
1168+ // LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema,
1169+ // TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema,
1170+ // PrimitiveSchemaDefinitionSchema) are re-exported from generated.
12421171
12431172// Note: ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema, ElicitRequestParamsSchema,
12441173// ElicitRequestSchema, ElicitResultSchema, ElicitationCompleteNotificationSchema are re-exported from generated.
@@ -1256,33 +1185,13 @@ export const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSc
12561185} ) ;
12571186
12581187/* Autocomplete */
1259- /**
1260- * A reference to a resource or resource template definition.
1261- */
1262- export const ResourceTemplateReferenceSchema = z . object ( {
1263- type : z . literal ( 'ref/resource' ) ,
1264- /**
1265- * The URI or URI template of the resource.
1266- */
1267- uri : z . string ( )
1268- } ) ;
1188+ // Note: ResourceTemplateReferenceSchema, PromptReferenceSchema are re-exported from generated.
12691189
12701190/**
12711191 * @deprecated Use ResourceTemplateReferenceSchema instead
12721192 */
12731193export const ResourceReferenceSchema = ResourceTemplateReferenceSchema ;
12741194
1275- /**
1276- * Identifies a prompt.
1277- */
1278- export const PromptReferenceSchema = z . object ( {
1279- type : z . literal ( 'ref/prompt' ) ,
1280- /**
1281- * The name of the prompt or prompt template
1282- */
1283- name : z . string ( )
1284- } ) ;
1285-
12861195// Note: CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema
12871196// are re-exported from generated.
12881197
@@ -1304,85 +1213,9 @@ export function assertCompleteRequestResourceTemplate(request: CompleteRequest):
13041213// Note: RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema
13051214// are re-exported from generated.
13061215
1307- /* Client messages */
1308- export const ClientRequestSchema = z . union ( [
1309- PingRequestSchema ,
1310- InitializeRequestSchema ,
1311- CompleteRequestSchema ,
1312- SetLevelRequestSchema ,
1313- GetPromptRequestSchema ,
1314- ListPromptsRequestSchema ,
1315- ListResourcesRequestSchema ,
1316- ListResourceTemplatesRequestSchema ,
1317- ReadResourceRequestSchema ,
1318- SubscribeRequestSchema ,
1319- UnsubscribeRequestSchema ,
1320- CallToolRequestSchema ,
1321- ListToolsRequestSchema ,
1322- GetTaskRequestSchema ,
1323- GetTaskPayloadRequestSchema ,
1324- ListTasksRequestSchema ,
1325- CancelTaskRequestSchema
1326- ] ) ;
1327-
1328- export const ClientNotificationSchema = z . union ( [
1329- CancelledNotificationSchema ,
1330- ProgressNotificationSchema ,
1331- InitializedNotificationSchema ,
1332- RootsListChangedNotificationSchema ,
1333- TaskStatusNotificationSchema
1334- ] ) ;
1335-
1336- export const ClientResultSchema = z . union ( [
1337- EmptyResultSchema ,
1338- CreateMessageResultSchema ,
1339- CreateMessageResultWithToolsSchema ,
1340- ElicitResultSchema ,
1341- ListRootsResultSchema ,
1342- GetTaskResultSchema ,
1343- ListTasksResultSchema ,
1344- CreateTaskResultSchema
1345- ] ) ;
1346-
1347- /* Server messages */
1348- export const ServerRequestSchema = z . union ( [
1349- PingRequestSchema ,
1350- CreateMessageRequestSchema ,
1351- ElicitRequestSchema ,
1352- ListRootsRequestSchema ,
1353- GetTaskRequestSchema ,
1354- GetTaskPayloadRequestSchema ,
1355- ListTasksRequestSchema ,
1356- CancelTaskRequestSchema
1357- ] ) ;
1358-
1359- export const ServerNotificationSchema = z . union ( [
1360- CancelledNotificationSchema ,
1361- ProgressNotificationSchema ,
1362- LoggingMessageNotificationSchema ,
1363- ResourceUpdatedNotificationSchema ,
1364- ResourceListChangedNotificationSchema ,
1365- ToolListChangedNotificationSchema ,
1366- PromptListChangedNotificationSchema ,
1367- TaskStatusNotificationSchema ,
1368- ElicitationCompleteNotificationSchema
1369- ] ) ;
1370-
1371- export const ServerResultSchema = z . union ( [
1372- EmptyResultSchema ,
1373- InitializeResultSchema ,
1374- CompleteResultSchema ,
1375- GetPromptResultSchema ,
1376- ListPromptsResultSchema ,
1377- ListResourcesResultSchema ,
1378- ListResourceTemplatesResultSchema ,
1379- ReadResourceResultSchema ,
1380- CallToolResultSchema ,
1381- ListToolsResultSchema ,
1382- GetTaskResultSchema ,
1383- ListTasksResultSchema ,
1384- CreateTaskResultSchema
1385- ] ) ;
1216+ /* Client/Server message types */
1217+ // Note: ClientRequestSchema, ClientNotificationSchema, ClientResultSchema,
1218+ // ServerRequestSchema, ServerNotificationSchema, ServerResultSchema are re-exported from generated.
13861219
13871220export class McpError extends Error {
13881221 constructor (
0 commit comments