Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

create_purchase_order

Generate purchase orders for art supply restocking. Automatically includes items below reorder levels and allows custom item additions to maintain optimal inventory.

Instructions

Create a purchase order for restocking. Automatically suggests items below reorder level.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
autoIncludeLowStockNoAutomatically include low stock items from this supplier
customItemsNoOptional: comma-separated SKUs to include
supplierYesSupplier name

Implementation Reference

  • Input schema for the create_purchase_order tool, defining parameters like supplier and auto-include low stock.
    name: 'create_purchase_order',
    description: 'Create a purchase order for restocking. Automatically suggests items below reorder level.',
    inputSchema: {
      type: 'object',
      properties: {
        supplier: { type: 'string', description: 'Supplier name' },
        autoIncludeLowStock: { type: 'boolean', description: 'Automatically include low stock items from this supplier' },
        customItems: { type: 'string', description: 'Optional: comma-separated SKUs to include' },
      },
      required: ['supplier'],
    },
  • Handler logic for create_purchase_order tool that finds supplier, identifies low stock items, calculates order details, and generates a purchase order summary.
    case 'create_purchase_order': {
      const supplier = String(args?.supplier || '');
      const autoInclude = Boolean(args?.autoIncludeLowStock);
      
      const supplierInfo = storeData.suppliers.find(s => s.name.toLowerCase().includes(supplier.toLowerCase()));
      
      if (!supplierInfo) {
        return { content: [{ type: 'text', text: `❌ Supplier not found: "${supplier}"` }] };
      }
      
      const supplierProducts = storeData.inventory.filter(i => i.supplier === supplierInfo.name);
      const lowStock = autoInclude ? supplierProducts.filter(i => i.quantity <= i.reorderLevel) : [];
      
      const orderTotal = lowStock.reduce((sum, item) => sum + (item.price * (item.reorderLevel * 2 - item.quantity)), 0);
      
      return {
        content: [{
          type: 'text',
          text: `📝 Purchase Order Created\n\n🏢 Supplier: ${supplierInfo.name}\n📅 Date: ${new Date().toISOString().split('T')[0]}\n⏱️ Expected Delivery: ${supplierInfo.leadTime}\n\n${lowStock.length > 0 ? `Items to Order:\n${lowStock.map(item =>
            `• ${item.name} (${item.id})\n  Order Qty: ${item.reorderLevel * 2 - item.quantity} | Est. Cost: $${(item.price * (item.reorderLevel * 2 - item.quantity) * 0.6).toFixed(2)}`
          ).join('\n\n')}\n\n💰 Estimated Total: $${(orderTotal * 0.6).toFixed(2)}` : 'No items below reorder level for this supplier.'}`
        }]
      };
    }
  • src/index.ts:516-518 (registration)
    Registration of the ListToolsRequestSchema handler which returns the list of all tools, including create_purchase_order.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/dashboard.ts:54-54 (registration)
    Mock registration of the tool in the dashboard server for UI display purposes.
    { name: 'create_purchase_order', description: 'Generate purchase orders', category: 'Supplier Management' },

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