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
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | What to fetch | |
| chain | No | Blockchain (required for balance/quote) | |
| fromToken | No | Source token symbol (for quote) | |
| toToken | No | Destination token symbol (for quote) | |
| amount | No | Amount to swap (for quote) |
Implementation Reference
- src/tools/quote.ts:34-87 (handler)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), }], }; }, - src/tools/quote.ts:25-32 (schema)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)"), }, - src/tools/quote.ts:20-88 (registration)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), }], }; }, );