update_item
Modify inventory item details like price, quantity, description, and category to maintain accurate stock records in consignment retail operations.
Instructions
Update an existing inventory item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Item ID | |
| title | No | ||
| description | No | ||
| tag_price | No | Price in cents | |
| category | No | ||
| split | No | Split percentage (0-1) | |
| quantity | No |
Implementation Reference
- src/server.ts:62-78 (registration)Registration of the 'update_item' tool, including name, description, and input schema definition.{ name: 'update_item', description: 'Update an existing inventory item', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Item ID' }, title: { type: 'string' }, description: { type: 'string' }, tag_price: { type: 'number', description: 'Price in cents' }, category: { type: 'string' }, split: { type: 'number', description: 'Split percentage (0-1)' }, quantity: { type: 'number' }, }, required: ['id'], }, },
- src/server.ts:438-440 (handler)MCP tool handler for 'update_item': extracts item ID and data from arguments, calls the client updateItem method, and formats the response as JSON text content.case 'update_item': const { id: itemId, ...itemData } = args as any; return { content: [{ type: 'text', text: JSON.stringify(await client.updateItem(itemId, itemData), null, 2) }] };
- src/client.ts:111-120 (helper)Client-side helper function that implements the actual API update: handles currency conversion, sends PATCH request to /items/{id}, and converts the response.async updateItem(id: string, data: Partial<Item>): Promise<Item> { // Convert user input to API cents const apiData = { ...data, tag_price: data.tag_price ? this.convertToApiCents(data.tag_price) : undefined, cost: data.cost ? this.convertToApiCents(data.cost) : undefined, }; const response = await this.client.patch(`/items/${id}`, apiData); return this.convertItemResponse(response.data); }