update_warehouse
Update warehouse details in ShipStation by providing the warehouse ID and JSON-formatted updated data to ensure accurate inventory and logistics management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| warehouseData | Yes | JSON string containing the updated warehouse data | |
| warehouseId | Yes | Warehouse ID to update |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"warehouseData": {
"description": "JSON string containing the updated warehouse data",
"type": "string"
},
"warehouseId": {
"description": "Warehouse ID to update",
"type": "number"
}
},
"required": [
"warehouseId",
"warehouseData"
],
"type": "object"
}
Implementation Reference
- src/tools/warehouse-tools.js:71-84 (handler)The handler function that implements the core logic for the 'update_warehouse' tool: parses JSON input, calls the API helper, and formats the response or error.handler: async ({ warehouseId, warehouseData }) => { try { const parsedData = JSON.parse(warehouseData); const result = await shipStationClient.updateWarehouse(warehouseId, parsedData); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } }
- src/tools/warehouse-tools.js:67-70 (schema)Zod input schema validating warehouseId as number and warehouseData as string (JSON).schema: { warehouseId: z.number().describe("Warehouse ID to update"), warehouseData: z.string().describe("JSON string containing the updated warehouse data") },
- src/tools/warehouse-tools.js:64-85 (registration)Full tool object registration within the warehouseTools array, including name, description, schema, and handler.{ name: "update_warehouse", description: "Update an existing warehouse", schema: { warehouseId: z.number().describe("Warehouse ID to update"), warehouseData: z.string().describe("JSON string containing the updated warehouse data") }, handler: async ({ warehouseId, warehouseData }) => { try { const parsedData = JSON.parse(warehouseData); const result = await shipStationClient.updateWarehouse(warehouseId, parsedData); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } } },
- src/api-client.js:127-129 (helper)Supporting API client method that makes the actual PUT request to ShipStation's warehouse update endpoint.async updateWarehouse(warehouseId, data) { return this.request('PUT', `/warehouses/${warehouseId}`, data); }