update_ingredient
Modify existing ingredient details in Inflow inventory including name, SKU, description, status, and custom fields using the product ID.
Instructions
Update an existing ingredient/product in Inflow inventory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| additionalFields | No | Any additional fields to update | |
| description | No | New description | |
| isActive | No | Active status | |
| name | No | New product name | |
| productId | Yes | The product ID to update | |
| sku | No | New SKU code |
Implementation Reference
- src/handlers/product-handlers.js:149-173 (handler)Handler function updateProduct that constructs the update payload from args and delegates to InflowClient.upsertProduct for the actual API update.async updateProduct(client, args) { if (!args.productId) { return { success: false, error: 'productId is required' }; } // Build update object with only provided fields const updates = { productId: args.productId }; if (args.name !== undefined) updates.name = args.name; if (args.sku !== undefined) updates.sku = args.sku; if (args.description !== undefined) updates.description = args.description; if (args.isActive !== undefined) updates.isActive = args.isActive; // Merge any additional fields if (args.additionalFields) { Object.assign(updates, args.additionalFields); } return await client.upsertProduct(updates); }
- index.js:181-205 (registration)Registration of the 'update_ingredient' MCP tool, including input schema and handler invocation.server.registerTool( 'update_ingredient', { description: 'Update an existing ingredient/product in Inflow inventory', inputSchema: { productId: z.string().describe('The product ID to update'), name: z.string().optional().describe('New product name'), sku: z.string().optional().describe('New SKU code'), description: z.string().optional().describe('New description'), isActive: z.boolean().optional().describe('Active status'), additionalFields: z.record(z.any()).optional().describe('Any additional fields to update') } }, async (args) => { const result = await productHandlers.updateProduct(inflowClient, args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } );
- src/inflow-client.js:123-144 (helper)Core API implementation in InflowClient.upsertProduct that sends PUT request to /products endpoint to update the ingredient/product.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'); } }
- index.js:186-192 (schema)Zod input schema defining parameters for the update_ingredient tool.productId: z.string().describe('The product ID to update'), name: z.string().optional().describe('New product name'), sku: z.string().optional().describe('New SKU code'), description: z.string().optional().describe('New description'), isActive: z.boolean().optional().describe('Active status'), additionalFields: z.record(z.any()).optional().describe('Any additional fields to update') }