Skip to main content

llms.txt

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.txt Use this file to give your LLM context about Trails before making integration requests. It includes:
  • Core concepts (intents, routes, SDK modes)
  • API flow overview
  • Common integration patterns
  • Links to relevant documentation

MCP Server

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

Connect in Cursor

  1. Use Command + Shift + P (Ctrl + Shift + P on Windows) to open the command palette.
  2. Search for “Open MCP settings”.
  3. Select Add custom MCP to open the mcp.json file.
  4. In mcp.json, add the Trails server:
  1. In Cursor chat, ask “What tools do you have available?” to confirm the Trails MCP server is listed.
See the Cursor documentation for more details.

Connect in Claude

  1. Navigate to the [Developers] page in Claude Desktop.
  2. Select Edit config if you have an existing MCP configuration or add a new one.
  3. Open your config file and add the Trails MCP server:
    • Name: Trails
    • URL: https://docs.trails.build/mcp
  4. Save the configuration
  5. In a Claude chat, select the Search and tools and make sure your configuration file with Trails is enabled.
  6. Ask a question about Trails!
See the Model Context Protocol docs for more details.

Example Queries

You can ask questions like:
  • “How would I add a DeFi vault for USDC on Aave to my react app using Trails?”
  • “What theming options are available for Trails?”
  • “What chains does trails support?”
When your query is being processed, you’ll see an indication like:

Function Calling Tools

For custom LLM integrations (OpenAI, Anthropic, etc.), use these tool definitions to enable payment capabilities.

Payment Tool Definition

Quote Tool Definition

Swap Tool Definition

Example Prompts

These prompts help LLMs understand common payment scenarios.

System Prompt for Payment Agent

User Intent Examples

API Integration Example

Complete example implementing the payment tool with Trails API:

Error Handling

Handle these common errors in your LLM integration:

Error Response Format

When returning errors to the LLM, use a structured format:

Best Practices

Show the user the full quote including fees before calling executeIntent. Never auto-execute payments.
Quotes expire in 5 minutes. If the user takes too long to confirm, get a fresh quote.
Always validate Ethereum addresses and resolve ENS names before making API calls.
Use GetTokenList to cache supported tokens rather than hardcoding. Token availability changes.
When errors occur, give the LLM enough context to explain to the user and suggest alternatives.