@@ -249,6 +249,139 @@ server.tool(
249249 }
250250) ;
251251
252+ export const StaticFieldSchema = z . object ( {
253+ id : z . string ( ) . optional ( ) ,
254+ isEditable : z . boolean ( ) . optional ( ) ,
255+ isRequired : z . boolean ( ) . optional ( ) ,
256+ type : z . union ( [
257+ z . literal ( "Color" ) ,
258+ z . literal ( "DateTime" ) ,
259+ z . literal ( "Email" ) ,
260+ z . literal ( "File" ) ,
261+ z . literal ( "Image" ) ,
262+ z . literal ( "Link" ) ,
263+ z . literal ( "MultiImage" ) ,
264+ z . literal ( "Number" ) ,
265+ z . literal ( "Phone" ) ,
266+ z . literal ( "PlainText" ) ,
267+ z . literal ( "RichText" ) ,
268+ z . literal ( "Switch" ) ,
269+ z . literal ( "Video" )
270+ ] ) ,
271+ displayName : z . string ( ) ,
272+ helpText : z . string ( ) . optional ( )
273+ } )
274+
275+ export const OptionFieldSchema = z . object ( {
276+ id : z . string ( ) . optional ( ) ,
277+ isEditable : z . boolean ( ) . optional ( ) ,
278+ isRequired : z . boolean ( ) . optional ( ) ,
279+ type : z . literal ( "Option" ) ,
280+ displayName : z . string ( ) ,
281+ helpText : z . string ( ) . optional ( ) ,
282+ metadata : z . object ( {
283+ options : z . array (
284+ z . object ( {
285+ name : z . string ( ) ,
286+ id : z . string ( ) . optional ( )
287+ } )
288+ )
289+ } )
290+ } )
291+
292+ export const ReferenceFieldSchema = z . object ( {
293+ id : z . string ( ) . optional ( ) ,
294+ isEditable : z . boolean ( ) . optional ( ) ,
295+ isRequired : z . boolean ( ) . optional ( ) ,
296+ type : z . union ( [ z . literal ( "MultiReference" ) , z . literal ( "Reference" ) ] ) ,
297+ displayName : z . string ( ) ,
298+ helpText : z . string ( ) . optional ( ) ,
299+ metadata : z . object ( {
300+ collectionId : z . string ( )
301+ } )
302+ } )
303+
304+ // request: Webflow.CollectionsCreateRequest
305+ // NOTE: Cursor agent seems to struggle when provided with z.union(...), so we simplify the type here
306+ export const WebflowCollectionsCreateRequestSchema = z . object ( {
307+ displayName : z . string ( ) ,
308+ singularName : z . string ( ) ,
309+ slug : z . string ( ) . optional ( ) ,
310+ } )
311+
312+ // POST https://api.webflow.com/v2/sites/:site_id/collections
313+ server . tool (
314+ "collections_create" ,
315+ {
316+ site_id : z . string ( ) ,
317+ request : WebflowCollectionsCreateRequestSchema
318+ } ,
319+ async ( { site_id, request } ) => {
320+ const response = await client . collections . create ( site_id , request ) ;
321+ return { content : [ { type : "text" , text : JSON . stringify ( response ) } ] } ;
322+ }
323+ ) ;
324+
325+ // POST https://api.webflow.com/v2/collections/:collection_id/fields
326+ server . tool (
327+ "collection_fields_create_static" ,
328+ {
329+ collection_id : z . string ( ) ,
330+ request : StaticFieldSchema
331+ } ,
332+ async ( { collection_id, request } ) => {
333+ const response = await client . collections . fields . create ( collection_id , request ) ;
334+ return { content : [ { type : "text" , text : JSON . stringify ( response ) } ] } ;
335+ }
336+ )
337+
338+ // POST https://api.webflow.com/v2/collections/:collection_id/fields
339+ server . tool (
340+ "collection_fields_create_option" ,
341+ {
342+ collection_id : z . string ( ) ,
343+ request : OptionFieldSchema
344+ } ,
345+ async ( { collection_id, request } ) => {
346+ const response = await client . collections . fields . create ( collection_id , request ) ;
347+ return { content : [ { type : "text" , text : JSON . stringify ( response ) } ] } ;
348+ }
349+ )
350+
351+ // POST https://api.webflow.com/v2/collections/:collection_id/fields
352+ server . tool (
353+ "collection_fields_create_reference" ,
354+ {
355+ collection_id : z . string ( ) ,
356+ request : ReferenceFieldSchema
357+ } ,
358+ async ( { collection_id, request } ) => {
359+ const response = await client . collections . fields . create ( collection_id , request ) ;
360+ return { content : [ { type : "text" , text : JSON . stringify ( response ) } ] } ;
361+ }
362+ )
363+
364+ // request: Webflow.collections.FieldUpdate
365+ export const WebflowCollectionsFieldUpdateSchema = z . object ( {
366+ isRequired : z . boolean ( ) . optional ( ) ,
367+ displayName : z . string ( ) . optional ( ) ,
368+ helpText : z . string ( ) . optional ( )
369+ } )
370+
371+ // PATCH https://api.webflow.com/v2/collections/:collection_id/fields/:field_id
372+ server . tool (
373+ "collection_fields_update" ,
374+ {
375+ collection_id : z . string ( ) ,
376+ field_id : z . string ( ) ,
377+ request : WebflowCollectionsFieldUpdateSchema
378+ } ,
379+ async ( { collection_id, field_id, request } ) => {
380+ const response = await client . collections . fields . update ( collection_id , field_id , request ) ;
381+ return { content : [ { type : "text" , text : JSON . stringify ( response ) } ] } ;
382+ }
383+ )
384+
252385// request: Webflow.collections.ItemsCreateItemLiveRequest
253386const WebflowCollectionsItemsCreateItemLiveRequestSchema = z . object ( {
254387 items : z
0 commit comments