create_item
Add new inventory items to ConsignCloud with title, price, category, and inventory type for consignment, buy-outright, 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 implementation of createItem: converts price/cost to API cents format and performs POST request to /items endpoint, then converts 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)Tool registration in MCP server including name, description, and input schema validation.{ 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 dispatch handler for 'create_item' tool call, invoking client.createItem.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 defining the Item type used in createItem parameters and return type.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[]; }
- src/client.ts:364-368 (helper)Helper function to convert store currency amounts to API cents format, used in createItem.private convertToApiCents(amount: number | null | undefined): number { if (amount == null) return 0; // Convert to API cents (1000 ISK = 100000 cents, 10.00 USD = 1000 cents) return Math.round(amount * 100); }