Skip to main content
Glama

microcms_get_list

Retrieve and filter a list of contents from microCMS, supporting pagination, sorting, search, and field selection for efficient data management.

Instructions

Get a list of contents from microCMS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoDepth of reference expansion (1-3)
draftKeyNoDraft key for preview
endpointYesContent type name (e.g., "blogs", "news")
fieldsNoComma-separated list of fields to retrieve
filtersNoFilter conditions
idsNoComma-separated list of content IDs
limitNoNumber of contents to retrieve (1-100)
offsetNoOffset for pagination
ordersNoSort order (e.g., "-publishedAt" for descending)
qNoFull-text search query

Implementation Reference

  • The handler function that processes tool input parameters, constructs MicroCMSListOptions, and invokes the client-side getList helper to fetch contents.
    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); }
  • Tool definition including name, description, and inputSchema specifying parameters for fetching content lists with validation.
    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:73-76 (registration)
    Server-side dispatch in CallToolRequest handler that maps 'microcms_get_list' tool calls to the handleGetList function.
    switch (name) { case 'microcms_get_list': result = await handleGetList(params); break;
  • src/server.ts:41-64 (registration)
    Registers the getListTool in the list of available tools for ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ getListTool, getListMetaTool, getContentTool, getContentMetaTool, createContentPublishedTool, createContentDraftTool, updateContentPublishedTool, updateContentDraftTool, patchContentTool, patchContentStatusTool, patchContentCreatedByTool, deleteContentTool, getMediaTool, uploadMediaTool, deleteMediaTool, getApiInfoTool, getApiListTool, getMemberTool, ], }; });
  • Supporting client function that wraps the microCMS SDK's getList method to retrieve a list of contents for the specified endpoint.
    export async function getList<T = MicroCMSContent>( endpoint: string, queries?: MicroCMSQueries ): Promise<MicroCMSListResponse<T>> { return await microCMSClient.getList<T>({ endpoint, queries, }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/microcmsio/microcms-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server