microcms_get_list
Retrieve content lists from microCMS with filtering, sorting, pagination, and search capabilities for managing blog posts, news articles, or other content types.
Instructions
Get a list of contents from microCMS
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | Content type name (e.g., "blogs", "news") | |
| draftKey | No | Draft key for preview | |
| limit | No | Number of contents to retrieve (1-100) | |
| offset | No | Offset for pagination | |
| orders | No | Sort order (e.g., "-publishedAt" for descending) | |
| q | No | Full-text search query | |
| fields | No | Comma-separated list of fields to retrieve | |
| ids | No | Comma-separated list of content IDs | |
| filters | No | Filter conditions | |
| depth | No | Depth of reference expansion (1-3) |
Implementation Reference
- src/tools/get-list.ts:61-77 (handler)Handler function for the microcms_get_list tool. Parses input parameters into MicroCMS queries and calls the underlying getList client function.export async function handleGetList(params: ToolParameters) { const { endpoint, ...options } = params; const queries: MicroCMSListOptions = {}; if (options.draftKey) queries.draftKey = options.draftKey; if (options.limit) queries.limit = options.limit; if (options.offset) queries.offset = options.offset; if (options.orders) queries.orders = options.orders; if (options.q) queries.q = options.q; if (options.fields) queries.fields = options.fields; if (options.ids) queries.ids = options.ids; if (options.filters) queries.filters = options.filters; if (options.depth) queries.depth = options.depth; return await getList(endpoint, queries); }
- src/tools/get-list.ts:5-59 (schema)Tool schema definition including name, description, and detailed inputSchema for parameters like endpoint, limit, filters, etc.export const getListTool: Tool = { name: 'microcms_get_list', description: 'Get a list of contents from microCMS', inputSchema: { type: 'object', properties: { endpoint: { type: 'string', description: 'Content type name (e.g., "blogs", "news")', }, draftKey: { type: 'string', description: 'Draft key for preview', }, limit: { type: 'number', description: 'Number of contents to retrieve (1-100)', minimum: 1, maximum: 100, }, offset: { type: 'number', description: 'Offset for pagination', minimum: 0, }, orders: { type: 'string', description: 'Sort order (e.g., "-publishedAt" for descending)', }, q: { type: 'string', description: 'Full-text search query', }, fields: { type: 'string', description: 'Comma-separated list of fields to retrieve', }, ids: { type: 'string', description: 'Comma-separated list of content IDs', }, filters: { type: 'string', description: 'Filter conditions', }, depth: { type: 'number', description: 'Depth of reference expansion (1-3)', minimum: 1, maximum: 3, }, }, required: ['endpoint'], }, };
- src/server.ts:82-84 (registration)Registration of the tool handler in the main switch statement for CallToolRequestSchema.case 'microcms_get_list': result = await handleGetList(params); break;
- src/server.ts:47-72 (registration)Registration of the tool in the ListToolsRequestSchema handler, exposing the schema to clients.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ getListTool, getListMetaTool, getContentTool, getContentMetaTool, createContentPublishedTool, createContentDraftTool, createContentsBulkPublishedTool, createContentsBulkDraftTool, updateContentPublishedTool, updateContentDraftTool, patchContentTool, patchContentStatusTool, patchContentCreatedByTool, deleteContentTool, getMediaTool, uploadMediaTool, deleteMediaTool, getApiInfoTool, getApiListTool, getMemberTool, ], }; });
- src/client.ts:22-30 (helper)Core helper function that performs the actual API call to microCMS getList endpoint using the microCMSClient.export async function getList<T = MicroCMSContent>( endpoint: string, queries?: MicroCMSQueries ): Promise<MicroCMSListResponse<T>> { return await microCMSClient.getList<T>({ endpoint, queries, }); }