clear-cart
Remove all items from your shopping cart on Terminal.shop, ensuring a clean slate for new purchases. Ideal for resetting or reorganizing your order.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:689-713 (handler)The handler function for the 'clear-cart' tool, registered inline. It sends a DELETE request to '/cart' using terminalApi, returns a success message on completion, or an error message if the request fails.server.tool("clear-cart", {}, async () => { try { const response = await terminalApi.delete("/cart"); return { content: [ { type: "text", text: "Your cart has been cleared successfully.", }, ], }; } catch (error) { console.error("Error clearing cart:", error); return { content: [ { type: "text", text: `Error clearing cart: ${error.message}`, }, ], isError: true, }; } });
- server.js:689-713 (registration)Registers the 'clear-cart' tool with an empty input schema and an inline asynchronous handler function.server.tool("clear-cart", {}, async () => { try { const response = await terminalApi.delete("/cart"); return { content: [ { type: "text", text: "Your cart has been cleared successfully.", }, ], }; } catch (error) { console.error("Error clearing cart:", error); return { content: [ { type: "text", text: `Error clearing cart: ${error.message}`, }, ], isError: true, }; } });