trust_swap
Get a trust-verified swap quote with calldata. Checks token safety before returning a Uniswap quote for secure token exchanges.
Instructions
Get a trust-verified swap quote with calldata. Checks both tokens for safety before returning a Uniswap quote. Use this instead of raw DEX quotes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| swapper | Yes | Wallet address executing the swap (0x...) | |
| tokenIn | Yes | Token being sold (0x...) | |
| tokenOut | Yes | Token being bought (0x...) | |
| amount | Yes | Amount of tokenIn in wei | |
| slippage | No | Slippage tolerance (e.g. 0.5 for 0.5%) |
Implementation Reference
- packages/mcp-server/src/index.ts:183-199 (handler)MCP handler for trust_swap tool, which calls the Maiat SDK trustSwap method.
async ({ swapper, tokenIn, tokenOut, amount, slippage }) => { try { const data = await sdk.trustSwap({ swapper, tokenIn, tokenOut, amount, slippage, }); return { content: [ { type: "text" as const, text: JSON.stringify(data, null, 2), }, ], }; - packages/mcp-server/src/index.ts:171-182 (registration)Tool definition and schema registration for trust_swap in the MCP server.
"trust_swap", "Get a trust-verified swap quote with calldata. Checks both tokens for safety before returning a Uniswap quote. Use this instead of raw DEX quotes.", { swapper: z.string().describe("Wallet address executing the swap (0x...)"), tokenIn: z.string().describe("Token being sold (0x...)"), tokenOut: z.string().describe("Token being bought (0x...)"), amount: z.string().describe("Amount of tokenIn in wei"), slippage: z .number() .optional() .describe("Slippage tolerance (e.g. 0.5 for 0.5%)"), }, - packages/sdk/src/index.ts:199-205 (helper)SDK implementation of trustSwap, which performs the actual API request.
/** Get a trust-verified swap quote with calldata */ async trustSwap(params: TrustSwapParams): Promise<TrustSwapResult> { return this.request<TrustSwapResult>("/api/v1/swap/quote", { method: "POST", body: JSON.stringify(params), }); }