helius_get_multiple_accounts
Retrieve detailed information about multiple Solana accounts, including balances and token data, using a single API request. Simplify blockchain data management on the Solana network with streamlined account insights.
Instructions
Get information about multiple Solana accounts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No | ||
| publicKeys | Yes |
Input Schema (JSON Schema)
{
"properties": {
"commitment": {
"enum": [
"confirmed",
"finalized",
"processed"
],
"type": "string"
},
"publicKeys": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"publicKeys"
],
"type": "object"
}
Implementation Reference
- src/handlers/helius.ts:236-252 (handler)The handler function that validates the input publicKeys array, converts them to PublicKey objects, fetches multiple account information using the Helius connection's getMultipleAccountsInfo method, and returns a formatted success response or error.export const getMultipleAccountsHandler = async (input: GetMultipleAccountsInput): Promise<ToolResultSchema> => { try { const publicKeys = []; for (const pk of input.publicKeys) { const result = validatePublicKey(pk); if (!(result instanceof PublicKey)) { return result; // Return the error response if any public key is invalid } publicKeys.push(result); } const accounts = await (helius as any as Helius).connection.getMultipleAccountsInfo(publicKeys, input.commitment); return createSuccessResponse(`Multiple accounts: ${JSON.stringify(accounts, null, 2)}`); } catch (error) { return createErrorResponse(`Error getting multiple accounts: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools.ts:189-202 (schema)The input schema definition for the tool, specifying an array of publicKeys (required) and optional commitment level.{ name: "helius_get_multiple_accounts", description: "Get information about multiple Solana accounts", inputSchema: { type: "object", properties: { publicKeys: { type: "array", items: { type: "string" } }, commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: ["publicKeys"] }
- src/tools.ts:564-564 (registration)Registration of the handler function in the central handlers dictionary mapping tool names to their implementations."helius_get_multiple_accounts": getMultipleAccountsHandler,