Skip to main content
Glama

delete_collection

Permanently delete a Shopify collection grouping while keeping its products. Irreversible. Requires collection ID (use get_collection to confirm). Returns deleted collection ID or 'nothing deleted'.

Instructions

Permanently delete a collection. Products inside it are NOT deleted — only the grouping is removed; products keep all their other associations (other collections, tags, inventory). Irreversible. Confirm the collection ID with get_collection before calling. Returns the deleted collection ID, or a 'nothing deleted' message if the GID didn't match anything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesGID of the collection to delete. The collection's products are NOT deleted, only the collection grouping. Irreversible.

Implementation Reference

  • Registration of the 'delete_collection' MCP tool, binding the name to its schema and handler function.
    server.tool(
      "delete_collection",
      "Permanently delete a collection. Products inside it are NOT deleted — only the grouping is removed; products keep all their other associations (other collections, tags, inventory). Irreversible. Confirm the collection ID with get_collection before calling. Returns the deleted collection ID, or a 'nothing deleted' message if the GID didn't match anything.",
      deleteCollectionSchema,
      async (args) => {
        const data = await client.graphql<{
          collectionDelete: {
            deletedCollectionId: string | null;
            userErrors: ShopifyUserError[];
          };
        }>(DELETE_COLLECTION_MUTATION, { input: { id: args.id } });
        throwIfUserErrors(data.collectionDelete.userErrors, "collectionDelete");
        return {
          content: [
            {
              type: "text" as const,
              text: data.collectionDelete.deletedCollectionId
                ? `Deleted collection ${data.collectionDelete.deletedCollectionId}.`
                : "No collection matched; nothing deleted.",
            },
          ],
        };
      },
    );
  • Handler function for delete_collection: executes the GraphQL mutation with the collection ID, throws on user errors, and returns a confirmation message.
    async (args) => {
      const data = await client.graphql<{
        collectionDelete: {
          deletedCollectionId: string | null;
          userErrors: ShopifyUserError[];
        };
      }>(DELETE_COLLECTION_MUTATION, { input: { id: args.id } });
      throwIfUserErrors(data.collectionDelete.userErrors, "collectionDelete");
      return {
        content: [
          {
            type: "text" as const,
            text: data.collectionDelete.deletedCollectionId
              ? `Deleted collection ${data.collectionDelete.deletedCollectionId}.`
              : "No collection matched; nothing deleted.",
          },
        ],
      };
    },
  • Zod schema defining the input for delete_collection: a single required 'id' string parameter (the collection GID).
    const deleteCollectionSchema = {
      id: z
        .string()
        .describe(
          "GID of the collection to delete. The collection's products are NOT deleted, only the collection grouping. Irreversible.",
        ),
    };
  • GraphQL mutation string for deleting a collection via Shopify's CollectionDelete mutation.
    const DELETE_COLLECTION_MUTATION = /* GraphQL */ `
      mutation CollectionDelete($input: CollectionDeleteInput!) {
        collectionDelete(input: $input) {
          deletedCollectionId
          userErrors { field message }
        }
      }
    `;
Behavior4/5

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

Given no annotations, the description fully discloses irreversibility, that products are not deleted, and return behavior. Lacks details on auth or rate limits, but overall transparent.

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?

Concise yet comprehensive: action, key effects, precaution, and return info in a logical order with no superfluous content.

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

Completeness5/5

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

Complete for a delete tool: explains effect on products, irreversibility, and return value. Suggests using get_collection, covering potential confusion points.

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 covers the parameter fully, but description adds context: 'products are NOT deleted' and 'irreversible', reinforcing the schema's note and clarifying consequences.

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?

Clearly states 'Permanently delete a collection' and distinguishes from related tools like create_collection and update_collection. Also clarifies what is NOT deleted (products), ensuring no confusion.

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?

Explicitly advises to confirm collection ID with get_collection before calling, and notes the action is irreversible, providing clear guidance on when and how to use.

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