create-address
Add a new shipping or billing address to your Terminal.shop account by providing required details like name, street, city, country, and postal code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| street1 | Yes | ||
| street2 | No | ||
| city | Yes | ||
| province | No | ||
| country | Yes | ||
| zip | Yes | ||
| phone | No |
Implementation Reference
- server.js:869-895 (handler)The handler function that executes the create-address tool logic: posts address details to the /address API endpoint, returns success message with address ID or error.async (params) => { try { const response = await terminalApi.post("/address", params); const addressID = response.data.data; return { content: [ { type: "text", text: `Address created successfully! Address ID: ${addressID}`, }, ], }; } catch (error) { console.error("Error creating address:", error); return { content: [ { type: "text", text: `Error creating address: ${error.message}`, }, ], isError: true, }; } }, );
- server.js:859-868 (schema)Zod schema defining the input parameters for the create-address tool: name, street1, street2 (optional), city, province (optional), country (2-letter), zip, phone (optional).{ name: z.string(), street1: z.string(), street2: z.string().optional(), city: z.string(), province: z.string().optional(), country: z.string().length(2), zip: z.string(), phone: z.string().optional(), },
- server.js:857-895 (registration)Registration of the create-address tool using server.tool, including name, input schema, and inline handler function.server.tool( "create-address", { name: z.string(), street1: z.string(), street2: z.string().optional(), city: z.string(), province: z.string().optional(), country: z.string().length(2), zip: z.string(), phone: z.string().optional(), }, async (params) => { try { const response = await terminalApi.post("/address", params); const addressID = response.data.data; return { content: [ { type: "text", text: `Address created successfully! Address ID: ${addressID}`, }, ], }; } catch (error) { console.error("Error creating address:", error); return { content: [ { type: "text", text: `Error creating address: ${error.message}`, }, ], isError: true, }; } }, );