Get Customer Profile
getProfileRetrieve the authenticated customer's complete profile information including wallet balance, notification preferences, and account settings.
Instructions
Retrieves the authenticated customer's complete profile information including wallet balance, notification preferences, and account settings
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/accounts/getProfile.ts:6-111 (handler)Tool handler function that registers the 'getProfile' MCP tool. It retrieves the API key from async context, calls client.getProfile(), formats the customer profile response (account info, wallet balance, notification settings, marketing preferences), and returns it as a formatted text response.
export function registerGetProfileTool(server: McpServer): void { // Register getProfile tool server.registerTool( "getProfile", { title: "Get Customer Profile", description: "Retrieves the authenticated customer's complete profile information including wallet balance, notification preferences, and account settings", inputSchema: {}, }, async () => { // Get API key from async context const apiKey = apiKeyStorage.getStore(); if (!apiKey) { return { content: [ { type: "text", text: "Error: X-API-KEY header is required", }, ], }; } // Create API client with customer's API key const client = new EuroparcelApiClient(apiKey); try { logger.info("Executing getProfile tool"); // Call the API const profileData = await client.getProfile(); // Type assertion to access actual API response properties const notifications = profileData.data.notification_settings as any; // Format the response for the AI const formattedResponse = ` Customer Profile Retrieved Successfully: Account Information: - Customer ID: ${profileData.data.customer_id} - Name: ${profileData.data.name} - Email: ${profileData.data.email} ${profileData.data.email_verified ? "✓ Verified" : "✗ Not verified"} - Phone: ${profileData.data.phone || "Not provided"} ${profileData.data.phone_verified ? "✓ Verified" : "✗ Not verified"} - Country: ${profileData.data.billing_country} - Language: ${profileData.data.preferred_language} - Currency: ${profileData.data.currency} Wallet Information: - Balance: ${profileData.data.wallet_balance} ${profileData.data.wallet_currency} Preferences: - AWB Format: ${profileData.data.awb_format} - Bank IBAN: ${profileData.data.bank_iban || "Not configured"} - Bank Holder: ${profileData.data.bank_holder || "Not configured"} Notification Settings: - Bordero Notifications: ${notifications.receive_bordero ? "Enabled" : "Disabled"} Email: ${notifications.email_bordero} - Prevention Email: ${notifications.prevention_email_notification ? "Enabled" : "Disabled"} Email: ${notifications.email_prevention} - Non-Pickup Alerts: ${notifications.non_pickup_notification ? "Enabled" : "Disabled"} Email: ${notifications.email_non_pickup} - Recipient Pickup Confirmation: ${notifications.recipient_pickup_confirmation_email ? "Enabled" : "Disabled"} - Delivery Confirmation: ${notifications.delivery_confirmation_email ? "Enabled" : "Disabled"} Email: ${notifications.email_delivery_confirmation} - Wallet Transactions: ${notifications.wallet_transaction_email ? "Enabled" : "Disabled"} Email: ${notifications.email_wallet_transaction} - Placed Orders: ${notifications.placed_order_email ? "Enabled" : "Disabled"} Email: ${notifications.email_placed_order} - Phone Delivery Notifications: ${notifications.phone_delivery_notification || "Not configured"} Marketing Preferences: - Email Notifications: ${profileData.data.marketing_settings.email_notifications ? "Enabled" : "Disabled"} - SMS Notifications: ${profileData.data.marketing_settings.sms_notifications ? "Enabled" : "Disabled"} `; logger.info("getProfile tool executed successfully"); return { content: [ { type: "text", text: formattedResponse, }, ], }; } catch (error) { logger.error("Error in getProfile tool", error); return { content: [ { type: "text", text: `Failed to retrieve profile: ${error instanceof Error ? error.message : "Unknown error"}`, }, ], isError: true, }; } }, ); logger.info("getProfile tool registered successfully"); } - src/tools/accounts/getProfile.ts:8-15 (registration)Registration of the 'getProfile' tool via server.registerTool() with tool name 'getProfile', title 'Get Customer Profile', description, and empty inputSchema.
server.registerTool( "getProfile", { title: "Get Customer Profile", description: "Retrieves the authenticated customer's complete profile information including wallet balance, notification preferences, and account settings", inputSchema: {}, }, - src/api/client.ts:107-110 (helper)API client method getProfile() that makes a GET request to /account/profile endpoint and returns a ProfileResponse.
async getProfile(): Promise<ProfileResponse> { const response = await this.client.get<ProfileResponse>("/account/profile"); return response.data; } - src/types/index.ts:409-412 (schema)ProfileResponse type: contains a 'message' string and 'data' field of type CustomerProfile.
export interface ProfileResponse { message: string; data: CustomerProfile; } - src/types/index.ts:9-26 (schema)CustomerProfile type definition with fields: customer_id, name, email, billing_country, preferred_language, currency, awb_format, bank_iban, bank_holder, email_verified, phone, phone_verified, wallet_balance, wallet_currency, notification_settings, marketing_settings.
export interface CustomerProfile { customer_id: number; name: string; email: string; billing_country: string; preferred_language: string; currency: string; awb_format: string; bank_iban: string | null; bank_holder: string | null; email_verified: boolean; phone: string | null; phone_verified: boolean; wallet_balance: number; wallet_currency: string; notification_settings: NotificationSettings; marketing_settings: MarketingSettings; }