Skip to main content
Glama

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
NameRequiredDescriptionDefault
swap_quote_requestsYes

Implementation Reference

  • 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)

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/armorwallet/armor-crypto-mcp'

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