Skip to main content
Glama

swap_transaction

Execute cryptocurrency swap transactions by processing swap requests and returning transaction responses, enabling trading operations within crypto ecosystems.

Instructions

Execute a swap transaction.

Expects a SwapTransactionRequestContainer, returns a list of SwapTransactionResponse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
swap_transaction_requestsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'swap_transaction'. Thin wrapper that checks authentication and delegates to ArmorWalletAPIClient.swap_transaction.
    @mcp.tool()
    async def swap_transaction(swap_transaction_requests: SwapTransactionRequestContainer) -> List[SwapTransactionResponse]:
        """
        Execute a swap transaction.
        
        Expects a SwapTransactionRequestContainer, returns a list of SwapTransactionResponse.
        """
        if not armor_client:
            return [{"error": "Not logged in"}]
        try:
            result: List[SwapTransactionResponse] = await armor_client.swap_transaction(swap_transaction_requests)
            return result
        except Exception as e:
            return [{"error": str(e)}]
  • Pydantic model for a single SwapTransactionRequest, containing the transaction_id from a prior swap quote.
    class SwapTransactionRequest(BaseModel):
        transaction_id: str = Field(description="unique id of the generated swap quote")
  • Container model for the input to swap_transaction tool, holding a list of SwapTransactionRequest.
    class SwapTransactionRequestContainer(BaseModel):
        swap_transaction_requests: List[SwapTransactionRequest]
  • Pydantic model for SwapTransactionResponse, defining the output structure of the tool.
    class SwapTransactionResponse(BaseModel):
        id: str = Field(description="unique id of the swap transaction")
        transaction_error: Optional[str] = Field(description="error message if the transaction fails")
        transaction_url: str = Field(description="public url of the transaction")
        input_amount: float = Field(description="input amount in input token")
        output_amount: float = Field(description="output amount in output token")
        status: str = Field(description="status of the transaction")
  • Core implementation in ArmorWalletAPIClient that sends POST request to '/transactions/swap/' API endpoint with list of transaction_ids to execute the swaps.
    async def swap_transaction(self, data: SwapTransactionRequestContainer) -> List[SwapTransactionResponse]:
        """Execute the swap transactions."""
        # payload = [v.model_dump() for v in data.swap_transaction_requests]
        payload = data.model_dump(exclude_none=True)['swap_transaction_requests']
        return await self._api_call("POST", "transactions/swap/", payload)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'Execute[s] a swap transaction', implying a write/mutation operation, but doesn't disclose critical details like authentication needs, rate limits, side effects, or error handling. This is a significant gap for a transactional tool.

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

Conciseness4/5

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

The description is very concise with two sentences that directly state the action and input/output. There's no fluff, and it's front-loaded with the core purpose. However, it could be more structured by including usage hints, but within its brevity, it's efficient.

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

Completeness3/5

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

Given the tool's complexity (a swap transaction likely involves financial operations), no annotations, and 0% schema coverage, the description is incomplete. It mentions the output ('returns a list of SwapTransactionResponse'), which aligns with the presence of an output schema, but fails to cover behavioral aspects or parameter details adequately.

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 0%, so the description must compensate. It mentions 'Expects a SwapTransactionRequestContainer', adding some context beyond the schema's generic parameter name. However, it doesn't explain what this container includes or how to structure it, leaving key semantics undocumented. Baseline 3 is appropriate as it adds minimal value.

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

Purpose3/5

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

The description states the tool 'Execute[s] a swap transaction', which provides a clear verb ('Execute') and resource ('swap transaction'). However, it doesn't differentiate from sibling tools like 'swap_quote' or 'transfer_tokens', leaving the specific scope ambiguous. The purpose is understandable but lacks sibling distinction.

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 such as 'swap_quote' (which likely provides a quote without execution) or 'transfer_tokens' (which might handle simple transfers). There's no mention of prerequisites, context, or exclusions, leaving usage unclear.

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

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