Create Entry
create_entryAdd new content entries to collections in ElmapiCMS, specifying fields, status, and locale for structured content management.
Instructions
Create a new content entry in a collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_slug | Yes | The collection slug | |
| data | Yes | Object where keys are field names and values are the content (e.g. { title: 'My Post', slug: 'my-post' }) | |
| status | No | Publication status: 'published' or 'draft' (default) | |
| locale | No | Locale code (e.g. 'en') |
Implementation Reference
- src/tools/content.ts:111-137 (handler)Complete implementation of the create_entry tool - includes registration, input schema (collection_slug, data, status, locale), and handler logic that POSTs to the client to create a new content entry in a collection
// ── create_entry ────────────────────────────────────────────────── server.registerTool("create_entry", { title: "Create Entry", description: "Create a new content entry in a collection", inputSchema: { collection_slug: z.string().describe("The collection slug"), data: z .record(z.string(), z.unknown()) .describe( "Object where keys are field names and values are the content (e.g. { title: 'My Post', slug: 'my-post' })" ), status: z .string() .optional() .describe("Publication status: 'published' or 'draft' (default)"), locale: z.string().optional().describe("Locale code (e.g. 'en')"), }, }, async ({ collection_slug, data, status, locale }) => { const body: Record<string, unknown> = { data }; if (status) body.status = status; if (locale) body.locale = locale; const result = await client.post(`/${collection_slug}`, body); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; });