Skip to main content
Glama

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
NameRequiredDescriptionDefault
swapperYesWallet address executing the swap (0x...)
tokenInYesToken being sold (0x...)
tokenOutYesToken being bought (0x...)
amountYesAmount of tokenIn in wei
slippageNoSlippage tolerance (e.g. 0.5 for 0.5%)

Implementation Reference

  • 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),
            },
          ],
        };
  • 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%)"),
    },
  • 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),
      });
    }

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/JhiNResH/maiat-protocol'

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