Skip to main content
Glama

update_product

Modify key product details—title, description, vendor, type, tags, or status—by supplying only the fields to change. Archive products to hide from storefront while preserving order history.

Instructions

Update an existing product's core fields — title, description (HTML), vendor, productType, tags, or status. Only provide fields you want changed; omitted fields are left untouched. Setting status=ARCHIVED hides the product from the storefront but preserves order history. To change variants, prices, or inventory use create_variants/update_variants and set_inventory_quantity. To change images use upload_product_image (or one of the bridge tools to generate new ones).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesProduct GID or numeric ID
titleNo
descriptionNo
vendorNo
product_typeNo
tagsNo
statusNo

Implementation Reference

  • GraphQL mutation definition for updating a product in Shopify.
    const UPDATE_PRODUCT_MUTATION = /* GraphQL */ `
      mutation UpdateProduct($input: ProductInput!) {
        productUpdate(input: $input) {
          product {
            id
            title
            handle
            status
          }
          userErrors { field message }
        }
      }
    `;
  • Zod schema defining the input parameters for the update_product tool.
    const updateProductSchema = {
      id: z.string().describe("Product GID or numeric ID"),
      title: z.string().optional(),
      description: z.string().optional(),
      vendor: z.string().optional(),
      product_type: z.string().optional(),
      tags: z.array(z.string()).optional(),
      status: z.enum(["ACTIVE", "DRAFT", "ARCHIVED"]).optional(),
    };
  • Registration of the update_product MCP tool with its handler, schema, and description.
    server.tool(
      "update_product",
      "Update an existing product's core fields — title, description (HTML), vendor, productType, tags, or status. Only provide fields you want changed; omitted fields are left untouched. Setting status=ARCHIVED hides the product from the storefront but preserves order history. To change variants, prices, or inventory use create_variants/update_variants and set_inventory_quantity. To change images use upload_product_image (or one of the bridge tools to generate new ones).",
      updateProductSchema,
      async (args) => {
        const input: Record<string, unknown> = { id: toGid(args.id, "Product") };
        if (args.title !== undefined) input.title = args.title;
        if (args.description !== undefined)
          input.descriptionHtml = args.description;
        if (args.vendor !== undefined) input.vendor = args.vendor;
        if (args.product_type !== undefined)
          input.productType = args.product_type;
        if (args.tags !== undefined) input.tags = args.tags;
        if (args.status !== undefined) input.status = args.status;
    
        const data = await client.graphql<{
          productUpdate: {
            product: Product | null;
            userErrors: ShopifyUserError[];
          };
        }>(UPDATE_PRODUCT_MUTATION, { input });
        throwIfUserErrors(data.productUpdate.userErrors, "productUpdate");
        const product = data.productUpdate.product;
        if (!product) throw new Error("productUpdate returned no product");
        return {
          content: [
            {
              type: "text" as const,
              text: `Updated product: ${product.title} (${product.id})`,
            },
          ],
        };
      },
    );
  • Handler function for update_product: builds a partial input object from the provided args (title, description, vendor, product_type, tags, status), calls the Shopify productUpdate GraphQL mutation, and returns a confirmation message.
      async (args) => {
        const input: Record<string, unknown> = { id: toGid(args.id, "Product") };
        if (args.title !== undefined) input.title = args.title;
        if (args.description !== undefined)
          input.descriptionHtml = args.description;
        if (args.vendor !== undefined) input.vendor = args.vendor;
        if (args.product_type !== undefined)
          input.productType = args.product_type;
        if (args.tags !== undefined) input.tags = args.tags;
        if (args.status !== undefined) input.status = args.status;
    
        const data = await client.graphql<{
          productUpdate: {
            product: Product | null;
            userErrors: ShopifyUserError[];
          };
        }>(UPDATE_PRODUCT_MUTATION, { input });
        throwIfUserErrors(data.productUpdate.userErrors, "productUpdate");
        const product = data.productUpdate.product;
        if (!product) throw new Error("productUpdate returned no product");
        return {
          content: [
            {
              type: "text" as const,
              text: `Updated product: ${product.title} (${product.id})`,
            },
          ],
        };
      },
    );
  • Helper function that converts a numeric ID or bare ID to a Shopify GID (e.g., gid://shopify/Product/123). Used by the update_product handler to ensure the product ID is in the correct format.
    export function toGid(id: string, type: string): string {
      if (id.startsWith("gid://")) return id;
      return `gid://shopify/${type}/${id}`;
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses that setting status=ARCHIVED hides the product but preserves order history. However, it lacks information on authorization, rate limits, idempotency, or side effects. Adequate but not thorough.

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?

Three sentences with clear structure: purpose, usage guidelines, and cross-reference to sibling tools. No unnecessary words, efficiently front-loaded.

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

Completeness4/5

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

Covers purpose, usage, and behavioral key points well, given no output schema or annotations. Missing return value description and prerequisites (e.g., product must exist, required permissions), but overall sufficient for most use cases.

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?

Schema description coverage is low (14%), but description adds meaning by listing core fields, explaining partial update behavior, and detailing the effect of status=ARCHIVED. It provides context beyond the schema, though not exhaustive (e.g., format of tags).

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

Purpose5/5

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

The description clearly states the tool updates core fields of an existing product, listing specific fields (title, description, vendor, productType, tags, status) and differentiates from sibling tools by noting that changes to variants, prices, inventory, or images require other tools.

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

Usage Guidelines4/5

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

Provides explicit guidance that only provided fields are changed and omitted fields are untouched. Mentions alternatives for other changes, implying when not to use this tool, but does not include explicit exclusions like 'Do not use to modify variants.'

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/miller-joe/shopify-mcp'

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