Skip to main content
Glama

menese_balance

Check native token balances across 19 blockchains including Ethereum, Solana, and Bitcoin to monitor cryptocurrency holdings.

Instructions

Get your native token balance on a specific blockchain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesBlockchain to check

Implementation Reference

  • The handler function for menese_balance, which retrieves the native token balance for a specified chain.
    async ({ chain }) => {
      const identity = store.get();
      if (!identity) {
        return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
      }
    
      const result = await cacheFetch(
        CacheKeys.balance(identity.principal, chain),
        TTL.BALANCE,
        async () => {
          if (AUTH_CHAINS.includes(chain)) {
            return getChainBalanceAuthenticated(config, resolveActorIdentity(store), chain);
          }
          return getChainBalance(config, identity.principal, chain);
        },
      );
    
      return {
        content: [{
          type: "text" as const,
          text: JSON.stringify(result, bigIntReplacer, 2),
        }],
      };
    },
  • Input schema validation for the menese_balance tool, enforcing that the chain must be one of the supported chains.
    inputSchema: {
      chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).describe("Blockchain to check"),
    },
  • Tool registration for menese_balance within the MCP server.
    server.registerTool(
      "menese_balance",
      {
        description: "Get your native token balance on a specific blockchain.",
        inputSchema: {
          chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).describe("Blockchain to check"),
        },
      },
      async ({ chain }) => {
        const identity = store.get();
        if (!identity) {
          return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
        }
    
        const result = await cacheFetch(
          CacheKeys.balance(identity.principal, chain),
          TTL.BALANCE,
          async () => {
            if (AUTH_CHAINS.includes(chain)) {
              return getChainBalanceAuthenticated(config, resolveActorIdentity(store), chain);
            }
            return getChainBalance(config, identity.principal, chain);
          },
        );
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(result, 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