Skip to main content
Glama

get-mon-balance

Check MON token balance for a specific address on the Monad testnet using the Monad MCP server. Ideal for verifying token holdings and interacting with the Monad blockchain.

Instructions

查询 Monad 测试网地址的 MON 代币余额

Input Schema

NameRequiredDescriptionDefault
addressYes需要查询的 Monad 测试网地址

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "address": { "description": "需要查询的 Monad 测试网地址", "type": "string" } }, "required": [ "address" ], "type": "object" }

Implementation Reference

  • The asynchronous handler function that queries the MON token balance for the given address on the Monad testnet using viem's publicClient.getBalance, formats it with 18 decimals, and returns a formatted text response. Handles errors gracefully.
    async ({ address }) => { try { // 调用接口查询余额 const balance = await publicClient.getBalance({ address: address as `0x${string}`, }); // 返回格式化的查询结果 return { content: [ { type: "text", text: `地址 ${address} 的 MON 余额为:${formatUnits(balance, 18)} MON`, }, ], }; } catch (error) { // 错误处理 return { content: [ { type: "text", text: `查询地址 ${address} 的余额失败:${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
  • Zod schema defining the input parameter 'address' as a string with description in Chinese: '需要查询的 Monad 测试网地址' (The Monad testnet address to query).
    { address: z.string().describe("需要查询的 Monad 测试网地址"), },
  • src/index.ts:31-71 (registration)
    Registration of the 'get-mon-balance' tool using server.tool method, including the tool name, Chinese description '查询 Monad 测试网地址的 MON 代币余额' (Query MON token balance of Monad testnet address), input schema, and inline handler function.
    server.tool( // 功能标识符 "get-mon-balance", // 功能说明 "查询 Monad 测试网地址的 MON 代币余额", // 参数定义 { address: z.string().describe("需要查询的 Monad 测试网地址"), }, // 功能实现 async ({ address }) => { try { // 调用接口查询余额 const balance = await publicClient.getBalance({ address: address as `0x${string}`, }); // 返回格式化的查询结果 return { content: [ { type: "text", text: `地址 ${address} 的 MON 余额为:${formatUnits(balance, 18)} MON`, }, ], }; } catch (error) { // 错误处理 return { content: [ { type: "text", text: `查询地址 ${address} 的余额失败:${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );

Other Tools

Related Tools

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/bble/monad-mcp'

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