swap_quote
Retrieve accurate swap quotes for crypto trades by specifying input/output tokens, amounts, and slippage. Designed for seamless integration with Armor Crypto MCP's blockchain operations and trading strategies.
Instructions
Retrieve a swap quote. Be sure to add slippage!
Expects a SwapQuoteRequestContainer, returns a list of SwapQuoteResponse.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| swap_quote_requests | Yes |
Implementation Reference
- armor_crypto_mcp/armor_mcp.py:144-157 (handler)MCP tool handler for 'swap_quote'. Decorated with @mcp.tool() for registration. Handles authentication check and delegates to armor_client.swap_quote, returning List[SwapQuoteResponse] or error.@mcp.tool() async def swap_quote(swap_quote_requests: SwapQuoteRequestContainer) -> List[SwapQuoteResponse]: """ Retrieve a swap quote. Be sure to add slippage! Expects a SwapQuoteRequestContainer, returns a list of SwapQuoteResponse. """ if not armor_client: return [{"error": "Not logged in"}] try: result: List[SwapQuoteResponse] = await armor_client.swap_quote(swap_quote_requests) return result except Exception as e: return [{"error": str(e)}]
- Input schema model SwapQuoteRequest used within SwapQuoteRequestContainer for the swap_quote tool.class SwapQuoteRequest(BaseModel): from_wallet: str = Field(description="The name of the wallet that input_token is in.") input_token: str = Field(description="public mint address of input token. To get the address from a token symbol use `get_token_details`") output_token: str = Field(description="public mint address of output token. To get the address from a token symbol use `get_token_details`") input_amount: float = Field(description="input amount to swap") slippage: float = Field("slippage percentage. To estimate slippage based on liquidity see `get_token_details` for the input_token_symbol. 1.0 for high liquidity and near 20.0 for lower liquidity.")
- Output schema model SwapQuoteResponse returned as List by the swap_quote tool.class SwapQuoteResponse(BaseModel): id: str = Field(description="unique id of the generated swap quote") wallet_address: str = Field(description="public address of the wallet") input_token_symbol: str = Field(description="symbol of the input token") input_token_address: str = Field(description="public address of the input token") output_token_symbol: str = Field(description="symbol of the output token") output_token_address: str = Field(description="public address of the output token") input_amount: float = Field(description="input amount in input token") output_amount: float = Field(description="output amount in output token") slippage: float = Field(description="slippage percentage.")
- Container schema for input: holds List[SwapQuoteRequest], direct parameter type of swap_quote handler.class SwapQuoteRequestContainer(BaseModel): swap_quote_requests: List[SwapQuoteRequest]
- Helper method in ArmorWalletAPIClient that performs the actual API call to get swap quotes, called by the MCP handler.async def swap_quote(self, data: SwapQuoteRequestContainer) -> List[SwapQuoteResponse]: """Obtain a swap quote.""" # payload = [v.model_dump() for v in data.swap_quote_requests] payload = data.model_dump(exclude_none=True)['swap_quote_requests'] return await self._api_call("POST", "transactions/quote/", payload)