deleteProduct
Remove a product from the Omnisend catalog using its unique ID. This tool helps maintain accurate product listings by deleting outdated or unwanted items.
Instructions
Remove a product from the Omnisend catalog by its unique identifier.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | Product ID |
Implementation Reference
- src/tools/products/index.ts:182-201 (handler)The MCP tool handler for deleteProduct, which calls the underlying deleteProduct API helper with the productId argument and returns a textual success or error response.async (args) => { try { const success = await deleteProduct(args.productId); return { content: [ { type: "text", text: success ? "Product deleted successfully" : "Failed to delete product" } ] }; } 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:174-181 (schema)Input schema for the deleteProduct tool, specifying that a productId string is required.{ additionalProperties: false, properties: { productId: { description: "Product ID", type: "string" } }, required: ["productId"], type: "object" },
- src/tools/products/index.ts:171-201 (registration)Registration of the deleteProduct MCP tool via server.tool(), including name, description, input schema, and handler function.server.tool( "deleteProduct", "Remove a product from the Omnisend catalog by its unique identifier.", { additionalProperties: false, properties: { productId: { description: "Product ID", type: "string" } }, required: ["productId"], type: "object" }, async (args) => { try { const success = await deleteProduct(args.productId); return { content: [ { type: "text", text: success ? "Product deleted successfully" : "Failed to delete product" } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } } );
- Supporting API helper function that executes the DELETE request to Omnisend's /products/{productId} endpoint and returns true if status 204.export const deleteProduct = async (productId: string): Promise<boolean> => { try { const response = await omnisendApi.delete(`/products/${productId}`); return response.status === 204; } catch (error) { if (error instanceof Error) { throw new Error(`Error deleting product: ${error.message}`); } else { throw new Error('Unknown error occurred when deleting product'); } } };