Skip to main content
Glama

Inventory Status

inventory_status
Read-onlyIdempotent

Get a snapshot of current stock levels for a connected store, including total product count, out-of-stock count, low-stock count (≤10 units), and prioritized lists of out-of-stock and low-stock items sorted by urgency.

Instructions

Snapshot of current stock levels for a connected store. Returns a summary object with total product count, out-of-stock count, low-stock count (≤10 units), plus two arrays: out_of_stock and low_stock — each containing product id, title, sku, quantity, and status. Items are sorted by urgency (lowest quantity first). Read-only and idempotent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
store_idYesUUID of a connected store (returned by store_connect with action="connect" or visible in store_connect with action="list" / the store_overview resource)

Implementation Reference

  • The getInventoryStatus function — main handler that fetches products, calculates out-of-stock/low-stock counts, and returns the inventory status result.
    export async function getInventoryStatus(storeId: string): Promise<InventoryStatusResult> {
      validateUUID(storeId, 'store');
      const store = await storage.getStoreById(storeId);
      if (!store) throw new NotFoundError('Store', storeId);
    
      const products = await storage.getProducts(storeId);
      const activeProducts = products.filter((p) => p.status === 'active');
    
      const outOfStock = activeProducts.filter((p) => p.inventory_quantity <= 0);
      const lowStock = activeProducts.filter((p) => p.inventory_quantity > 0 && p.inventory_quantity <= 10);
      const totalUnits = activeProducts.reduce((sum, p) => sum + Math.max(0, p.inventory_quantity), 0);
    
      return {
        store_id: storeId,
        total_products: activeProducts.length,
        total_units: totalUnits,
        out_of_stock: outOfStock.length,
        low_stock: lowStock.length,
        products: activeProducts
          .sort((a, b) => a.inventory_quantity - b.inventory_quantity)
          .slice(0, 50)
          .map((p) => ({
            id: p.id,
            title: p.title,
            sku: p.sku,
            quantity: p.inventory_quantity,
            status: p.inventory_quantity <= 0 ? 'out_of_stock' : p.inventory_quantity <= 10 ? 'low' : 'ok',
          })),
      };
    }
  • InventoryStatusResult interface defining the return shape (store_id, counts, product array with status).
    export interface InventoryStatusResult {
      store_id: string;
      total_products: number;
      total_units: number;
      out_of_stock: number;
      low_stock: number;
      products: Array<{
        id: string;
        title: string;
        sku: string | null;
        quantity: number;
        status: string;
      }>;
    }
  • src/index.ts:127-144 (registration)
    Registration of the 'inventory_status' tool via server.registerTool with input schema, description, and handler that calls getInventoryStatus.
    // ── Tool: inventory_status ────────────────────────────────────────
    server.registerTool(
      'inventory_status',
      {
        title: 'Inventory Status',
        description: 'Snapshot of current stock levels for a connected store. Returns a summary object with total product count, out-of-stock count, low-stock count (≤10 units), plus two arrays: out_of_stock and low_stock — each containing product id, title, sku, quantity, and status. Items are sorted by urgency (lowest quantity first). Read-only and idempotent.',
        inputSchema: z.object({
          store_id: z.string().uuid().describe('UUID of a connected store (returned by store_connect with action="connect" or visible in store_connect with action="list" / the store_overview resource)'),
        }),
        annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      },
      async ({ store_id }) => {
        try {
          const result = await getInventoryStatus(store_id);
          return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
        } catch (e) { return handleToolError(e); }
      }
    );
  • Demo seed function doc comment mentioning inventory_status as a consumer of the generated store_id.
    /**
     * Create a demo store populated with realistic products, customers, and
     * orders. Safe to call multiple times — each call creates a new demo
     * store with a unique ID. Returns the store_id so callers can plug it
     * straight into inventory_status, customers_segment, order_anomalies,
     * etc. without needing real Shopify or WooCommerce credentials.
Behavior4/5

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

Annotations already indicate read-only, non-destructive, idempotent. Description adds behavioral details: sort order by urgency (lowest quantity first) and low-stock threshold (≤10 units), which go beyond annotations.

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 with no wasted words. First sentence establishes purpose, second details return structure. Highly concise and front-loaded.

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 exists, but description fully describes return structure (summary object with counts, arrays with specific fields) and sorting. Complete for a read-only status tool.

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 has 100% coverage on the single parameter (store_id) with its own description. Description does not add additional meaning beyond the schema, so baseline 3.

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?

Description clearly states it provides a 'Snapshot of current stock levels for a connected store' and lists specific return fields (summary, arrays). It uses a specific verb 'returns' and distinguishes from siblings like 'inventory_forecast'.

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?

Describes what the tool returns, implying when to use it (for current stock snapshot). Does not explicitly exclude alternatives or provide when-not-to-use, but context is clear.

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/enzoemir1/shopops-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server