Skip to main content
Glama

list_metaobjects

List all metaobjects of a given type, returning display name, handle, GID, and ACTIVE/DRAFT status. Supports cursor pagination with the after parameter.

Instructions

List instances of a single metaobject type — e.g. all 'lookbook' or 'product_feature' entries. Returns each metaobject's display name, handle, GID, and (when the type is publishable) ACTIVE/DRAFT status. The type handle comes from list_metaobject_definitions. Cursor-paginated; pass after to advance pages. To inspect an individual metaobject's full field values, follow up with get_metaobject.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesMetaobject type handle (e.g. 'lookbook', 'product_feature', '$app:landing_page'). Get valid values from list_metaobject_definitions. Custom app namespaces use the '$app:' prefix.
firstNoPage size (1-100).
afterNoCursor from a prior page's pageInfo. Omit on the first call.

Implementation Reference

  • Handler function for the list_metaobjects tool. Sends a GraphQL query (LIST_METAOBJECTS_QUERY) to fetch metaobjects of a given type, paginated, and returns formatted text with each metaobject's display name, status, handle, and GID.
    server.tool(
      "list_metaobjects",
      "List instances of a single metaobject type — e.g. all 'lookbook' or 'product_feature' entries. Returns each metaobject's display name, handle, GID, and (when the type is publishable) ACTIVE/DRAFT status. The type handle comes from list_metaobject_definitions. Cursor-paginated; pass `after` to advance pages. To inspect an individual metaobject's full field values, follow up with get_metaobject.",
      listMetaobjectsSchema,
      async (args) => {
        const data = await client.graphql<{
          metaobjects: Connection<MetaobjectNode>;
        }>(LIST_METAOBJECTS_QUERY, {
          type: args.type,
          first: args.first,
          after: args.after,
        });
        const edges = data.metaobjects.edges;
        if (edges.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No metaobjects of type "${args.type}".`,
              },
            ],
          };
        }
        const rows: string[] = [
          `Found ${edges.length} metaobject(s) of type "${args.type}":`,
        ];
        for (const { node } of edges) {
          const status = node.capabilities?.publishable?.status;
          const label = node.displayName ?? node.handle;
          rows.push(`  ${label}${status ? ` [${status}]` : ""} — ${node.handle} — ${node.id}`);
        }
        return {
          content: [{ type: "text" as const, text: rows.join("\n") }],
        };
      },
    );
  • Zod schema defining the input parameters for list_metaobjects: type (string), first (page size, default 25), and after (optional pagination cursor).
    const listMetaobjectsSchema = {
      type: z
        .string()
        .describe(
          "Metaobject type handle (e.g. 'lookbook', 'product_feature', '$app:landing_page'). Get valid values from list_metaobject_definitions. Custom app namespaces use the '$app:' prefix.",
        ),
      first: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(25)
        .describe("Page size (1-100)."),
      after: z
        .string()
        .optional()
        .describe("Cursor from a prior page's pageInfo. Omit on the first call."),
    };
  • src/server.ts:23-67 (registration)
    Registration point: the tool is registered via registerMetaobjectTools() called in buildContext().
    import { registerMetaobjectTools } from "./tools/metaobjects.js";
    import { registerAnalyticsTools } from "./tools/analytics.js";
    import { registerBridgeTools } from "./tools/bridge.js";
    
    export interface ServerConfig {
      host: string;
      port: number;
      shopifyStore: string;
      shopifyAccessToken: string;
      shopifyApiVersion?: string;
      comfyUIUrl?: string;
      comfyUIPublicUrl?: string;
      comfyUIDefaultCkpt: string;
    }
    
    interface Session {
      server: McpServer;
      transport: StreamableHTTPServerTransport;
    }
    
    function buildContext(config: ServerConfig) {
      const shopify = new ShopifyClient({
        store: config.shopifyStore,
        accessToken: config.shopifyAccessToken,
        apiVersion: config.shopifyApiVersion,
      });
      const comfyui = config.comfyUIUrl
        ? new ComfyUIClient({
            baseUrl: config.comfyUIUrl,
            publicUrl: config.comfyUIPublicUrl ?? config.comfyUIUrl,
          })
        : null;
      const buildServer = () => {
        const s = new McpServer({ name: "shopify-mcp", version: "0.1.0" });
        registerProductTools(s, shopify);
        registerOrderTools(s, shopify);
        registerInventoryTools(s, shopify);
        registerCustomerTools(s, shopify);
        registerMetafieldTools(s, shopify);
        registerDraftOrderTools(s, shopify);
        registerCollectionTools(s, shopify);
        registerVariantTools(s, shopify);
        registerFulfillmentTools(s, shopify);
        registerWebhookTools(s, shopify);
        registerMetaobjectTools(s, shopify);
  • GraphQL query used by the list_metaobjects handler to fetch paginated metaobject instances of a given type.
    const LIST_METAOBJECTS_QUERY = /* GraphQL */ `
      query ListMetaobjects($type: String!, $first: Int!, $after: String) {
        metaobjects(type: $type, first: $first, after: $after) {
          edges {
            cursor
            node {
              id
              type
              handle
              displayName
              updatedAt
              capabilities { publishable { status } }
              fields { key type value }
            }
          }
          pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
        }
      }
    `;
Behavior4/5

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

No annotations provided, but description compensates well by detailing return fields (display name, handle, GID, publishable status), cursor-based pagination with 'after', and the condition for status (only for publishable types). It implicitly indicates a read operation but does not explicitly state read-only or rate limits.

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?

Two sentences plus a pagination note and a follow-up suggestion. Every sentence adds value. Front-loaded with purpose, then details on return values and pagination. No wasteful words.

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?

For a list tool with 3 params and no output schema, the description covers what is returned, pagination mechanics, and prerequisite tool (list_metaobject_definitions). Could mention that results are ordered or if any filtering is available, but not necessary. Adequate for agent's decision.

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 coverage is 100%, baseline 3. Description adds meaningful context: explains the 'type' parameter as a handle from list_metaobject_definitions with prefix convention, clarifies 'after' is an opaque cursor from a prior page, and notes default for 'first'. Does not repeat schema info.

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 lists instances of a single metaobject type with concrete examples ('lookbook', 'product_feature'). It distinguishes from siblings by referencing list_metaobject_definitions for type handles and get_metaobject for individual details.

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 tells when to use this tool (list instances) and provides alternatives: use list_metaobject_definitions to get valid type handles, and use get_metaobject for full field values of an individual metaobject. No confusion with other list or get tools.

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