set-cart-address
Assign a specific address to the shopping cart in Terminal.shop by providing the addressID, enabling accurate order delivery and checkout processes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addressID | Yes |
Implementation Reference
- server.js:624-650 (handler)The handler function for the 'set-cart-address' tool. It makes a PUT request to '/cart/address' with the provided addressID using terminalApi, and returns a success message or an error message with isError flag.async ({ addressID }) => { try { const response = await terminalApi.put("/cart/address", { addressID, }); return { content: [ { type: "text", text: "Successfully set shipping address for your cart.", }, ], }; } catch (error) { console.error("Error setting cart address:", error); return { content: [ { type: "text", text: `Error setting cart address: ${error.message}`, }, ], isError: true, }; } },
- server.js:621-623 (schema)The input schema for the 'set-cart-address' tool, defining addressID as a required string using Zod.{ addressID: z.string(), },
- server.js:619-651 (registration)The registration of the 'set-cart-address' tool using server.tool(), including schema and handler function.server.tool( "set-cart-address", { addressID: z.string(), }, async ({ addressID }) => { try { const response = await terminalApi.put("/cart/address", { addressID, }); return { content: [ { type: "text", text: "Successfully set shipping address for your cart.", }, ], }; } catch (error) { console.error("Error setting cart address:", error); return { content: [ { type: "text", text: `Error setting cart address: ${error.message}`, }, ], isError: true, }; } }, );