Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

update_stock

Update product inventory quantities in the art supply store system after receiving shipments, sales, or physical counts. Records stock changes with reason codes for accurate inventory tracking.

Instructions

Update inventory quantity after receiving shipment or doing physical count. Records the change in the system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
quantityYesNew quantity amount
reasonYesReason for update (received, sold, damaged, count)
skuYesProduct SKU to update

Implementation Reference

  • The core handler logic for the 'update_stock' tool. It validates the SKU, updates the quantity in the mock inventory database, calculates the delta, records the reason, and returns a detailed confirmation message with reorder level status.
    case 'update_stock': {
      const sku = String(args?.sku || '');
      const quantity = Number(args?.quantity || 0);
      const reason = String(args?.reason || 'manual update');
      const item = storeData.inventory.find(i => i.id === sku);
      
      if (!item) {
        return { content: [{ type: 'text', text: `❌ Product ${sku} not found` }] };
      }
      
      const oldQty = item.quantity;
      item.quantity = quantity;
      const diff = quantity - oldQty;
      
      return {
        content: [{
          type: 'text',
          text: `✅ Stock updated for ${item.name}\n- Previous: ${oldQty} units\n- New: ${quantity} units\n- Change: ${diff > 0 ? '+' : ''}${diff} units\n- Reason: ${reason}\n- ${quantity <= item.reorderLevel ? '⚠️ Now below reorder level!' : 'Stock level OK'}`
        }]
      };
    }
  • The tool schema definition, including name, description, and input validation schema specifying required parameters: sku (string), quantity (number), and reason (string). This is used for tool listing and input validation in MCP.
    {
      name: 'update_stock',
      description: 'Update inventory quantity after receiving shipment or doing physical count. Records the change in the system.',
      inputSchema: {
        type: 'object',
        properties: {
          sku: { type: 'string', description: 'Product SKU to update' },
          quantity: { type: 'number', description: 'New quantity amount' },
          reason: { type: 'string', description: 'Reason for update (received, sold, damaged, count)' },
        },
        required: ['sku', 'quantity', 'reason'],
      },
    },
  • src/index.ts:516-518 (registration)
    Registers the 'update_stock' tool (included in the 'tools' array) for discovery via the ListToolsRequestHandler in the MCP server.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/dashboard.ts:37-37 (registration)
    Mock tool registration in the dashboard server for displaying available tools in the web UI (not the actual MCP implementation).
    { name: 'update_stock', description: 'Update inventory quantities', category: 'Inventory Management' },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It indicates a write operation ('update', 'records the change') but fails to detail critical aspects such as required permissions, whether changes are reversible, potential side effects (e.g., triggering alerts), or response format. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences that are front-loaded with the core purpose. Every sentence earns its place by clarifying the action and context, though it could be slightly more structured (e.g., explicitly listing key behaviors). No redundant or verbose elements are present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a mutation operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., error handling, idempotency), output expectations, and comprehensive usage guidelines. For a tool that modifies inventory data, this leaves significant gaps for an AI agent to operate effectively.

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 description coverage is 100%, so the schema already documents all three parameters (sku, quantity, reason) with clear descriptions. The description adds minimal value beyond the schema by implying the 'reason' parameter's purpose through examples ('received, sold, damaged, count'), but does not provide additional syntax, constraints, or contextual meaning. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('update inventory quantity') and resources ('inventory', 'system'), and distinguishes it from siblings like 'check_inventory' or 'get_low_stock_items' by focusing on modification rather than retrieval. However, it doesn't explicitly differentiate from potential write operations like 'create_purchase_order' or 'update_loyalty_points' beyond the inventory context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidelines by mentioning 'after receiving shipment or doing physical count', which suggests contexts for application. However, it lacks explicit when-to-use vs. alternatives (e.g., compared to 'check_inventory' for read-only needs or other inventory tools), and does not specify prerequisites or exclusions, leaving some ambiguity for the agent.

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/wspotter/mcpart'

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