Tools Reference
The Leclerk chatbot system uses 21 specialized tools to handle customer interactions, manage orders, and provide restaurant services.Tool Categories
Order Management Tools
update_order_draft
Updates the order draft with items, customer information, delivery details, and payment method. This is the central tool for managing order state. Key Parameters:service_type: delivery or collectionitems: Array of menu items with SKU IDs and optionsdelivery_address_string: Complete delivery addresspayment_method: Payment method selectionrequested_time: ASAP or specific timedeals: Array of combo deals
menu_lookup
Search and browse menu items with flexible query capabilities. Query Types:browse_categories: Minimal token browsingsearch_skus: Fuzzy search for items and dealslist_categories: List all categories with detailslist_skus: List items with filtersget_sku_details: Get detailed SKU informationlist_deals: List available dealsget_deal_details: Get deal information
check_address
Validates delivery addresses and finds serviceable locations. In organization mode, returns the best location for delivery. Parameters:address_string: Full delivery addresslatitude/longitude: Coordinates for location-based check
send_order_form
Sends WhatsApp flow for interactive menu browsing. Must be called after location is set in organization mode.query_live_order_status
Checks status of active orders including delivery info, payment status, and tracking. Query Types:status: Basic status infopayment: Payment statusdelivery: Full delivery informationtracking: Tracking URL and statusdriver: Courier informationcollection: Pickup statustiming: Time estimatesall: Complete information
Customer Information Tools
get_customer_previous_orders
Retrieves customer order history, favorite products, and statistics for personalization.get_current_time
Gets current time in specified timezone. Essential for scheduling orders and messages. Parameters:timezone: Target timezone (default: Europe/Zurich)
get_store_information
Fetches restaurant details including opening hours, address, and payment methods. Info Types:basic: ID and namelocation: Address detailsopening_hours: Operating hourscatalog: Full menucurrency: Store currencycontact_info: Contact detailspayment_methods: Available payment optionsdelivery_settings: Delivery configuration
Messaging & Engagement Tools
schedule_message
Schedules WhatsApp messages up to 24 hours in advance. Parameters:message: Message contentscheduled_for: ISO 8601 datetimetype: permanent or until_next_message
cancel_scheduled_message
Cancels a previously scheduled message. Parameters:scheduled_message_id: ID from schedule_message
list_scheduled_messages
Lists all pending scheduled messages for the conversation.react_to_message
Reacts to customer messages with emojis. Parameters:emoji: Emoji to react withmessage_to_react: Part of message to react to
generate_fortune_wheel_link
Generates promotional game links for customer engagement.Customer Management Tools
change_customer_language
Updates customer’s preferred language for UI elements. Supported Languages:fr: Frenchen: Englishde: Germanit: Italianes: Spanish
manage_customer_memory
Stores and retrieves persistent customer preferences. Operations:get: Retrieve stored informationset: Store new informationdelete: Remove stored memory
location: Restaurant-specificbusinessOrganization: Chain-wide
register_feedback
Collects customer feedback with scoring. Score Types:general_score: Overall satisfaction (required)food_score: Food qualitydelivery_score: Delivery serviceordering_experience_score: Ordering process
Multi-location Support Tools
switch_location
Switches active location in organization mode. Resets order draft when changing locations. Parameters:location_id: Target location ID
organization_location_query
Queries information about other locations in the organization. Query Types:list_all: Show all locationsget_location_details: Specific location infocheck_availability: Check if location is open
Internal Tools
think
Internal reasoning tool for complex logic. Adds latency - use strategically. Use Cases:- Validation errors
- Complex order parsing (5+ items)
- Ambiguous requests
- Menu lookups with specific criteria
report
Reports issues to support team via Linear and Discord. Priority Levels:P0: Critical - System downP1: High - Major feature brokenP2: Medium - Non-critical bugP3: Low - Minor issuesP4: Trivial - Cosmetic issues
Organization vs Location Mode
The system operates in two modes:Location Mode
- Single restaurant location
- Direct menu access
- Simple address validation
Organization Mode
- Multiple locations in a chain
- Requires location selection before ordering
check_addressreturns best locationmenu_lookupneeds explicit location_idswitch_locationavailable for changing locations
Payment Flow
The system handles three payment scenarios throughupdate_order_draft:
- RegisterWithoutPayment: Store handles payment directly
- InstantPayment: Saved card, immediate charge
- CheckoutPayment: One-time payment, link sent
- noPaymentMethod: Card setup required first
Common Error Codes
INVALID_ADDRESS: Address couldn’t be parsedOUT_OF_DELIVERY_RADIUS: Address outside delivery zoneNO_PAYMENT_METHOD: Payment method requiredLOCATION_ID_NOT_FOUND: Invalid location IDPOSTAL_CODE_NOT_SERVED: Postal code not in service area
Best Practices
- Validate addresses early using
check_addressbefore building orders - Use
get_current_timebefore scheduling messages or orders - Batch menu queries when possible to reduce latency
- Check organization mode before using location-specific features
- Handle payment setup proactively when NO_PAYMENT_METHOD errors occur
- Use
thinktool sparingly as it adds latency - Report issues promptly using the report tool
- Preserve exact promo codes - don’t modify case or formatting
Tool Response Structure
All tools return consistent response structures:Integration Points
- Nexus API: Backend service for all operations
- WhatsApp: Message delivery and interactive flows
- Payment Systems: Card processing and alternative payments
- Langfuse: Observability and tracing
- Linear/Discord: Issue tracking and notifications