@@ -250,46 +250,30 @@ server.tool(
250250) ;
251251
252252// request: Webflow.collections.ItemsCreateItemLiveRequest
253- const WebflowCollectionsItemsCreateItemLiveRequestSchema = z . union ( [
254- z . object ( {
255- id : z . string ( ) . optional ( ) ,
256- cmsLocaleId : z . string ( ) . optional ( ) ,
257- lastPublished : z . string ( ) . optional ( ) ,
258- lastUpdated : z . string ( ) . optional ( ) ,
259- createdOn : z . string ( ) . optional ( ) ,
260- isArchived : z . boolean ( ) . optional ( ) ,
261- isDraft : z . boolean ( ) . optional ( ) ,
262- fieldData : z . record ( z . any ( ) ) . and (
253+ const WebflowCollectionsItemsCreateItemLiveRequestSchema = z . object ( {
254+ items : z
255+ . array (
263256 z . object ( {
264- name : z . string ( ) ,
265- slug : z . string ( ) ,
257+ id : z . string ( ) . optional ( ) ,
258+ cmsLocaleId : z . string ( ) . optional ( ) ,
259+ lastPublished : z . string ( ) . optional ( ) ,
260+ lastUpdated : z . string ( ) . optional ( ) ,
261+ createdOn : z . string ( ) . optional ( ) ,
262+ isArchived : z . boolean ( ) . optional ( ) ,
263+ isDraft : z . boolean ( ) . optional ( ) ,
264+ fieldData : z . record ( z . any ( ) ) . and (
265+ z . object ( {
266+ name : z . string ( ) ,
267+ slug : z . string ( ) ,
268+ } )
269+ ) ,
266270 } )
267- ) ,
268- } ) ,
269- z . object ( {
270- items : z
271- . array (
272- z . object ( {
273- id : z . string ( ) . optional ( ) ,
274- cmsLocaleId : z . string ( ) . optional ( ) ,
275- lastPublished : z . string ( ) . optional ( ) ,
276- lastUpdated : z . string ( ) . optional ( ) ,
277- createdOn : z . string ( ) . optional ( ) ,
278- isArchived : z . boolean ( ) . optional ( ) ,
279- isDraft : z . boolean ( ) . optional ( ) ,
280- fieldData : z . record ( z . any ( ) ) . and (
281- z . object ( {
282- name : z . string ( ) ,
283- slug : z . string ( ) ,
284- } )
285- ) ,
286- } )
287- )
288- . optional ( ) ,
289- } ) ,
290- ] ) ;
271+ )
272+ . optional ( ) ,
273+ } ) ;
291274
292275// POST https://api.webflow.com/v2/collections/:collection_id/items/live
276+ // NOTE: Cursor agent seems to struggle when provided with z.union(...), so we simplify the type here
293277server . tool (
294278 "collections-items-create-item-live" ,
295279 {
@@ -364,7 +348,16 @@ server.tool(
364348 sortBy : z . enum ( [ "lastPublished" , "name" , "slug" ] ) . optional ( ) ,
365349 sortOrder : z . enum ( [ "asc" , "desc" ] ) . optional ( ) ,
366350 } ,
367- async ( { collection_id, cmsLocaleId, offset, limit, name, slug, sortBy, sortOrder } ) => {
351+ async ( {
352+ collection_id,
353+ cmsLocaleId,
354+ offset,
355+ limit,
356+ name,
357+ slug,
358+ sortBy,
359+ sortOrder,
360+ } ) => {
368361 const response = await client . collections . items . listItems ( collection_id , {
369362 cmsLocaleId,
370363 offset,
@@ -392,18 +385,16 @@ export const CollectionItemPostSingleSchema = z.object({
392385 fieldData : z . record ( z . any ( ) ) . and (
393386 z . object ( {
394387 name : z . string ( ) ,
395- slug : z . string ( )
388+ slug : z . string ( ) ,
396389 } )
397- )
398- } )
390+ ) ,
391+ } ) ;
399392
400393// request: Webflow.collections.ItemsCreateItemRequest
401- const WebflowCollectionsItemsCreateItemRequestSchema = z . union ( [
402- CollectionItemPostSingleSchema ,
403- z . object ( {
404- items : z . array ( CollectionItemPostSingleSchema ) . optional ( )
405- } )
406- ] )
394+ // NOTE: Cursor agent seems to struggle when provided with z.union(...), so we simplify the type here
395+ const WebflowCollectionsItemsCreateItemRequestSchema = z . object ( {
396+ items : z . array ( CollectionItemPostSingleSchema ) . optional ( ) ,
397+ } ) ;
407398
408399// POST https://api.webflow.com/v2/collections/:collection_id/items
409400server . tool (
@@ -413,7 +404,10 @@ server.tool(
413404 request : WebflowCollectionsItemsCreateItemRequestSchema ,
414405 } ,
415406 async ( { collection_id, request } ) => {
416- const response = await client . collections . items . createItem ( collection_id , request )
407+ const response = await client . collections . items . createItem (
408+ collection_id ,
409+ request
410+ ) ;
417411 return {
418412 content : [ { type : "text" , text : JSON . stringify ( response ) } ] ,
419413 } ;
@@ -434,14 +428,13 @@ export const CollectionItemWithIdInputSchema = z.object({
434428 name : z . string ( ) ,
435429 slug : z . string ( ) ,
436430 } )
437- )
438- } )
439-
431+ ) ,
432+ } ) ;
440433
441434// request: Webflow.collections.ItemsUpdateItemsRequest
442435const WebflowCollectionsItemsUpdateItemsRequestSchema = z . object ( {
443- items : z . array ( CollectionItemWithIdInputSchema ) . optional ( )
444- } )
436+ items : z . array ( CollectionItemWithIdInputSchema ) . optional ( ) ,
437+ } ) ;
445438
446439// PATCH https://api.webflow.com/v2/collections/:collection_id/items
447440server . tool (
@@ -451,7 +444,10 @@ server.tool(
451444 request : WebflowCollectionsItemsUpdateItemsRequestSchema ,
452445 } ,
453446 async ( { collection_id, request } ) => {
454- const response = await client . collections . items . updateItems ( collection_id , request )
447+ const response = await client . collections . items . updateItems (
448+ collection_id ,
449+ request
450+ ) ;
455451 return {
456452 content : [ { type : "text" , text : JSON . stringify ( response ) } ] ,
457453 } ;
@@ -467,13 +463,13 @@ server.tool(
467463 } ,
468464 async ( { collection_id, itemIds } ) => {
469465 const response = await client . collections . items . publishItem ( collection_id , {
470- itemIds : itemIds
466+ itemIds : itemIds ,
471467 } ) ;
472468 return {
473469 content : [ { type : "text" , text : JSON . stringify ( response ) } ] ,
474470 } ;
475471 }
476- )
472+ ) ;
477473
478474// Start receiving messages on stdin and sending messages on stdout
479475const transport = new StdioServerTransport ( ) ;
0 commit comments