@@ -16,6 +16,21 @@ import {
1616 RoleSchema ,
1717 TaskStatusSchema ,
1818 LoggingLevelSchema ,
19+ // Base metadata schemas (IconSchema adds 'theme' field from latest spec)
20+ IconSchema ,
21+ IconsSchema ,
22+ BaseMetadataSchema ,
23+ // ImplementationSchema adds 'description' field from latest spec
24+ ImplementationSchema ,
25+ // Error schema for JSON-RPC errors
26+ ErrorSchema ,
27+ // Task-related schemas
28+ TaskMetadataSchema ,
29+ RelatedTaskMetadataSchema ,
30+ // Sampling-related schemas
31+ ModelHintSchema ,
32+ ModelPreferencesSchema ,
33+ ToolChoiceSchema ,
1934} from './generated/sdk.schemas.js' ;
2035
2136export {
@@ -25,6 +40,16 @@ export {
2540 RoleSchema ,
2641 TaskStatusSchema ,
2742 LoggingLevelSchema ,
43+ IconSchema ,
44+ IconsSchema ,
45+ BaseMetadataSchema ,
46+ ImplementationSchema ,
47+ ErrorSchema ,
48+ TaskMetadataSchema ,
49+ RelatedTaskMetadataSchema ,
50+ ModelHintSchema ,
51+ ModelPreferencesSchema ,
52+ ToolChoiceSchema ,
2853} ;
2954
3055export const LATEST_PROTOCOL_VERSION = '2025-11-25' ;
@@ -63,18 +88,6 @@ export const TaskCreationParamsSchema = z.looseObject({
6388 pollInterval : z . number ( ) . optional ( )
6489} ) ;
6590
66- export const TaskMetadataSchema = z . object ( {
67- ttl : z . number ( ) . optional ( )
68- } ) ;
69-
70- /**
71- * Metadata for associating messages with a task.
72- * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
73- */
74- export const RelatedTaskMetadataSchema = z . object ( {
75- taskId : z . string ( )
76- } ) ;
77-
7891const RequestMetaSchema = z . looseObject ( {
7992 /**
8093 * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
@@ -272,78 +285,7 @@ export const CancelledNotificationSchema = NotificationSchema.extend({
272285 params : CancelledNotificationParamsSchema
273286} ) ;
274287
275- /* Base Metadata */
276- /**
277- * Icon schema for use in tools, prompts, resources, and implementations.
278- */
279- export const IconSchema = z . object ( {
280- /**
281- * URL or data URI for the icon.
282- */
283- src : z . string ( ) ,
284- /**
285- * Optional MIME type for the icon.
286- */
287- mimeType : z . string ( ) . optional ( ) ,
288- /**
289- * Optional array of strings that specify sizes at which the icon can be used.
290- * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
291- *
292- * If not provided, the client should assume that the icon can be used at any size.
293- */
294- sizes : z . array ( z . string ( ) ) . optional ( )
295- } ) ;
296-
297- /**
298- * Base schema to add `icons` property.
299- *
300- */
301- export const IconsSchema = z . object ( {
302- /**
303- * Optional set of sized icons that the client can display in a user interface.
304- *
305- * Clients that support rendering icons MUST support at least the following MIME types:
306- * - `image/png` - PNG images (safe, universal compatibility)
307- * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
308- *
309- * Clients that support rendering icons SHOULD also support:
310- * - `image/svg+xml` - SVG images (scalable but requires security precautions)
311- * - `image/webp` - WebP images (modern, efficient format)
312- */
313- icons : z . array ( IconSchema ) . optional ( )
314- } ) ;
315-
316- /**
317- * Base metadata interface for common properties across resources, tools, prompts, and implementations.
318- */
319- export const BaseMetadataSchema = z . object ( {
320- /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
321- name : z . string ( ) ,
322- /**
323- * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
324- * even by those unfamiliar with domain-specific terminology.
325- *
326- * If not provided, the name should be used for display (except for Tool,
327- * where `annotations.title` should be given precedence over using `name`,
328- * if present).
329- */
330- title : z . string ( ) . optional ( )
331- } ) ;
332-
333288/* Initialization */
334- /**
335- * Describes the name and version of an MCP implementation.
336- */
337- export const ImplementationSchema = BaseMetadataSchema . extend ( {
338- ...BaseMetadataSchema . shape ,
339- ...IconsSchema . shape ,
340- version : z . string ( ) ,
341- /**
342- * An optional URL of the website for this implementation.
343- */
344- websiteUrl : z . string ( ) . optional ( )
345- } ) ;
346-
347289const FormElicitationCapabilitySchema = z . intersection (
348290 z . object ( {
349291 applyDefaults : z . boolean ( ) . optional ( )
@@ -1578,51 +1520,6 @@ export const LoggingMessageNotificationSchema = NotificationSchema.extend({
15781520} ) ;
15791521
15801522/* Sampling */
1581- /**
1582- * Hints to use for model selection.
1583- */
1584- export const ModelHintSchema = z . object ( {
1585- /**
1586- * A hint for a model name.
1587- */
1588- name : z . string ( ) . optional ( )
1589- } ) ;
1590-
1591- /**
1592- * The server's preferences for model selection, requested of the client during sampling.
1593- */
1594- export const ModelPreferencesSchema = z . object ( {
1595- /**
1596- * Optional hints to use for model selection.
1597- */
1598- hints : z . array ( ModelHintSchema ) . optional ( ) ,
1599- /**
1600- * How much to prioritize cost when selecting a model.
1601- */
1602- costPriority : z . number ( ) . min ( 0 ) . max ( 1 ) . optional ( ) ,
1603- /**
1604- * How much to prioritize sampling speed (latency) when selecting a model.
1605- */
1606- speedPriority : z . number ( ) . min ( 0 ) . max ( 1 ) . optional ( ) ,
1607- /**
1608- * How much to prioritize intelligence and capabilities when selecting a model.
1609- */
1610- intelligencePriority : z . number ( ) . min ( 0 ) . max ( 1 ) . optional ( )
1611- } ) ;
1612-
1613- /**
1614- * Controls tool usage behavior in sampling requests.
1615- */
1616- export const ToolChoiceSchema = z . object ( {
1617- /**
1618- * Controls when tools are used:
1619- * - "auto": Model decides whether to use tools (default)
1620- * - "required": Model MUST use at least one tool before completing
1621- * - "none": Model MUST NOT use any tools
1622- */
1623- mode : z . enum ( [ 'auto' , 'required' , 'none' ] ) . optional ( )
1624- } ) ;
1625-
16261523/**
16271524 * The result of a tool execution, provided by the user (server).
16281525 * Represents the outcome of invoking a tool requested via ToolUseContent.
0 commit comments