Skip to main content
Glama
recallnet

Trading Simulator MCP Server

by recallnet

execute_trade

Execute token trades in a simulated environment by specifying source and destination tokens, amount, and reason, with optional chain and slippage settings.

Instructions

Execute a trade between tokens

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromTokenYesSource token address
toTokenYesDestination token address
amountYesAmount of fromToken to trade
reasonYesReason for executing this trade
slippageToleranceNoOptional slippage tolerance percentage (e.g., '0.5' for 0.5%)
fromChainNoOptional blockchain type for source token
toChainNoOptional blockchain type for destination token
fromSpecificChainNoOptional specific chain for source token
toSpecificChainNoOptional specific chain for destination token

Implementation Reference

  • MCP CallToolRequest handler for execute_trade: validates input arguments, constructs TradeParams, calls tradingClient.executeTrade, and returns the response.
    case "execute_trade": {
      if (!args || typeof args !== "object" || 
          !("fromToken" in args) || !("toToken" in args) || 
          !("amount" in args) || !("reason" in args)) {
        throw new Error("Invalid arguments for execute_trade");
      }
      
      const tradeExecParams: TradeParams = {
        fromToken: args.fromToken as string,
        toToken: args.toToken as string,
        amount: args.amount as string,
        reason: args.reason as string
      };
      
      if ("slippageTolerance" in args) tradeExecParams.slippageTolerance = args.slippageTolerance as string;
      if ("fromChain" in args) tradeExecParams.fromChain = args.fromChain as BlockchainType;
      if ("toChain" in args) tradeExecParams.toChain = args.toChain as BlockchainType;
      if ("fromSpecificChain" in args) tradeExecParams.fromSpecificChain = args.fromSpecificChain as SpecificChain;
      if ("toSpecificChain" in args) tradeExecParams.toSpecificChain = args.toSpecificChain as SpecificChain;
      
      const response = await tradingClient.executeTrade(tradeExecParams);
      return {
        content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
        isError: false
      };
    }
  • TypeScript interface defining the TradeParams used for execute_trade input validation and typing.
    export interface TradeParams {
      fromToken: string;
      toToken: string;
      amount: string;
      reason: string;
      slippageTolerance?: string;
      fromChain?: BlockchainType;
      toChain?: BlockchainType;
      fromSpecificChain?: SpecificChain;
      toSpecificChain?: SpecificChain;
    }
  • src/index.ts:253-304 (registration)
    MCP Tool registration definition including name, description, and JSON schema for input validation.
    {
      name: "execute_trade",
      description: "Execute a trade between tokens",
      inputSchema: {
        type: "object",
        properties: {
          fromToken: {
            type: "string", 
            description: "Source token address"
          },
          toToken: {
            type: "string", 
            description: "Destination token address"
          },
          amount: {
            type: "string", 
            description: "Amount of fromToken to trade"
          },
          reason: {
            type: "string",
            description: "Reason for executing this trade"
          },
          slippageTolerance: {
            type: "string",
            description: "Optional slippage tolerance percentage (e.g., '0.5' for 0.5%)"
          },
          fromChain: {
            type: "string",
            enum: ["svm", "evm"],
            description: "Optional blockchain type for source token"
          },
          toChain: {
            type: "string",
            enum: ["svm", "evm"],
            description: "Optional blockchain type for destination token"
          },
          fromSpecificChain: {
            type: "string",
            enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"],
            description: "Optional specific chain for source token"
          },
          toSpecificChain: {
            type: "string",
            enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"],
            description: "Optional specific chain for destination token"
          }
        },
        required: ["fromToken", "toToken", "amount", "reason"],
        additionalProperties: false,
        $schema: "http://json-schema.org/draft-07/schema#"
      }
    },
  • Helper method in TradingSimulatorClient that performs the actual API POST request to execute the trade.
    async executeTrade(params: TradeParams): Promise<TradeResponse | ErrorResponse> {
      if (this.debug) {
        logger.info('[ApiClient] executeTrade called with params:', JSON.stringify(params, null, 2));
      }
    
      return this.request<TradeResponse>(
        'POST',
        '/api/trade/execute',
        params,
        'execute trade'
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but provides minimal information. 'Execute a trade' implies a write/mutation operation with financial consequences, but the description doesn't disclose critical behaviors: whether this is a live market order, if it requires wallet authentication, what happens on failure (partial fills, reverts), rate limits, or confirmation requirements. For a high-stakes financial tool, this is dangerously inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise at 5 words with zero waste. It's front-loaded with the core action and doesn't contain any redundant information. While brevity can be problematic for complex tools, this description at least doesn't waste space on tautologies or irrelevant details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex financial execution tool with 9 parameters, no annotations, and no output schema, the description is severely incomplete. It doesn't explain what type of trading system this interfaces with, what happens after execution (does it return a transaction hash? confirmation?), error conditions, or security implications. The agent lacks critical context to use this tool safely and effectively despite the detailed parameter schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 9 parameters thoroughly with descriptions and enums. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain relationships between parameters (e.g., that fromChain should match fromSpecificChain), doesn't clarify the 'reason' parameter's purpose in the trading context, or provide examples of valid token addresses. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('execute a trade') and resources ('between tokens'), making the purpose immediately understandable. However, it doesn't differentiate this execution tool from the sibling 'get_trades' tool that presumably retrieves trade history, nor does it specify what kind of trading system this is (e.g., DEX, CEX, automated).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (like needing sufficient balance), no comparison to the 'get_quote' sibling tool that might be used for price estimation before execution, and no indication of whether this is for spot trading, limit orders, or other types. The agent must infer usage context from parameter names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/recallnet/trading-simulator-mcp'

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