From b034219de698a15978a5a6dab82f1ad2b8dd7bce Mon Sep 17 00:00:00 2001 From: kan_shimizu Date: Tue, 7 Oct 2025 11:22:55 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=BC=E3=83=AB=E3=83=89?= =?UTF-8?q?=E3=81=94=E3=81=A8=E3=81=AE=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=AE=E8=AA=AC=E6=98=8E=E3=81=8C=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E3=81=AE=E8=A8=98=E8=BC=89=E3=81=AB=E6=AD=A2=E3=81=BE?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E3=80=81?= =?UTF-8?q?=E8=BF=BD=E8=A8=98=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants.ts | 2 ++ src/tools/create-content-draft.ts | 6 ++++-- src/tools/create-content-published.ts | 6 ++++-- src/tools/patch-content.ts | 7 +++++-- src/tools/update-content-draft.ts | 6 ++++-- src/tools/update-content-published.ts | 6 ++++-- 6 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 src/constants.ts diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..f38850e --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,2 @@ +export const FIELD_FORMATS_DESCRIPTION = + 'Field formats: text|textArea ="string"; textArea uses "\\n" for multi-line input; richEditorV2="

HTML

"; richEditor uses "\\n" plain text; image="https://images.microcms-assets.io/..."; mediaList=["https://...","https://..."]; date="2020-04-23T14:32:38.163Z"; number=123; boolean=true; select=["option1","option2"]; relation="contentId"; relationList=["id1","id2"]; custom={ "fieldId": "...", ...values }; repeater=[{ "fieldId": "...", ...values }]; file="https://files.microcms-assets.io/..."; iframe={ "id": "...", "title": "...", "description": "...", "imageUrl": "https://...", "updatedAt": "2024-01-01T00:00:00Z", "data": { ... } }; publishedAt="2024-01-01T00:00:00Z". Asset URLs must belong to the same microCMS service (custom domains are accepted).'; diff --git a/src/tools/create-content-draft.ts b/src/tools/create-content-draft.ts index 45ccfb1..5973926 100644 --- a/src/tools/create-content-draft.ts +++ b/src/tools/create-content-draft.ts @@ -1,5 +1,6 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { create } from '../client.js'; +import { FIELD_FORMATS_DESCRIPTION } from '../constants.js'; import type { ToolParameters, MicroCMSCreateOptions } from '../types.js'; export const createContentDraftTool: Tool = { @@ -14,7 +15,8 @@ export const createContentDraftTool: Tool = { }, content: { type: 'object', - description: 'Content data to create (JSON object). Field formats: text="string", richEditor="

HTML

", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].', + description: + 'Content data to create (JSON object). ' + FIELD_FORMATS_DESCRIPTION, }, contentId: { type: 'string', @@ -39,4 +41,4 @@ export async function handleCreateContentDraft(params: ToolParameters) { if (options.contentId) createOptions.contentId = options.contentId; return await create(endpoint, content, createOptions); -} \ No newline at end of file +} diff --git a/src/tools/create-content-published.ts b/src/tools/create-content-published.ts index dbef239..286e2f2 100644 --- a/src/tools/create-content-published.ts +++ b/src/tools/create-content-published.ts @@ -1,5 +1,6 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { create } from '../client.js'; +import { FIELD_FORMATS_DESCRIPTION } from '../constants.js'; import type { ToolParameters, MicroCMSCreateOptions } from '../types.js'; export const createContentPublishedTool: Tool = { @@ -14,7 +15,8 @@ export const createContentPublishedTool: Tool = { }, content: { type: 'object', - description: 'Content data to create (JSON object). Field formats: text="string", richEditor="

HTML

", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].', + description: + 'Content data to create (JSON object). ' + FIELD_FORMATS_DESCRIPTION, }, contentId: { type: 'string', @@ -39,4 +41,4 @@ export async function handleCreateContentPublished(params: ToolParameters) { if (options.contentId) createOptions.contentId = options.contentId; return await create(endpoint, content, createOptions); -} \ No newline at end of file +} diff --git a/src/tools/patch-content.ts b/src/tools/patch-content.ts index 062170c..1c145e2 100644 --- a/src/tools/patch-content.ts +++ b/src/tools/patch-content.ts @@ -1,5 +1,6 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { patch } from '../client.js'; +import { FIELD_FORMATS_DESCRIPTION } from '../constants.js'; import type { ToolParameters, MicroCMSUpdateOptions } from '../types.js'; export const patchContentTool: Tool = { @@ -18,7 +19,9 @@ export const patchContentTool: Tool = { }, content: { type: 'object', - description: 'Partial content data to update (JSON object). Field formats: text="string", richEditor="

HTML

", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].', + description: + 'Partial content data to update (JSON object). ' + + FIELD_FORMATS_DESCRIPTION, }, isDraft: { type: 'boolean', @@ -45,4 +48,4 @@ export async function handlePatchContent(params: ToolParameters) { if (options.isDraft !== undefined) updateOptions.isDraft = options.isDraft; return await patch(endpoint, contentId, content, updateOptions); -} \ No newline at end of file +} diff --git a/src/tools/update-content-draft.ts b/src/tools/update-content-draft.ts index 5fe7914..1ae3d93 100644 --- a/src/tools/update-content-draft.ts +++ b/src/tools/update-content-draft.ts @@ -1,5 +1,6 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { update } from '../client.js'; +import { FIELD_FORMATS_DESCRIPTION } from '../constants.js'; import type { ToolParameters, MicroCMSUpdateOptions } from '../types.js'; export const updateContentDraftTool: Tool = { @@ -18,7 +19,8 @@ export const updateContentDraftTool: Tool = { }, content: { type: 'object', - description: 'Content data to update (JSON object). Field formats: text="string", richEditor="

HTML

", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].', + description: + 'Content data to update (JSON object). ' + FIELD_FORMATS_DESCRIPTION, }, }, required: ['endpoint', 'contentId', 'content'], @@ -41,4 +43,4 @@ export async function handleUpdateContentDraft(params: ToolParameters) { }; return await update(endpoint, contentId, content, updateOptions); -} \ No newline at end of file +} diff --git a/src/tools/update-content-published.ts b/src/tools/update-content-published.ts index 2f26956..07f8433 100644 --- a/src/tools/update-content-published.ts +++ b/src/tools/update-content-published.ts @@ -1,5 +1,6 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { update } from '../client.js'; +import { FIELD_FORMATS_DESCRIPTION } from '../constants.js'; import type { ToolParameters, MicroCMSUpdateOptions } from '../types.js'; export const updateContentPublishedTool: Tool = { @@ -18,7 +19,8 @@ export const updateContentPublishedTool: Tool = { }, content: { type: 'object', - description: 'Content data to update (JSON object). Field formats: text="string", richEditor="

HTML

", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].', + description: + 'Content data to update (JSON object). ' + FIELD_FORMATS_DESCRIPTION, }, }, required: ['endpoint', 'contentId', 'content'], @@ -41,4 +43,4 @@ export async function handleUpdateContentPublished(params: ToolParameters) { }; return await update(endpoint, contentId, content, updateOptions); -} \ No newline at end of file +}