@@ -274,27 +274,27 @@ export const ImplementationSchema = BaseMetadataSchema.extend({
274274 websiteUrl : z . string ( ) . optional ( )
275275} ) . merge ( IconsSchema ) ;
276276
277- const ElicitationCapabilitySchema = z
278- . preprocess (
279- value => {
280- if ( value && typeof value === 'object' && ! Array . isArray ( value ) ) {
281- const hasForm = Object . prototype . hasOwnProperty . call ( value , 'form' ) ;
282- const hasUrl = Object . prototype . hasOwnProperty . call ( value , 'url' ) ;
283- if ( ! hasForm && ! hasUrl ) {
284- return { ...( value as Record < string , unknown > ) , form : { } } ;
285- }
277+ const ElicitationCapabilitySchema = z . preprocess (
278+ value => {
279+ if ( value && typeof value === 'object' && ! Array . isArray ( value ) ) {
280+ const recordValue = value as Record < string , unknown > ;
281+ const hasForm = Object . prototype . hasOwnProperty . call ( recordValue , 'form' ) ;
282+ const hasUrl = Object . prototype . hasOwnProperty . call ( recordValue , 'url' ) ;
283+ if ( ! hasForm && ! hasUrl ) {
284+ return { ...recordValue , form : { } } ;
286285 }
287- return value ;
288- } ,
289- z
290- . object ( {
291- applyDefaults : z . boolean ( ) . optional ( ) ,
292- form : z . object ( { } ) . passthrough ( ) . optional ( ) ,
293- url : z . object ( { } ) . passthrough ( ) . optional ( )
294- } )
295- . passthrough ( )
286+ }
287+ return value ;
288+ } ,
289+ z . intersection (
290+ z . object ( {
291+ applyDefaults : z . boolean ( ) . optional ( ) ,
292+ form : AssertObjectSchema . optional ( ) ,
293+ url : AssertObjectSchema . optional ( )
294+ } ) ,
295+ z . record ( z . string ( ) , z . unknown ( ) )
296296 )
297- . optional ( ) ;
297+ ) ;
298298
299299/**
300300 * 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.
@@ -311,7 +311,7 @@ export const ClientCapabilitiesSchema = z.object({
311311 /**
312312 * Present if the client supports eliciting user input.
313313 */
314- elicitation : ElicitationCapabilitySchema ,
314+ elicitation : ElicitationCapabilitySchema . optional ( ) ,
315315 /**
316316 * Present if the client supports listing roots.
317317 */
0 commit comments