microcms_get_content_meta
Retrieve content with metadata from microCMS, including status, authorship, timestamps, and custom fields not available in standard content APIs.
Instructions
Get a specific content with metadata from microCMS Management API. IMPORTANT: Use this tool ONLY when the user message contains "メタ" (meta) or "メタ情報" (metadata). This API returns metadata information such as status, createdBy, updatedBy, reservationTime, closedAt, and customStatus that are not available in the regular content API. For regular content retrieval, use microcms_get_content instead.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | Content type name (e.g., "blogs", "news") | |
| contentId | Yes | Content ID to retrieve |
Implementation Reference
- src/tools/get-content-meta.ts:24-36 (handler)The handler function for the 'microcms_get_content_meta' tool. It validates the required parameters (endpoint and contentId) and calls the getContentManagement helper from the client module.export async function handleGetContentMeta(params: ToolParameters) { const { endpoint, contentId } = params; if (!endpoint) { throw new Error('endpoint is required'); } if (!contentId) { throw new Error('contentId is required'); } return await getContentManagement(endpoint, contentId); }
- src/tools/get-content-meta.ts:5-22 (schema)The schema definition for the tool, including name, description, and input schema specifying required 'endpoint' and 'contentId' parameters.export const getContentMetaTool: Tool = { name: 'microcms_get_content_meta', description: 'Get a specific content with metadata from microCMS Management API. IMPORTANT: Use this tool ONLY when the user message contains "メタ" (meta) or "メタ情報" (metadata). This API returns metadata information such as status, createdBy, updatedBy, reservationTime, closedAt, and customStatus that are not available in the regular content API. For regular content retrieval, use microcms_get_content instead.', inputSchema: { type: 'object', properties: { endpoint: { type: 'string', description: 'Content type name (e.g., "blogs", "news")', }, contentId: { type: 'string', description: 'Content ID to retrieve', }, }, required: ['endpoint', 'contentId'], }, };
- src/server.ts:91-93 (registration)Registration of the tool handler in the server's CallToolRequest switch statement.case 'microcms_get_content_meta': result = await handleGetContentMeta(params); break;
- src/server.ts:11-11 (registration)Import of the tool definition and handler function into the server module.import { getContentMetaTool, handleGetContentMeta } from './tools/get-content-meta.js';
- src/client.ts:237-256 (helper)Core helper function that makes the HTTP GET request to the microCMS Management API to fetch the content metadata for the specified endpoint and contentId.export async function getContentManagement( endpoint: string, contentId: string ): Promise<any> { const url = `https://${config.serviceDomain}.microcms-management.io/api/v1/contents/${endpoint}/${contentId}`; const response = await fetch(url, { method: 'GET', headers: { 'X-MICROCMS-API-KEY': config.apiKey, }, }); if (!response.ok) { const errorText = await response.text(); throw new Error(`Failed to get content: ${response.status} ${response.statusText} - ${errorText}`); } return await response.json(); }