Skip to main content
Glama

delete_metaobject

Permanently delete a metaobject by its GID. This irreversible action breaks any metafield references; Shopify does not auto-clean them, requiring manual fixes.

Instructions

Permanently delete a metaobject by GID. Irreversible. Any metafield references pointing at this metaobject will become broken — Shopify does NOT auto-clean references, you have to find and fix them. Use get_metaobject to confirm the right record before deleting. Returns the deleted GID, or a no-op message if nothing matched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesGID of the metaobject to delete. Irreversible; metafield references to this metaobject become broken (Shopify does not auto-clean referrers).

Implementation Reference

  • Registration and handler for the 'delete_metaobject' tool. Calls the metaobjectDelete GraphQL mutation with the supplied GID, throws on user errors, and returns the deleted ID or a no-op message.
    server.tool(
      "delete_metaobject",
      "Permanently delete a metaobject by GID. Irreversible. Any metafield references pointing at this metaobject will become broken — Shopify does NOT auto-clean references, you have to find and fix them. Use get_metaobject to confirm the right record before deleting. Returns the deleted GID, or a no-op message if nothing matched.",
      deleteMetaobjectSchema,
      async (args) => {
        const data = await client.graphql<{
          metaobjectDelete: {
            deletedId: string | null;
            userErrors: ShopifyUserError[];
          };
        }>(METAOBJECT_DELETE_MUTATION, { id: args.id });
        throwIfUserErrors(data.metaobjectDelete.userErrors, "metaobjectDelete");
        return {
          content: [
            {
              type: "text" as const,
              text: data.metaobjectDelete.deletedId
                ? `Deleted metaobject ${data.metaobjectDelete.deletedId}.`
                : "No metaobject matched; nothing deleted.",
            },
          ],
        };
      },
    );
  • Input schema for the delete_metaobject tool. Takes a single required parameter 'id' (string) – the GID of the metaobject to delete.
    const deleteMetaobjectSchema = {
      id: z
        .string()
        .describe(
          "GID of the metaobject to delete. Irreversible; metafield references to this metaobject become broken (Shopify does not auto-clean referrers).",
        ),
    };
  • GraphQL mutation string used by the delete_metaobject handler. Sends a MetaobjectDelete mutation with $id and returns deletedId + userErrors.
    const METAOBJECT_DELETE_MUTATION = /* GraphQL */ `
      mutation MetaobjectDelete($id: ID!) {
        metaobjectDelete(id: $id) {
          deletedId
          userErrors { field message }
        }
      }
    `;
  • src/server.ts:67-67 (registration)
    Registration call in the main server setup. registerMetaobjectTools(s, shopify) is invoked inside buildServer() to wire up all metaobject tools including delete_metaobject.
    registerMetaobjectTools(s, shopify);
Behavior5/5

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

No annotations provided, so description fully covers behavioral traits: irreversible, metafield references become broken (Shopify does not auto-clean), and return behavior (deleted GID or no-op message).

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, no fluff. Front-loaded with purpose, then consequences, then usage tip, then return info. Every sentence earns its place.

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?

No output schema, but description specifies return values. Covers purpose, side effects, prerequisite action, and result. Complete for a single-parameter delete tool.

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 already covers the parameter with 100% coverage. Description adds value by reiterating the irreversible nature and the consequence of broken references, plus the return behavior.

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 metaobject by GID', specifying the action and resource. Distinguishes from sibling tools like update_metaobject and get_metaobject.

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?

Explicitly advises to use get_metaobject to confirm the record before deleting, and highlights irreversibility and broken references. Provides clear usage context.

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