Skip to main content
Glama

helius_get_program_accounts

Retrieve all accounts owned by a specific Solana program using its program ID.

Instructions

Get all accounts owned by a program

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
programIdYes
commitmentNo

Implementation Reference

  • The handler function for 'helius_get_program_accounts'. It validates the programId input, then calls connection.getProgramAccounts() and returns the result.
    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)}`);
      }
    }
  • Type definition for GetProgramAccountsInput with programId (string) and optional commitment enum.
    export type GetProgramAccountsInput = {
      programId: string;
      commitment?: "confirmed" | "finalized" | "processed";
    }
  • src/tools.ts:150-160 (registration)
    Tool registration with name 'helius_get_program_accounts', description, and inputSchema (programId required, optional commitment).
    {
      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)
    Handler mapping in the handlers dictionary, mapping 'helius_get_program_accounts' to getProgramAccountsHandler.
    "helius_get_program_accounts": getProgramAccountsHandler,
  • Utility function createPublicKey (though the handler uses validatePublicKey) for validating public keys.
    export const createPublicKey = (publicKeyString: string): { publicKey?: PublicKey; error?: string } => {
      try {
        const publicKey = new PublicKey(publicKeyString);
        return { publicKey };
      } catch (error) {
        return { error: `Invalid public key: ${publicKeyString}` };
      }
    };
Behavior1/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. However, it only states the action without indicating whether it is read-only, what permissions are needed, or what the response contains. This is critically insufficient.

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

Conciseness3/5

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

The description is very concise at one sentence, which is efficient but comes at the cost of essential details. It front-loads the action but fails to add value beyond the name.

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

Completeness1/5

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

Given no output schema and only 2 parameters, the description should cover return values, pagination, or constraints. It provides none, leaving the agent with insufficient context for correct invocation.

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

Parameters1/5

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

Schema description coverage is 0%, and the description does not explain any parameters. 'programId' and 'commitment' are left entirely to the agent to infer. The enum values for commitment are listed but not described in context.

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 uses a specific verb 'Get' and resource 'accounts owned by a program', clearly distinguishing it from sibling tools like helius_get_account_info (single account) and helius_get_multiple_accounts (multiple accounts by address). It conveys the core purpose without ambiguity.

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, nor does it mention any prerequisites or contextual cues. The agent receives no help in deciding between this and similar account-fetching tools.

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