get_customer
Retrieve customer details from the ShipStation API using a specific customer ID. Simplify customer data management by accessing structured customer information efficiently.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Customer ID to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"customerId": {
"description": "Customer ID to retrieve",
"type": "number"
}
},
"required": [
"customerId"
],
"type": "object"
}
Implementation Reference
- src/tools/customer-tools.js:38-50 (handler)The handler function implementing the core logic of the 'get_customer' tool. It fetches the customer data via the ShipStation API client and formats the response as JSON or handles errors.handler: async ({ customerId }) => { try { const customer = await shipStationClient.getCustomer(customerId); return { content: [{ type: "text", text: JSON.stringify(customer, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } }
- src/tools/customer-tools.js:35-37 (schema)Input schema using Zod for validating the customerId parameter required by the get_customer tool.schema: { customerId: z.number().describe("Customer ID to retrieve") },
- src/server.js:174-191 (registration)Registration of the get_customer tool (included via ...customerTools spread) to the MCP server using server.tool() method.[ ...orderTools, ...shipmentTools, ...carrierTools, ...warehouseTools, ...productTools, ...customerTools, ...storeTools, ...webhookTools, ...fulfillmentTools ].forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); });
- src/api-client.js:161-163 (helper)Supporting helper method in ShipStationClient class that performs the actual API request to retrieve customer details by ID.async getCustomer(customerId) { return this.request('GET', `/customers/${customerId}`); }