Skip to main content

Example Prompts & Responses

These examples demonstrate actual tool responses from the LI.FI MCP server. Use them as reference for understanding data formats and building integrations.

Get Chain Information

Prompt: “What are the details for Ethereum?” Tool called: get-chain-by-name with name: "ethereum"
{
  "id": 1,
  "key": "eth",
  "name": "Ethereum",
  "nativeToken": {
    "address": "0x0000000000000000000000000000000000000000",
    "symbol": "ETH",
    "decimals": 18,
    "name": "ETH"
  },
  "metamask": {
    "chainId": "0x1",
    "blockExplorerUrls": ["https://etherscan.io/"],
    "chainName": "Ethereum Mainnet",
    "rpcUrls": ["https://ethereum-rpc.publicnode.com", "https://eth.drpc.org"]
  }
}

Get Token Details

Prompt: “Get USDC token info on Ethereum” Tool called: get-token with chain: "1", token: "USDC"
{
  "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "chainId": 1,
  "symbol": "USDC",
  "decimals": 6,
  "name": "USD Coin",
  "coinKey": "USDC",
  "priceUSD": "0.99969",
  "marketCapUSD": 70829343624,
  "volumeUSD24H": 19781184506,
  "tags": ["stablecoin"]
}

Same-Chain Swap Quote

Prompt: “Get a quote to swap 0.01 ETH to USDC on Ethereum” Tool called: get-quote with:
{
  "fromChain": "1",
  "toChain": "1",
  "fromToken": "0x0000000000000000000000000000000000000000",
  "toToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "fromAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "fromAmount": "10000000000000000",
  "slippage": "0.03"
}
Response (key fields):
{
  "type": "lifi",
  "tool": "sushiswap",
  "toolDetails": {
    "key": "sushiswap",
    "name": "SushiSwap Aggregator"
  },
  "action": {
    "fromToken": { "symbol": "ETH", "decimals": 18, "priceUSD": "2249.76" },
    "fromAmount": "10000000000000000",
    "toToken": { "symbol": "USDC", "decimals": 6, "priceUSD": "0.99969" },
    "slippage": 0.03
  },
  "estimate": {
    "toAmount": "22392397",
    "toAmountMin": "21720625",
    "fromAmountUSD": "22.4976",
    "toAmountUSD": "22.3855",
    "gasCosts": [{
      "amount": "66216217693968",
      "amountUSD": "0.1490",
      "token": { "symbol": "ETH" }
    }],
    "feeCosts": [{
      "name": "LIFI Fixed Fee",
      "amountUSD": "0.0562",
      "percentage": "0.0025"
    }]
  },
  "transactionRequest": {
    "to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
    "data": "0x736eac0b5a28cb9d...",
    "value": "0x2386f26fc10000",
    "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "chainId": 1,
    "gasPrice": "0xa7a9b10",
    "gasLimit": "0x778a1"
  }
}
Key fields to note:
  • estimate.toAmount: Expected USDC output (22.39 USDC with 6 decimals)
  • estimate.toAmountMin: Minimum after slippage (21.72 USDC)
  • transactionRequest: Ready-to-sign transaction object

Cross-Chain Swap Quote

Prompt: “Bridge 0.01 ETH from Ethereum to USDC on Base” Tool called: get-quote with:
{
  "fromChain": "1",
  "toChain": "8453",
  "fromToken": "0x0000000000000000000000000000000000000000",
  "toToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "fromAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "fromAmount": "10000000000000000",
  "slippage": "0.03"
}
Response (key fields):
{
  "type": "lifi",
  "tool": "near",
  "toolDetails": {
    "key": "near",
    "name": "NearIntents"
  },
  "action": {
    "fromChainId": 1,
    "toChainId": 8453,
    "fromToken": { "symbol": "ETH", "chainId": 1 },
    "toToken": { "symbol": "USDC", "chainId": 8453 }
  },
  "estimate": {
    "toAmount": "22293079",
    "toAmountMin": "21624286",
    "fromAmountUSD": "22.4976",
    "toAmountUSD": "22.2862",
    "executionDuration": 47,
    "gasCosts": [{
      "amountUSD": "0.0797",
      "token": { "symbol": "ETH" }
    }],
    "feeCosts": [
      { "name": "LIFI Fixed Fee", "amountUSD": "0.0562" },
      { "name": "NearIntents Protocol Fee", "amountUSD": "0.0022" }
    ]
  },
  "includedSteps": [
    { "type": "protocol", "tool": "feeCollection" },
    { "type": "cross", "tool": "near" }
  ],
  "transactionRequest": {
    "to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
    "data": "0x3110c7b900000000...",
    "value": "0x2386f26fc10000",
    "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "chainId": 1,
    "gasPrice": "0xa7a9b10",
    "gasLimit": "0x3fee7"
  }
}
Key fields to note:
  • executionDuration: Estimated ~47 seconds for cross-chain transfer
  • includedSteps: Shows the route (fee collection then bridge via NearIntents)

Check Wallet Balance

Prompt: “What’s the ETH balance of vitalik.eth?” Tool called: get-native-token-balance with chain: "1", address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
{
  "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "balance": "32115625288281011210",
  "chainId": "1",
  "decimals": 18,
  "tokenSymbol": "ETH"
}
Conversion: 32115625288281011210 / 10^18 = ~32.12 ETH

Code Samples

Build agents that connect to the LI.FI MCP server programmatically.

Anthropic API (MCP Connector) - TypeScript

The simplest approach. Anthropic handles the MCP connection. No MCP client library needed.
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.beta.messages.create(
  {
    model: "claude-sonnet-4-5-20250929",
    max_tokens: 1024,
    mcp_servers: [
      {
        type: "url",
        url: "https://mcp.li.quest/mcp",
        name: "lifi",
      },
    ],
    messages: [
      {
        role: "user",
        content: "What chains does LI.FI support? List the first 5.",
      },
    ],
    tools: [{ type: "mcp_toolset" }],
  },
  {
    betas: ["mcp-client-2025-11-20"],
  }
);

console.log(response.content);

Anthropic API (MCP Connector) - Python

import anthropic

client = anthropic.Anthropic()

response = client.beta.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    betas=["mcp-client-2025-11-20"],
    mcp_servers=[
        {
            "type": "url",
            "url": "https://mcp.li.quest/mcp",
            "name": "lifi",
        }
    ],
    messages=[
        {
            "role": "user",
            "content": "What chains does LI.FI support? List the first 5.",
        }
    ],
    tools=[{"type": "mcp_toolset"}],
)

print(response.content)

TypeScript (MCP SDK)

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  new URL("https://mcp.li.quest/mcp")
);

const client = new Client({
  name: "my-agent",
  version: "1.0.0",
});
await client.connect(transport);

// List all available tools
const { tools } = await client.listTools();
console.log("Available tools:", tools.map((t) => t.name));

// Call a tool
const result = await client.callTool({
  name: "get-chain-by-id",
  arguments: { id: "1" },
});
console.log("Ethereum:", result.content);

await client.close();

Python (MCP SDK)

from mcp.client.streamable_http import streamablehttp_client
import asyncio


async def main():
    async with streamablehttp_client("https://mcp.li.quest/mcp") as (
        read,
        write,
        _,
    ):
        from mcp import ClientSession

        async with ClientSession(read, write) as session:
            await session.initialize()

            # List all available tools
            tools = await session.list_tools()
            print("Available tools:", [t.name for t in tools.tools])

            # Call a tool
            result = await session.call_tool(
                "get-chain-by-id", arguments={"id": "1"}
            )
            print("Ethereum:", result.content)


asyncio.run(main())

Vercel AI SDK

import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { createMCPClient } from "ai";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const mcpClient = await createMCPClient({
  transport: new StreamableHTTPClientTransport(
    new URL("https://mcp.li.quest/mcp")
  ),
});

const tools = await mcpClient.tools();

const { text } = await generateText({
  model: anthropic("claude-sonnet-4-5-20250929"),
  tools,
  maxSteps: 5,
  prompt: "Get a quote for swapping 0.01 ETH to USDC on Ethereum",
});

console.log(text);
await mcpClient.close();