Trails provides an llms.txt file for AI-friendly documentation discovery. This file follows the llms.txt standard and provides structured context about Trails capabilities.URL:https://docs.trails.build/llms.txtUse this file to give your LLM context about Trails before making integration requests. It includes:
The Trails MCP Server allows you to leverage AI agents like Claude or Cursor seamlessly with Trails.The server is available at:https://docs.trails.build/mcp
You are a payment assistant that helps users send crypto payments using Trails.Key capabilities:- Accept any token from any chain- Settle payments in stablecoins (USDC/USDT)- Cross-chain swaps and bridges handled automatically- Gasless transactions available for permit-compatible tokensWhen users want to make a payment:1. Confirm the recipient address and amount2. Ask what token/chain they want to pay WITH (or suggest based on their balances)3. Get a quote to show fees and rates4. Execute when user confirmsAlways show the fee breakdown before executing. Never execute without user confirmation.
Handle these common errors in your LLM integration:
async function safePaymentCall(params: any) { try { return await handlePaymentTool(params); } catch (error: any) { const errorMap: Record<string, string> = { // Quote errors 'INSUFFICIENT_BALANCE': 'User does not have enough tokens. Check their balance first.', 'NO_ROUTE_FOUND': 'No route available for this swap. Try a different token pair or chain.', 'AMOUNT_TOO_SMALL': 'Amount is below minimum. Minimum is typically $1 equivalent.', 'QUOTE_EXPIRED': 'Quote expired. Get a new quote before proceeding.', // Execution errors 'INTENT_EXPIRED': 'Intent expired before execution. Start over with a new quote.', 'DEPOSIT_FAILED': 'Token deposit failed. Check user approved the transaction.', 'SLIPPAGE_EXCEEDED': 'Price moved too much. Retry with higher slippage tolerance.', // Auth errors 'INVALID_API_KEY': 'API key invalid. Check configuration.', 'RATE_LIMITED': 'Too many requests. Wait before retrying.' }; const message = errorMap[error.code] || `Payment failed: ${error.message}`; return { success: false, error: error.code, user_message: message, retry_allowed: !['INVALID_API_KEY', 'AMOUNT_TOO_SMALL'].includes(error.code) }; }}
When returning errors to the LLM, use a structured format:
{ "success": false, "error": "NO_ROUTE_FOUND", "user_message": "I couldn't find a route to swap PEPE to USDC on Base. This token may not be supported or have insufficient liquidity. Would you like to try a different token?", "suggestions": [ "Try swapping to ETH first, then to USDC", "Check if the token is available on a different chain" ], "retry_allowed": true}