Skip to main content
Glama
plutzilla

Omnisend MCP Server

deleteProduct

Remove products from the Omnisend catalog using unique identifiers to maintain accurate product listings and inventory management.

Instructions

Remove a product from the Omnisend catalog by its unique identifier.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'deleteProduct' MCP tool. It invokes the underlying deleteProduct API helper with the provided productId and returns a success or error message.
    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" }] };
      }
    }
  • The input schema definition for the 'deleteProduct' tool, specifying the required 'productId' parameter.
    {
      additionalProperties: false,
      properties: {
        productId: { description: "Product ID", type: "string" }
      },
      required: ["productId"],
      type: "object"
    },
  • The registration of the 'deleteProduct' tool using server.tool(), including name, description, schema, and handler.
    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" }] };
        }
      }
    );
  • Helper function that performs the actual DELETE API call to Omnisend's /products/{productId} endpoint and returns true if status is 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');
        }
      }
    }; 

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/plutzilla/omnisend-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server