collections_items_list_items
Retrieve CMS collection items with filtering, sorting, and pagination options to manage content efficiently.
Instructions
List items in a CMS collection with optional filtering and sorting.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | Yes | Unique identifier for the Collection. | |
| cmsLocaleId | No | Unique identifier for the locale of the CMS Item. | |
| limit | No | Maximum number of records to be returned (max limit: 100) | |
| offset | No | Offset used for pagination if the results have more than limit records. | |
| name | No | Name of the field. | |
| slug | No | URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. | |
| sortBy | No | Field to sort the items by. Allowed values: lastPublished, name, slug. | |
| sortOrder | No | Order to sort the items by. Allowed values: asc, desc. |
Implementation Reference
- src/tools/cms.ts:272-338 (registration)Registers the 'collections_items_list_items' MCP tool, defining its input schema, title, description, and handler function.server.registerTool( "collections_items_list_items", { title: "List Collection Items", description: "List items in a CMS collection with optional filtering and sorting.", inputSchema: z.object({ collection_id: z .string() .describe("Unique identifier for the Collection."), cmsLocaleId: z .string() .optional() .describe("Unique identifier for the locale of the CMS Item."), limit: z .number() .optional() .describe( "Maximum number of records to be returned (max limit: 100)" ), offset: z .number() .optional() .describe( "Offset used for pagination if the results have more than limit records." ), name: z.string().optional().describe("Name of the field."), slug: z .string() .optional() .describe( "URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug." ), sortBy: WebflowCollectionsItemsListItemsRequestSortBySchema, sortOrder: WebflowCollectionsItemsListItemsRequestSortOrderSchema, }), }, async ({ collection_id, cmsLocaleId, offset, limit, name, slug, sortBy, sortOrder, }) => { try { const response = await getClient().collections.items.listItems( collection_id, { cmsLocaleId, offset, limit, name, slug, sortBy, sortOrder, }, requestOptions ); return formatResponse(response); } catch (error) { return formatErrorResponse(error); } } );
- src/tools/cms.ts:309-337 (handler)The handler function that invokes the Webflow API to list items in a collection with provided filters, sorting, and pagination.async ({ collection_id, cmsLocaleId, offset, limit, name, slug, sortBy, sortOrder, }) => { try { const response = await getClient().collections.items.listItems( collection_id, { cmsLocaleId, offset, limit, name, slug, sortBy, sortOrder, }, requestOptions ); return formatResponse(response); } catch (error) { return formatErrorResponse(error); } }
- Zod schema defining the allowed sort order values ('asc', 'desc') for the tool input.export const WebflowCollectionsItemsListItemsRequestSortOrderSchema = z .enum(["asc", "desc"]) .optional() .describe("Order to sort the items by. Allowed values: asc, desc.");
- Zod schema defining the allowed sort by fields ('lastPublished', 'name', 'slug') for the tool input.export const WebflowCollectionsItemsListItemsRequestSortBySchema = z .enum(["lastPublished", "name", "slug"]) .optional() .describe( "Field to sort the items by. Allowed values: lastPublished, name, slug." );