Skip to main content
Glama

menese_quote

Get swap quotes, check balances, or view derived addresses across 19 blockchains through the Menese Protocol DeFi gateway.

Instructions

Multi-action tool: get swap quotes, show all derived addresses, or check a single chain balance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesWhat to fetch
chainNoBlockchain (required for balance/quote)
fromTokenNoSource token symbol (for quote)
toTokenNoDestination token symbol (for quote)
amountNoAmount to swap (for quote)

Implementation Reference

  • The handler implementation for the menese_quote tool.
    async ({ action, chain, fromToken, toToken, amount }) => {
      const identity = store.get();
      if (!identity) {
        return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
      }
    
      if (action === "addresses") {
        const addresses = await cacheFetch(
          CacheKeys.addresses(identity.principal),
          TTL.ADDRESSES,
          () => getAllAddresses(config, identity.principal, resolveActorIdentity(store)),
        );
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(addresses, bigIntReplacer, 2),
          }],
        };
      }
    
      if (action === "balance") {
        if (!chain) {
          return { content: [{ type: "text" as const, text: "chain is required for balance action." }], isError: true };
        }
        const result = await cacheFetch(
          CacheKeys.balance(identity.principal, chain),
          TTL.BALANCE,
          () => getChainBalance(config, identity.principal, chain),
        );
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(result, bigIntReplacer, 2),
          }],
        };
      }
    
      // action === "quote"
      if (!chain || !fromToken || !toToken || !amount) {
        return {
          content: [{ type: "text" as const, text: "chain, fromToken, toToken, and amount are required for quote." }],
          isError: true,
        };
      }
      const quoteResult = await getSwapQuote(config, resolveActorIdentity(store), {
        chain, fromToken, toToken, amount,
      });
      return {
        content: [{
          type: "text" as const,
          text: JSON.stringify(quoteResult, bigIntReplacer, 2),
        }],
      };
    },
  • Input schema definition for the menese_quote tool.
    inputSchema: {
      action: z.enum(["balance", "addresses", "quote"]).describe("What to fetch"),
      chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).optional()
        .describe("Blockchain (required for balance/quote)"),
      fromToken: z.string().optional().describe("Source token symbol (for quote)"),
      toToken: z.string().optional().describe("Destination token symbol (for quote)"),
      amount: z.string().optional().describe("Amount to swap (for quote)"),
    },
  • The tool registration for menese_quote.
    server.registerTool(
      "menese_quote",
      {
        description:
          "Multi-action tool: get swap quotes, show all derived addresses, or check a single chain balance.",
        inputSchema: {
          action: z.enum(["balance", "addresses", "quote"]).describe("What to fetch"),
          chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).optional()
            .describe("Blockchain (required for balance/quote)"),
          fromToken: z.string().optional().describe("Source token symbol (for quote)"),
          toToken: z.string().optional().describe("Destination token symbol (for quote)"),
          amount: z.string().optional().describe("Amount to swap (for quote)"),
        },
      },
      async ({ action, chain, fromToken, toToken, amount }) => {
        const identity = store.get();
        if (!identity) {
          return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
        }
    
        if (action === "addresses") {
          const addresses = await cacheFetch(
            CacheKeys.addresses(identity.principal),
            TTL.ADDRESSES,
            () => getAllAddresses(config, identity.principal, resolveActorIdentity(store)),
          );
          return {
            content: [{
              type: "text" as const,
              text: JSON.stringify(addresses, bigIntReplacer, 2),
            }],
          };
        }
    
        if (action === "balance") {
          if (!chain) {
            return { content: [{ type: "text" as const, text: "chain is required for balance action." }], isError: true };
          }
          const result = await cacheFetch(
            CacheKeys.balance(identity.principal, chain),
            TTL.BALANCE,
            () => getChainBalance(config, identity.principal, chain),
          );
          return {
            content: [{
              type: "text" as const,
              text: JSON.stringify(result, bigIntReplacer, 2),
            }],
          };
        }
    
        // action === "quote"
        if (!chain || !fromToken || !toToken || !amount) {
          return {
            content: [{ type: "text" as const, text: "chain, fromToken, toToken, and amount are required for quote." }],
            isError: true,
          };
        }
        const quoteResult = await getSwapQuote(config, resolveActorIdentity(store), {
          chain, fromToken, toToken, amount,
        });
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(quoteResult, bigIntReplacer, 2),
          }],
        };
      },
    );

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/Aboodtt404/mcp-menesesdk'

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