Skip to main content
Glama

list_metaobject_definitions

Discover metaobject definitions to understand custom data shapes before listing or creating metaobject instances.

Instructions

List the metaobject definitions (custom types/schemas) registered on this Shopify store, with their field definitions. Each definition declares a type handle, a set of typed fields, and which fields are required. Use this tool to discover what custom data shapes the store supports before calling list_metaobjects (which queries instances of one type) or create_metaobject (which creates a new instance). Cursor-paginated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNoPage size (1-100). 25 is usually plenty — most stores have <50 metaobject types total.
afterNoCursor from a prior page's pageInfo. Omit on the first call.

Implementation Reference

  • The tool handler function for 'list_metaobject_definitions'. It executes the GraphQL query, formats results (definition name, type, object count, field definitions), and returns a text response.
    server.tool(
      "list_metaobject_definitions",
      "List the metaobject definitions (custom types/schemas) registered on this Shopify store, with their field definitions. Each definition declares a `type` handle, a set of typed fields, and which fields are required. Use this tool to discover what custom data shapes the store supports before calling list_metaobjects (which queries instances of one type) or create_metaobject (which creates a new instance). Cursor-paginated.",
      listDefinitionsSchema,
      async (args) => {
        const data = await client.graphql<{
          metaobjectDefinitions: Connection<MetaobjectDefinitionNode>;
        }>(LIST_METAOBJECT_DEFINITIONS_QUERY, {
          first: args.first,
          after: args.after,
        });
        const edges = data.metaobjectDefinitions.edges;
        if (edges.length === 0) {
          return {
            content: [
              { type: "text" as const, text: "No metaobject definitions on this store." },
            ],
          };
        }
        const rows: string[] = [`Found ${edges.length} definition(s):`];
        for (const { node } of edges) {
          rows.push(`  ${node.name} (${node.type}) — ${node.metaobjectsCount ?? "?"} objects — ${node.id}`);
          for (const f of node.fieldDefinitions) {
            const req = f.required ? "*" : "";
            rows.push(`    - ${f.key}${req}: ${f.type.name}`);
          }
        }
        return {
          content: [{ type: "text" as const, text: rows.join("\n") }],
        };
      },
    );
  • The GraphQL query (ListMetaobjectDefinitions) that fetches metaobject definitions from Shopify with pagination support.
    const LIST_METAOBJECT_DEFINITIONS_QUERY = /* GraphQL */ `
      query ListMetaobjectDefinitions($first: Int!, $after: String) {
        metaobjectDefinitions(first: $first, after: $after) {
          edges {
            cursor
            node {
              id
              name
              type
              description
              metaobjectsCount
              fieldDefinitions {
                key
                name
                type { name }
                required
                description
              }
            }
          }
          pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
        }
      }
    `;
  • Input schema for the 'list_metaobject_definitions' tool: 'first' (page size, 1-100, default 25) and 'after' (optional cursor for pagination).
    const listDefinitionsSchema = {
      first: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(25)
        .describe("Page size (1-100). 25 is usually plenty — most stores have <50 metaobject types total."),
      after: z
        .string()
        .optional()
        .describe("Cursor from a prior page's pageInfo. Omit on the first call."),
    };
  • src/server.ts:67-67 (registration)
    Registration call: registerMetaobjectTools(s, shopify) is invoked in buildContext to register all metaobject tools including 'list_metaobject_definitions'.
    registerMetaobjectTools(s, shopify);
  • The export function registerMetaobjectTools that uses server.tool() to register the tool with the MCP server.
    export function registerMetaobjectTools(
      server: McpServer,
      client: ShopifyClient,
    ): void {
Behavior4/5

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

No annotations provided, but description discloses pagination (cursor-paginated) and the returned content (field definitions, type handle, required fields). Could mention access requirements or rate limits, but for a read-only list tool, it is fairly 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?

Three sentences: first states purpose, second explains content, third gives usage guidance and pagination. Front-loaded and concise with no waste.

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?

Despite no output schema, description explains what definitions contain (type handle, field definitions, required fields) and mentions pagination. Adequate for a list tool with two parameters.

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

Parameters5/5

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

Schema description coverage is 100%, and the description adds practical guidance: '25 is usually plenty — most stores have <50 metaobject types total' and explains cursor usage for pagination, enhancing understanding beyond schema.

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 action (list metaobject definitions) and the resource (custom types/schemas on Shopify store). It differentiates from siblings by explicitly mentioning usage before list_metaobjects and create_metaobject.

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 when to use the tool: before calling list_metaobjects or create_metaobject. Implicitly excludes using it for querying instances or creating instances, providing clear 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