get_orders
Retrieve order information for a specific user in SAP Commerce Cloud by providing their user ID or email address.
Instructions
Get orders for a specific user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | User ID or email |
Implementation Reference
- src/hybris-client.ts:372-376 (handler)Core implementation of getOrders method in HybrisClient that fetches the user's orders via the OCC REST API endpoint.async getOrders(userId: string): Promise<{ orders: Order[] }> { return this.request<{ orders: Order[] }>( `/rest/v2/${this.config.baseSiteId}/users/${userId}/orders?fields=FULL` ); }
- src/index.ts:97-110 (registration)Registration of the 'get_orders' tool in the MCP tools array, defining name, description, and input schema.{ name: 'get_orders', description: 'Get orders for a specific user', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'User ID or email', }, }, required: ['userId'], }, },
- src/index.ts:313-315 (handler)MCP tool call handler switch case that delegates 'get_orders' execution to hybrisClient.getOrders.case 'get_orders': result = await hybrisClient.getOrders(args?.userId as string); break;
- src/hybris-client.ts:48-58 (schema)TypeScript interface defining the Order structure used in the output of getOrders.export interface Order { code: string; status: string; created: string; totalPrice: { value: number; currencyIso: string; formattedValue: string; }; entries: OrderEntry[]; }
- src/index.ts:100-109 (schema)Input schema for the 'get_orders' tool validating the userId parameter.inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'User ID or email', }, }, required: ['userId'], },