List Entries
list_entriesFetch content entries from a collection using filters, sorting, and pagination. Apply complex queries with the 'where' parameter.
Instructions
List content entries for a collection with advanced filtering, sorting, and pagination. Use the 'where' parameter for powerful queries. Read the 'query-reference' resource for full documentation on operators and examples.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_slug | Yes | The collection slug | |
| where | No | Filter conditions as a nested object. Supports operators: eq, lt, lte, gt, gte, not, like, in, not_in, null, not_null, between, not_between. Simple: { "status": "published" }. With operators: { "price": { "lt": 50 }, "title": { "like": "news" } }. OR group: { "or": [{ "tags": "clearance" }, { "campaign": { "name": "Summer" } }] }. Relation filter: { "author": { "name": { "eq": "John" } } }. Core columns (id, uuid, locale, status, created_at, updated_at, published_at) can be filtered directly. | |
| locale | No | Filter by locale (e.g. 'en') | |
| state | No | Filter by state: 'only_draft' or 'with_draft'. Defaults to published entries only. | |
| sort | No | Sort by field:direction, comma-separated for multiple. Examples: 'created_at:desc', 'title:asc,created_at:desc'. Supports core columns (id, created_at, updated_at, published_at) and custom field names. | |
| paginate | No | Enable pagination with N items per page. Returns paginated response with meta data. Overrides limit/offset. | |
| limit | No | Limit the number of results (ignored if paginate is set) | |
| offset | No | Skip N results (requires limit to be set) | |
| first | No | If true, return only the first matching entry as a single object instead of an array | |
| count | No | If true, return only the count of matching entries: { count: N } | |
| exclude | No | Comma-separated field names to exclude from response (e.g. 'content,excerpt') |
Implementation Reference
- src/tools/content.ts:69-90 (handler)The async handler function for the 'list_entries' tool. It accepts the input parameters, constructs query params, makes a GET request via the client, and returns the JSON result.
}, async ({ collection_slug, where, locale, state, sort, paginate, limit, offset, first, count, exclude }) => { const params: Record<string, unknown> = {}; if (locale) params.locale = locale; if (state) params.state = state; if (sort) params.sort = sort; if (paginate) params.paginate = paginate; if (limit) params.limit = limit; if (offset) params.offset = offset; if (first) params.first = 1; if (count) params.count = 1; if (exclude) params.exclude = exclude; // Pass where as a nested object — the client will flatten to bracket notation if (where) { params.where = where; } const result = await client.get(`/${collection_slug}`, params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/tools/content.ts:11-68 (schema)The input schema for the 'list_entries' tool, defining parameters: collection_slug, where, locale, state, sort, paginate, limit, offset, first, count, exclude with Zod validators.
title: "List Entries", description: "List content entries for a collection with advanced filtering, sorting, and pagination. " + "Use the 'where' parameter for powerful queries. Read the 'query-reference' resource for full documentation on operators and examples.", inputSchema: { collection_slug: z.string().describe("The collection slug"), where: z .record(z.string(), z.unknown()) .optional() .describe( "Filter conditions as a nested object. Supports operators: eq, lt, lte, gt, gte, not, like, in, not_in, null, not_null, between, not_between. " + "Simple: { \"status\": \"published\" }. " + "With operators: { \"price\": { \"lt\": 50 }, \"title\": { \"like\": \"news\" } }. " + "OR group: { \"or\": [{ \"tags\": \"clearance\" }, { \"campaign\": { \"name\": \"Summer\" } }] }. " + "Relation filter: { \"author\": { \"name\": { \"eq\": \"John\" } } }. " + "Core columns (id, uuid, locale, status, created_at, updated_at, published_at) can be filtered directly." ), locale: z .string() .optional() .describe("Filter by locale (e.g. 'en')"), state: z .string() .optional() .describe("Filter by state: 'only_draft' or 'with_draft'. Defaults to published entries only."), sort: z .string() .optional() .describe( "Sort by field:direction, comma-separated for multiple. " + "Examples: 'created_at:desc', 'title:asc,created_at:desc'. " + "Supports core columns (id, created_at, updated_at, published_at) and custom field names." ), paginate: z .number() .optional() .describe("Enable pagination with N items per page. Returns paginated response with meta data. Overrides limit/offset."), limit: z .number() .optional() .describe("Limit the number of results (ignored if paginate is set)"), offset: z .number() .optional() .describe("Skip N results (requires limit to be set)"), first: z .boolean() .optional() .describe("If true, return only the first matching entry as a single object instead of an array"), count: z .boolean() .optional() .describe("If true, return only the count of matching entries: { count: N }"), exclude: z .string() .optional() .describe("Comma-separated field names to exclude from response (e.g. 'content,excerpt')"), }, - src/tools/content.ts:10-10 (registration)Registration of the 'list_entries' tool via server.registerTool() within the registerContentTools function.
server.registerTool("list_entries", { - src/index.ts:38-38 (registration)Top-level call to registerContentTools(server, client) which registers the 'list_entries' tool.
registerContentTools(server, client); - src/client.ts:94-112 (helper)The client.get() method used by the handler to make the HTTP GET request with flattened query parameters.
async get( path: string, params?: Record<string, unknown> ): Promise<unknown> { const url = new URL(`${this.baseUrl}${path}`); if (params) { const flatPairs = this.flattenParams(params); for (const [key, value] of flatPairs) { url.searchParams.append(key, value); } } const response = await fetch(url.toString(), { method: "GET", headers: this.headers(), }); return this.handleResponse(response); }