Skip to main content
Glama
plutzilla

Omnisend MCP Server

deleteCategory

Remove a product category from the Omnisend catalog using its unique identifier to maintain organized product listings.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the deleteCategory tool: invokes the API deleteCategory with the provided categoryId and returns a textual success or error response.
      async (args) => {
        try {
          const success = await deleteCategory(args.categoryId);
          
          return {
            content: [
              { 
                type: "text", 
                text: success ? "Category deleted successfully" : "Failed to delete category" 
              }
            ]
          };
        } catch (error) {
          if (error instanceof Error) {
            return { content: [{ type: "text", text: `Error: ${error.message}` }] };
          }
          return { content: [{ type: "text", text: "An unknown error occurred" }] };
        }
      }
    );
  • Input schema for the deleteCategory tool, specifying the required categoryId parameter.
    {
      additionalProperties: false,
      properties: {
        categoryId: { description: "Category ID", type: "string" }
      },
      required: ["categoryId"],
      type: "object"
    },
  • Registration of the deleteCategory MCP tool using server.tool(), including name, description, input schema, and handler function.
      "deleteCategory",
      "Remove a product category from the Omnisend catalog by its unique identifier.",
      {
        additionalProperties: false,
        properties: {
          categoryId: { description: "Category ID", type: "string" }
        },
        required: ["categoryId"],
        type: "object"
      },
      async (args) => {
        try {
          const success = await deleteCategory(args.categoryId);
          
          return {
            content: [
              { 
                type: "text", 
                text: success ? "Category deleted successfully" : "Failed to delete category" 
              }
            ]
          };
        } catch (error) {
          if (error instanceof Error) {
            return { content: [{ type: "text", text: `Error: ${error.message}` }] };
          }
          return { content: [{ type: "text", text: "An unknown error occurred" }] };
        }
      }
    );
  • API helper function implementing the core delete logic by sending a DELETE request to the Omnisend /product-categories/{categoryId} endpoint.
    export const deleteCategory = async (categoryId: string): Promise<boolean> => {
      try {
        const response = await omnisendApi.delete(`/product-categories/${categoryId}`);
        return response.status === 204;
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Error deleting category: ${error.message}`);
        } else {
          throw new Error('Unknown error occurred when deleting category');
        }
      }
    }; 

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