get_multiple_accounts
Retrieve account information for multiple Solana public keys in a single request. Specify encoding to decode account data efficiently.
Instructions
Returns the account information for a list of public keys.
Args: pubkeys (list[str]): List of account public keys encoding (str): Encoding for the account data
Returns: str: Multiple accounts information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoding | No | base64 | |
| pubkeys | Yes |
Implementation Reference
- src/server.py:526-540 (handler)The main handler function for the 'get_multiple_accounts' MCP tool. It is registered via the @mcp.tool() decorator. The function signature provides the input schema (pubkeys: list[str], encoding: str = 'base64'), fetches account data from Solana RPC for multiple pubkeys, and returns formatted account information.@mcp.tool() async def get_multiple_accounts(pubkeys: list[str], encoding: str = "base64") -> str: """Returns the account information for a list of public keys. Args: pubkeys (list[str]): List of account public keys encoding (str): Encoding for the account data Returns: str: Multiple accounts information """ async with AsyncClient(rpc_url) as client: pks = [Pubkey.from_string(pk) for pk in pubkeys] accounts = await client.get_multiple_accounts(pks, encoding=encoding) return f"Multiple accounts info: {accounts}"