Skip to main content
Glama

list_locations

List all physical and virtual store locations to obtain their GID, status, and address. Use the GID to set inventory quantities or create fulfillments. Inactive locations are included but cannot receive new inventory or fulfillments.

Instructions

List the store's locations — physical or virtual places where inventory is stocked or fulfilled from (warehouses, retail stores, drop-ship partners). Returns each location's name, active/inactive flag, city + country, and GID. The location GID is required by set_inventory_quantity and create_fulfillment. Inactive locations still exist but cannot accept new inventory or fulfillments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNoPage size (1-100). Most stores have under a dozen locations.

Implementation Reference

  • The async handler function for the 'list_locations' tool. Executes the LIST_LOCATIONS_QUERY GraphQL query, maps over the returned location edges, formats each location's name, active status, city, country, and GID, and returns the result as text content.
      async (args) => {
        const data = await client.graphql<{
          locations: {
            edges: Array<{
              node: {
                id: string;
                name: string;
                isActive: boolean;
                address?: { city?: string | null; countryCode?: string | null };
              };
            }>;
          };
        }>(LIST_LOCATIONS_QUERY, { first: args.first });
        const lines = [
          `Found ${data.locations.edges.length} location(s):`,
          ...data.locations.edges.map(({ node }) => {
            const city = node.address?.city ?? "?";
            const country = node.address?.countryCode ?? "?";
            const active = node.isActive ? "active" : "inactive";
            return `  ${node.name} (${active}) — ${city}, ${country} — ${node.id}`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Zod schema for the 'list_locations' tool input. Defines a single 'first' parameter (number, 1-100, default 20) for page size.
    const listLocationsSchema = {
      first: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("Page size (1-100). Most stores have under a dozen locations."),
    };
  • Registration of the 'list_locations' tool on the MCP server via server.tool(), with its name, description, schema, and handler.
    server.tool(
      "list_locations",
      "List the store's locations — physical or virtual places where inventory is stocked or fulfilled from (warehouses, retail stores, drop-ship partners). Returns each location's name, active/inactive flag, city + country, and GID. The location GID is required by set_inventory_quantity and create_fulfillment. Inactive locations still exist but cannot accept new inventory or fulfillments.",
      listLocationsSchema,
      async (args) => {
        const data = await client.graphql<{
          locations: {
            edges: Array<{
              node: {
                id: string;
                name: string;
                isActive: boolean;
                address?: { city?: string | null; countryCode?: string | null };
              };
            }>;
          };
        }>(LIST_LOCATIONS_QUERY, { first: args.first });
        const lines = [
          `Found ${data.locations.edges.length} location(s):`,
          ...data.locations.edges.map(({ node }) => {
            const city = node.address?.city ?? "?";
            const country = node.address?.countryCode ?? "?";
            const active = node.isActive ? "active" : "inactive";
            return `  ${node.name} (${active}) — ${city}, ${country} — ${node.id}`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • The LIST_LOCATIONS_QUERY GraphQL query used by the handler to fetch locations (id, name, isActive, address city/countryCode).
    const LIST_LOCATIONS_QUERY = /* GraphQL */ `
      query ListLocations($first: Int!) {
        locations(first: $first) {
          edges {
            node { id name isActive address { city countryCode } }
          }
        }
      }
    `;
Behavior3/5

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

With no annotations, the description carries full burden. It details returned fields and notes that inactive locations cannot accept new inventory or fulfillments. However, it omits pagination behavior (despite the 'first' parameter) and does not explicitly state the operation is read-only or safe.

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 concise sentences: purpose and definition, return fields and cross-tool references, behavioral note. Each sentence earns its place with no redundancy or fluff.

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 essential aspects: purpose, return fields, relationship to other tools, and an important behavioral constraint (inactive locations). Lacks mention of sorting or pagination details, but given the simplicity of the tool and that pagination is covered in the schema, it is nearly complete.

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

Parameters3/5

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

Schema coverage is 100% and the parameter description already provides complete semantics (page size range, default, typical size). The tool description adds no additional parameter information beyond what's in the 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?

Clearly states it lists store locations, defines what qualifies (physical/virtual), specifies return fields (name, active/inactive, city+country, GID), and distinguishes from siblings by noting GID is required by set_inventory_quantity and create_fulfillment.

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?

Indicates usage for getting location IDs and understanding location status (active/inactive). Provides context on when to use via linking to specific downstream tools. Lacks explicit 'when not to use' or comparison to alternative list tools, but the sibling tool names implicitly differentiate.

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