createProduct
Add products to your Omnisend catalog with details like title, description, variants, images, and price for marketing automation.
Instructions
Create a new product in the Omnisend catalog. Product data can include details like title, description, variants, images, price, and more.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "createProduct"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/products/index.ts:68-89 (handler)Handler function for the 'createProduct' MCP tool. Calls the API createProduct, filters response with filterProductFields, returns formatted JSON text content, handles errors.
async (args) => { try { const response = await createProduct(args.productData); // Filter product data to include only defined fields const filteredProduct = filterProductFields(response); return { content: [ { type: "text", text: JSON.stringify(filteredProduct, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } } - src/tools/products/index.ts:55-67 (schema)JSON Schema defining input for 'createProduct' tool: requires 'productData' as flexible object.
{ additionalProperties: false, properties: { productData: { additionalProperties: true, description: "Product data", properties: {}, type: "object" } }, required: ["productData"], type: "object" }, - src/tools/products/index.ts:52-54 (registration)Registration of 'createProduct' tool via server.tool(), specifying name and description.
server.tool( "createProduct", "Create a new product in the Omnisend catalog. Product data can include details like title, description, variants, images, price, and more.", - API helper implementing the product creation by POSTing to Omnisend '/products' endpoint.
export const createProduct = async (productData: Partial<Product>): Promise<Product> => { try { const response = await omnisendApi.post<Product>('/products', productData); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error creating product: ${error.message}`); } else { throw new Error('Unknown error occurred when creating product'); } }