Skip to main content
Glama

microcms_get_content

Retrieve specific content from microCMS by specifying the endpoint, content ID, and optional fields, draft key, or depth, enabling precise data access for AI assistants and workflows.

Instructions

Get a specific content from microCMS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentIdYesContent ID to retrieve
depthNoDepth of reference expansion (1-3)
draftKeyNoDraft key for preview
endpointYesContent type name (e.g., "blogs", "news")
fieldsNoComma-separated list of fields to retrieve

Implementation Reference

  • The handler function that executes the tool logic: parses input parameters, builds query options, and retrieves specific content using getListDetail from the client.
    export async function handleGetContent(params: ToolParameters) { const { endpoint, contentId, ...options } = params; if (!contentId) { throw new Error('contentId is required'); } const queries: MicroCMSGetOptions = {}; if (options.draftKey) queries.draftKey = options.draftKey; if (options.fields) queries.fields = options.fields; if (options.depth) queries.depth = options.depth; return await getListDetail(endpoint, contentId, queries); }
  • Tool definition including name, description, and input schema with properties for endpoint, contentId (required), and optional draftKey, fields, depth.
    export const getContentTool: Tool = { name: 'microcms_get_content', description: 'Get a specific content from microCMS', inputSchema: { type: 'object', properties: { endpoint: { type: 'string', description: 'Content type name (e.g., "blogs", "news")', }, contentId: { type: 'string', description: 'Content ID to retrieve', }, draftKey: { type: 'string', description: 'Draft key for preview', }, fields: { type: 'string', description: 'Comma-separated list of fields to retrieve', }, depth: { type: 'number', description: 'Depth of reference expansion (1-3)', minimum: 1, maximum: 3, }, }, required: ['endpoint', 'contentId'], }, };
  • src/server.ts:80-82 (registration)
    Registers the handler in the tool dispatch switch statement in the CallToolRequest handler.
    case 'microcms_get_content': result = await handleGetContent(params); break;
  • src/server.ts:46-47 (registration)
    Registers the tool definition in the list of tools returned by ListToolsRequest handler.
    getContentTool, getContentMetaTool,
  • src/server.ts:10-10 (registration)
    Imports the tool schema and handler function for use in the server.
    import { getContentTool, handleGetContent } from './tools/get-content.js';

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