bos_cart_add_item
Adds a product to the cart using product ID and quantity. Supports optional variant ID and notes for customization.
Instructions
Add item to cart
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| product_id | Yes | ||
| quantity | Yes | ||
| variant_id | No | ||
| notes | No |
Implementation Reference
- src/tools/bos.ts:230-231 (handler)Handler function for bos_cart_add_item – sends a POST request to /mcp/cart/items with the provided args (product_id, quantity, optional variant_id, notes).
handler: async (args, client) => client.post('/mcp/cart/items', args), }, - src/tools/bos.ts:224-229 (schema)Input schema for bos_cart_add_item defining required fields (product_id: string, quantity: number) and optional fields (variant_id: string, notes: string).
schema: { product_id: { type: 'string' }, quantity: { type: 'number' }, variant_id: { type: 'string', optional: true }, notes: { type: 'string', optional: true }, }, - src/tools/bos.ts:221-231 (registration)Tool definition/registration as part of the cartTools array in src/tools/bos.ts, exported and later registered via server.tool() in src/index.ts (line 58-75).
{ name: 'bos_cart_add_item', description: 'Add item to cart', schema: { product_id: { type: 'string' }, quantity: { type: 'number' }, variant_id: { type: 'string', optional: true }, notes: { type: 'string', optional: true }, }, handler: async (args, client) => client.post('/mcp/cart/items', args), }, - src/client/index.ts:94-105 (helper)The client.post() method invoked by the handler – delegates to request() which performs the actual HTTP POST with retries and rate limiting.
async post<T>(path: string, data?: any): Promise<T> { return this.request<T>('POST', path, data); } async put<T>(path: string, data?: any): Promise<T> { return this.request<T>('PUT', path, data); } async delete<T>(path: string): Promise<T> { return this.request<T>('DELETE', path); } }