set-cart-address
Assign a shipping or billing address to your Terminal.shop cart using a specific address ID to prepare for checkout.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addressID | Yes |
Implementation Reference
- server.js:625-651 (handler)Handler function that sets the shipping address on the cart by making a PUT request to the terminalApi with the provided addressID. Returns success message or error response.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:622-624 (schema)Zod schema defining the input parameter 'addressID' as a required string.addressID: z.string(), }, async ({ addressID }) => {
- server.js:620-652 (registration)Registration of the 'set-cart-address' tool using server.tool(), including name, input schema, and inline handler function."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, }; } }, );