Skip to main content
Glama

updateCategory

Modify an existing product category in Omnisend by updating its details while maintaining the original structure obtained from getCategory.

Instructions

Update an existing product category. IMPORTANT: You must first get the category using getCategory and preserve the returned structure when updating.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the updateCategory MCP tool with schema, description, and thin wrapper handler that calls core update function and formats response.
    server.tool( "updateCategory", "Update an existing product category. IMPORTANT: You must first get the category using getCategory and preserve the returned structure when updating.", { additionalProperties: false, properties: { categoryId: { description: "Category ID", type: "string" }, categoryData: { additionalProperties: true, description: "Category data in the same structure as returned by getCategory", properties: {}, type: "object" } }, required: ["categoryId", "categoryData"], type: "object" }, async (args) => { try { const response = await updateCategory(args.categoryId, args.categoryData); // Filter category data to include only defined fields const filteredCategory = filterCategoryFields(response); return { content: [ { type: "text", text: JSON.stringify(filteredCategory, 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" }] }; } } );
  • Core handler function for updating a category via Omnisend API PUT request to /product-categories/{categoryId}.
    export const updateCategory = async (categoryId: string, categoryData: Partial<ProductCategory>): Promise<ProductCategory> => { try { const response = await omnisendApi.put<ProductCategory>(`/product-categories/${categoryId}`, categoryData); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error updating category: ${error.message}`); } else { throw new Error('Unknown error occurred when updating category'); } } };
  • TypeScript interface defining the ProductCategory structure used for input/output validation in updateCategory.
    export interface ProductCategory { categoryID: string; title: string; handle?: string; description?: string; imageUrl?: string; categoryUrl?: string; createdAt?: string; updatedAt?: string; [key: string]: unknown; }
  • Top-level export of the registerCategoriesTools function, which includes the updateCategory tool registration.
    export { registerCategoriesTools } from './categories/index.js';

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