Skip to main content
Glama

helius_get_program_accounts

Retrieve all accounts owned by a specific program on the Solana blockchain to analyze program data and interactions.

Instructions

Get all accounts owned by a program

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
programIdYes
commitmentNo

Implementation Reference

  • The handler function that executes the tool logic: validates the programId public key, fetches program accounts using Helius RPC connection.getProgramAccounts, and returns a success or error response.
    export const getProgramAccountsHandler = async (input: GetProgramAccountsInput): Promise<ToolResultSchema> => {
      const programIdResult = validatePublicKey(input.programId);
      if (!(programIdResult instanceof PublicKey)) {
        return programIdResult;
      }
      
      try {
        const programAccounts = await (helius as any as Helius).connection.getProgramAccounts(programIdResult, input.commitment);
        return createSuccessResponse(`Program accounts: ${JSON.stringify(programAccounts, null, 2)}`);
      } catch (error) {
        return createErrorResponse(`Error getting program accounts: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The tool schema definition in the tools array, including name, description, and inputSchema for programId (required) and optional commitment level.
    {
      name: "helius_get_program_accounts",
      description: "Get all accounts owned by a program",
      inputSchema: {
        type: "object",
        properties: {
          programId: { type: "string" },
          commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] }
        },
        required: ["programId"]
      }
    },
  • src/tools.ts:561-561 (registration)
    The registration of the tool name to its handler function in the handlers dictionary.
    "helius_get_program_accounts": getProgramAccountsHandler,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Get all accounts', implying a read operation, but does not describe any behavioral traits such as pagination, rate limits, performance considerations, or what 'all' entails (e.g., if it returns a complete list or requires iteration). This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that is front-loaded with the core purpose. There is no wasted verbiage or redundancy, making it easy to parse quickly. It earns its place by conveying the essential action without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of retrieving program accounts (likely involving blockchain data), no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on behavior, parameters, return values, and usage context, which are critical for an agent to operate this tool correctly in a real-world scenario.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description does not add any meaning beyond the parameter names; it does not explain what 'programId' represents, what format it expects, or the significance of the 'commitment' enum values. This fails to compensate for the lack of schema documentation, leaving parameters poorly understood.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'all accounts owned by a program', which is specific and unambiguous. However, it does not explicitly differentiate from sibling tools like 'helius_get_account_info' or 'helius_get_multiple_accounts', which might also retrieve account information in different contexts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. For example, it does not specify if this is for bulk retrieval, program-specific queries, or how it differs from tools like 'helius_get_account_info' or 'helius_get_assets_by_owner'. There is no mention of prerequisites, exclusions, or recommended contexts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/dcSpark/mcp-server-helius'

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