create_article
Generate and publish articles in Zendesk Help Center by specifying title, body, section, locale, and permissions. Manage drafts, labels, and user segments for tailored content creation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Article body content (HTML) | |
| draft | No | Whether the article is a draft | |
| label_names | No | Labels for the article | |
| locale | No | Article locale (e.g., 'en-us') | |
| permission_group_id | No | Permission group ID for the article | |
| section_id | Yes | Section ID where the article will be created | |
| title | Yes | Article title | |
| user_segment_id | No | User segment ID for the article |
Implementation Reference
- src/tools/help-center.js:68-93 (handler)The handler function for the 'create_article' tool. It processes input parameters, constructs the article data, calls the Zendesk client to create the article, and returns the result or error.handler: async ({ title, body, section_id, locale, draft, permission_group_id, user_segment_id, label_names }) => { try { const articleData = { title, body, locale, draft, permission_group_id, user_segment_id, label_names }; const result = await zendeskClient.createArticle(articleData, section_id); return { content: [{ type: "text", text: `Article created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating article: ${error.message}` }], isError: true }; } }
- src/tools/help-center.js:58-67 (schema)Input schema validation using Zod for the 'create_article' tool parameters.schema: { title: z.string().describe("Article title"), body: z.string().describe("Article body content (HTML)"), section_id: z.number().describe("Section ID where the article will be created"), locale: z.string().optional().describe("Article locale (e.g., 'en-us')"), draft: z.boolean().optional().describe("Whether the article is a draft"), permission_group_id: z.number().optional().describe("Permission group ID for the article"), user_segment_id: z.number().optional().describe("User segment ID for the article"), label_names: z.array(z.string()).optional().describe("Labels for the article") },
- src/tools/help-center.js:55-93 (registration)Full tool definition object for 'create_article' exported in helpCenterTools array, which is later registered in the MCP server.{ name: "create_article", description: "Create a new Help Center article", schema: { title: z.string().describe("Article title"), body: z.string().describe("Article body content (HTML)"), section_id: z.number().describe("Section ID where the article will be created"), locale: z.string().optional().describe("Article locale (e.g., 'en-us')"), draft: z.boolean().optional().describe("Whether the article is a draft"), permission_group_id: z.number().optional().describe("Permission group ID for the article"), user_segment_id: z.number().optional().describe("User segment ID for the article"), label_names: z.array(z.string()).optional().describe("Labels for the article") }, handler: async ({ title, body, section_id, locale, draft, permission_group_id, user_segment_id, label_names }) => { try { const articleData = { title, body, locale, draft, permission_group_id, user_segment_id, label_names }; const result = await zendeskClient.createArticle(articleData, section_id); return { content: [{ type: "text", text: `Article created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating article: ${error.message}` }], isError: true }; } }
- src/zendesk-client.js:263-269 (helper)ZendeskClient helper method that executes the actual API POST request to create a Help Center article in the specified section.async createArticle(data, sectionId) { return this.request( "POST", `/help_center/sections/${sectionId}/articles.json`, { article: data } ); }
- src/server.js:47-52 (registration)MCP server registration loop that registers the 'create_article' tool (included via helpCenterTools) using server.tool().// Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });