Skip to main content
Glama
plutzilla

Omnisend MCP Server

replaceProduct

Update existing product information in Omnisend by modifying specific fields while maintaining the original data structure for accurate synchronization.

Instructions

Replace an existing product with new data. IMPORTANT: You must first get the product using getProduct and preserve the returned structure when replacing. The replace request requires the same structure as returned by the GET method, with only your desired changes applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'replaceProduct' MCP tool. It invokes the API replaceProduct helper, filters the response using filterProductFields, formats it as JSON text content, and handles errors by returning error messages.
    async (args) => {
      try {
        const response = await replaceProduct(args.productId, 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" }] };
      }
    }
  • Input schema definition for the 'replaceProduct' tool, specifying parameters productId (string) and productData (object).
    {
      additionalProperties: false,
      properties: {
        productId: { description: "Product ID", type: "string" },
        productData: { 
          additionalProperties: true,
          description: "Product data in the same structure as returned by getProduct", 
          properties: {},
          type: "object" 
        }
      },
      required: ["productId", "productData"],
      type: "object"
    },
  • Registration of the 'replaceProduct' tool on the MCP server using server.tool(), including name, description, schema, and handler.
    server.tool(
      "replaceProduct",
      "Replace an existing product with new data. IMPORTANT: You must first get the product using getProduct and preserve the returned structure when replacing. The replace request requires the same structure as returned by the GET method, with only your desired changes applied.",
      {
        additionalProperties: false,
        properties: {
          productId: { description: "Product ID", type: "string" },
          productData: { 
            additionalProperties: true,
            description: "Product data in the same structure as returned by getProduct", 
            properties: {},
            type: "object" 
          }
        },
        required: ["productId", "productData"],
        type: "object"
      },
      async (args) => {
        try {
          const response = await replaceProduct(args.productId, 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" }] };
        }
      }
    );
  • API helper function that performs the HTTP PUT request to the Omnisend API to replace a product by ID.
    export const replaceProduct = async (productId: string, productData: Partial<Product>): Promise<Product> => {
      try {
        const response = await omnisendApi.put<Product>(`/products/${productId}`, productData);
        return response.data;
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Error replacing product: ${error.message}`);
        } else {
          throw new Error('Unknown error occurred when replacing product');
        }
      }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool is a mutation ('replace'), requires a specific workflow (get first, then replace), and needs structural preservation. However, it lacks details on permissions, error handling, or side effects, which are important for a mutation tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by critical usage instructions. Every sentence earns its place by providing essential guidance without redundancy, making it appropriately sized and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It covers the workflow and structural requirements but misses details like response format, error conditions, or confirmation of changes, which are needed for adequate context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so the baseline is 4. The description adds value by explaining that parameters should mirror the structure from 'getProduct' with only desired changes, providing semantic context beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Replace an existing product with new data.' It specifies the verb ('replace') and resource ('product'), but does not explicitly differentiate it from sibling tools like 'updateProduct' or 'createProduct', which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when and how to use this tool: 'You must first get the product using getProduct and preserve the returned structure when replacing.' It also specifies the alternative tool ('getProduct') for the prerequisite step, making usage clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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