collections_items_create_item
Create and add new items to a specific collection in Webflow using the collection ID and item details, including field data, CMS locale, and publication status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | Yes | ||
| request | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"collection_id": {
"type": "string"
},
"request": {
"additionalProperties": false,
"properties": {
"items": {
"items": {
"additionalProperties": false,
"properties": {
"cmsLocaleId": {
"type": "string"
},
"createdOn": {
"type": "string"
},
"fieldData": {
"allOf": [
{
"additionalProperties": {},
"type": "object"
},
{
"properties": {
"name": {
"type": "string"
},
"slug": {
"type": "string"
}
},
"required": [
"name",
"slug"
],
"type": "object"
}
]
},
"id": {
"type": "string"
},
"isArchived": {
"type": "boolean"
},
"isDraft": {
"type": "boolean"
},
"lastPublished": {
"type": "string"
},
"lastUpdated": {
"type": "string"
}
},
"required": [
"fieldData"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
},
"required": [
"collection_id",
"request"
],
"type": "object"
}
Implementation Reference
- src/tools/cms.ts:299-318 (registration)Registration of the 'collections_items_create_item' tool, including input schema reference and handler function.server.tool( "collections_items_create_item", "Create new items in a CMS collection as drafts.", { collection_id: z.string(), request: WebflowCollectionsItemsCreateItemRequestSchema, }, async ({ collection_id, request }) => { try { const response = await getClient().collections.items.createItem( collection_id, request, requestOptions ); return formatResponse(response); } catch (error) { return formatErrorResponse(error); } } );
- src/tools/cms.ts:306-317 (handler)The handler function that executes the tool logic by calling Webflow API to create CMS items.async ({ collection_id, request }) => { try { const response = await getClient().collections.items.createItem( collection_id, request, requestOptions ); return formatResponse(response); } catch (error) { return formatErrorResponse(error); } }
- Zod input schema defining the structure for creating CMS items (array of items).export const WebflowCollectionsItemsCreateItemRequestSchema = z.object({ items: z.array(CollectionItemPostSingleSchema).optional(), });