Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const FIELD_FORMATS_DESCRIPTION =
'Field formats: text|textArea ="string"; textArea uses "\\n" for multi-line input; richEditorV2="<h1>HTML</h1>"; 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).';
6 changes: 4 additions & 2 deletions src/tools/create-content-draft.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -14,7 +15,8 @@ export const createContentDraftTool: Tool = {
},
content: {
type: 'object',
description: 'Content data to create (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", 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',
Expand All @@ -39,4 +41,4 @@ export async function handleCreateContentDraft(params: ToolParameters) {
if (options.contentId) createOptions.contentId = options.contentId;

return await create(endpoint, content, createOptions);
}
}
6 changes: 4 additions & 2 deletions src/tools/create-content-published.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -14,7 +15,8 @@ export const createContentPublishedTool: Tool = {
},
content: {
type: 'object',
description: 'Content data to create (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", 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',
Expand All @@ -39,4 +41,4 @@ export async function handleCreateContentPublished(params: ToolParameters) {
if (options.contentId) createOptions.contentId = options.contentId;

return await create(endpoint, content, createOptions);
}
}
7 changes: 5 additions & 2 deletions src/tools/patch-content.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -18,7 +19,9 @@ export const patchContentTool: Tool = {
},
content: {
type: 'object',
description: 'Partial content data to update (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", 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',
Expand All @@ -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);
}
}
6 changes: 4 additions & 2 deletions src/tools/update-content-draft.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -18,7 +19,8 @@ export const updateContentDraftTool: Tool = {
},
content: {
type: 'object',
description: 'Content data to update (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", 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'],
Expand All @@ -41,4 +43,4 @@ export async function handleUpdateContentDraft(params: ToolParameters) {
};

return await update(endpoint, contentId, content, updateOptions);
}
}
6 changes: 4 additions & 2 deletions src/tools/update-content-published.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -18,7 +19,8 @@ export const updateContentPublishedTool: Tool = {
},
content: {
type: 'object',
description: 'Content data to update (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", 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'],
Expand All @@ -41,4 +43,4 @@ export async function handleUpdateContentPublished(params: ToolParameters) {
};

return await update(endpoint, contentId, content, updateOptions);
}
}