get_balance
Query the Solana blockchain to retrieve the balance of a specific account using its Pubkey. Provides the balance in a clear response format for easy integration and verification.
Instructions
Returns the balance of the account of provided Pubkey.
Args: address (str): Pubkey of account to query
Returns: str: Account balance response in the format "Balance of {address}: {balance}"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"address": "<address>"
},
"name": "get_balance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes |
Implementation Reference
- src/server.py:15-27 (handler)The handler function for the 'get_balance' tool, decorated with @mcp.tool() which registers it in the MCP server. It queries the Solana RPC for the balance of the given address pubkey.
@mcp.tool() async def get_balance(address: str) -> str: """Returns the balance of the account of provided Pubkey. Args: address (str): Pubkey of account to query Returns: str: Account balance response in the format "Balance of {address}: {balance}" """ async with AsyncClient(rpc_url) as client: balance = await client.get_balance(Pubkey.from_string(address)) return f"Balance of {address}: {balance}"