Skip to main content
Glama

create_ingredient

Add new ingredients or products to Inflow inventory system by providing product details like name, SKU, and description for inventory management.

Instructions

Create a new ingredient/product in Inflow inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
additionalFieldsNoAny additional product fields
descriptionNoProduct description
isActiveNoActive status (default: true)
nameYesProduct name
productIdYesUUID for the new product (generate with crypto.randomUUID())
skuNoSKU code

Implementation Reference

  • Main handler function for creating an ingredient/product. Validates required fields (productId, name), constructs the product object, and delegates to InflowClient.upsertProduct for the API call.
    async createProduct(client, args) {
      if (!args.productId) {
        return {
          success: false,
          error: 'productId is required (generate a UUID)'
        };
      }
    
      if (!args.name) {
        return {
          success: false,
          error: 'name is required'
        };
      }
    
      const product = {
        productId: args.productId,
        name: args.name,
        sku: args.sku,
        description: args.description,
        isActive: args.isActive !== undefined ? args.isActive : true,
        ...args.additionalFields
      };
    
      return await client.upsertProduct(product);
    },
  • Zod input schema defining parameters for the create_ingredient tool: productId (required UUID), name (required), and optional fields like sku, description, isActive, additionalFields.
    inputSchema: {
      productId: z.string().describe('UUID for the new product (generate with crypto.randomUUID())'),
      name: z.string().describe('Product name'),
      sku: z.string().optional().describe('SKU code'),
      description: z.string().optional().describe('Product description'),
      isActive: z.boolean().optional().describe('Active status (default: true)'),
      additionalFields: z.record(z.any()).optional().describe('Any additional product fields')
    }
  • index.js:154-178 (registration)
    Registers the 'create_ingredient' MCP tool with the server, providing description, input schema, and a thin async handler that calls productHandlers.createProduct and formats the response.
    server.registerTool(
      'create_ingredient',
      {
        description: 'Create a new ingredient/product in Inflow inventory',
        inputSchema: {
          productId: z.string().describe('UUID for the new product (generate with crypto.randomUUID())'),
          name: z.string().describe('Product name'),
          sku: z.string().optional().describe('SKU code'),
          description: z.string().optional().describe('Product description'),
          isActive: z.boolean().optional().describe('Active status (default: true)'),
          additionalFields: z.record(z.any()).optional().describe('Any additional product fields')
        }
      },
      async (args) => {
        const result = await productHandlers.createProduct(inflowClient, args);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      }
    );
  • Supporting utility in InflowClient that performs the HTTP PUT request to the Inflow API endpoint for creating or updating a product/ingredient, with error handling.
    async upsertProduct(product) {
      try {
        if (!product.productId) {
          return {
            success: false,
            error: 'productId is required for upsert'
          };
        }
    
        const response = await this.client.put(
          `/${this.config.companyId}/products`,
          product
        );
    
        return {
          success: true,
          data: response.data
        };
      } catch (error) {
        return this._handleError(error, 'upsertProduct');
      }
    }

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/intelligent-staffing-systems/mcp-inflow-ingredients'

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