Skip to main content
Glama

lookup_customer

Find customer details including purchase history, loyalty points, and preferences using name, email, or phone number to support personalized service and business management.

Instructions

Find customer information by name, email, or phone. Returns purchase history, loyalty points, and preferences.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesCustomer name, email, or phone number

Implementation Reference

  • Handler implementation for 'lookup_customer' tool. Searches the mock customer database by identifier (name, email, phone, or ID) and returns detailed customer information including contact details, spending, loyalty points, last visit, and preferences.
    case 'lookup_customer': { const identifier = String(args?.identifier || '').toLowerCase(); const customer = storeData.customers.find(c => c.name.toLowerCase().includes(identifier) || c.email.toLowerCase().includes(identifier) || c.phone.includes(identifier) || c.id.toLowerCase() === identifier ); if (!customer) { return { content: [{ type: 'text', text: `❌ Customer not found: "${args?.identifier}"` }] }; } return { content: [{ type: 'text', text: `👤 ${customer.name} (${customer.id})\n\n📧 ${customer.email}\n📱 ${customer.phone}\n\n💰 Total Spent: $${customer.totalSpent.toFixed(2)}\n⭐ Loyalty Points: ${customer.loyaltyPoints} (≈ $${(customer.loyaltyPoints / 10).toFixed(2)} credit)\n📅 Last Visit: ${customer.lastVisit}\n🎨 Preferences: ${customer.preferences.join(', ')}` }] }; }
  • Tool schema definition for 'lookup_customer', specifying the input schema requiring an 'identifier' string parameter.
    { name: 'lookup_customer', description: 'Find customer information by name, email, or phone. Returns purchase history, loyalty points, and preferences.', inputSchema: { type: 'object', properties: { identifier: { type: 'string', description: 'Customer name, email, or phone number' }, }, required: ['identifier'], }, },
  • src/index.ts:516-518 (registration)
    Registration of all tools including 'lookup_customer' via the ListToolsRequestHandler, which returns the complete tools list containing the lookup_customer definition.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • Mock customer database used by the lookup_customer handler to search and retrieve customer data.
    customers: [ { id: 'CUST001', name: 'Sarah Martinez', email: 'sarah.m@email.com', phone: '555-0101', loyaltyPoints: 450, totalSpent: 1250.45, lastVisit: '2025-10-02', preferences: ['Watercolor', 'Brushes'] }, { id: 'CUST002', name: 'James Chen', email: 'jchen@email.com', phone: '555-0102', loyaltyPoints: 890, totalSpent: 2340.78, lastVisit: '2025-10-03', preferences: ['Oil Paint', 'Canvas'] }, { id: 'CUST003', name: 'Emily Rodriguez', email: 'emily.r@email.com', phone: '555-0103', loyaltyPoints: 230, totalSpent: 678.90, lastVisit: '2025-09-28', preferences: ['Drawing', 'Sketching'] }, { id: 'CUST004', name: 'Michael Foster', email: 'm.foster@email.com', phone: '555-0104', loyaltyPoints: 1200, totalSpent: 3890.50, lastVisit: '2025-10-01', preferences: ['Acrylic', 'Canvas', 'Brushes'] }, ],

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wspotter/mcpart'

If you have feedback or need assistance with the MCP directory API, please join our Discord server