create_item
Add new inventory items to ConsignCloud by specifying title, price, category, and inventory type for consignment or retail operations.
Instructions
Create a new inventory item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Item title | |
| description | No | Item description | |
| tag_price | Yes | Price in cents | |
| category | No | Category ID | |
| account | No | Account ID (vendor/consignor) | |
| inventory_type | No | Type of inventory | |
| split | No | Split percentage (0-1) | |
| quantity | No | Quantity | |
| location | No | Location ID |
Implementation Reference
- src/client.ts:100-109 (handler)Core handler function that implements the logic to create a new inventory item by converting currency values to API format (cents), making a POST request to the ConsignCloud /items endpoint, and converting the response back to store currency.async createItem(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.post('/items', apiData); return this.convertItemResponse(response.data); }
- src/server.ts:39-61 (registration)Registration of the 'create_item' tool in the tools array returned by createTools(), including name, description, and detailed input schema.{ name: 'create_item', description: 'Create a new inventory item', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Item title' }, description: { type: 'string', description: 'Item description' }, tag_price: { type: 'number', description: 'Price in cents' }, category: { type: 'string', description: 'Category ID' }, account: { type: 'string', description: 'Account ID (vendor/consignor)' }, inventory_type: { type: 'string', enum: ['consignment', 'buy_outright', 'retail'], description: 'Type of inventory' }, split: { type: 'number', description: 'Split percentage (0-1)' }, quantity: { type: 'number', description: 'Quantity' }, location: { type: 'string', description: 'Location ID' }, }, required: ['title', 'tag_price'], }, },
- src/server.ts:435-436 (handler)MCP server request handler dispatch case for 'create_item' tool call, which invokes the client.createItem method and returns JSON response.case 'create_item': return { content: [{ type: 'text', text: JSON.stringify(await client.createItem(args as any), null, 2) }] };
- src/types.ts:3-20 (schema)TypeScript interface definition for Item, used as the basis for create_item input (Partial<Item>) and output.export interface Item { id: string; title: string; description: string | null; tag_price: number; // converted to store currency (e.g., ISK, USD) cost?: number; // converted to store currency category: string | null; account: string | null; inventory_type: 'consignment' | 'buy_outright' | 'retail'; split: number; // 0-1 quantity: number; status: string; location: string | null; batch: string | null; created: string; sold: string | null; custom_fields?: any[]; }