Skip to main content
Glama
tywenk

Model Context Protocol Server for Solana Client

by tywenk

get_program_accounts

Query all accounts associated with a specific program Pubkey on the Solana blockchain using this tool. Retrieve account details to manage and analyze program interactions effectively.

Instructions

Returns all accounts owned by the provided program Pubkey.

Args: program_id (str): Pubkey of program to query

Returns: str: Program accounts in the format "Program accounts: {accounts}"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
program_idYes

Implementation Reference

  • The handler function for the 'get_program_accounts' tool. It is registered via the @mcp.tool() decorator, includes input schema via type hints and docstring, and implements the logic by querying the Solana RPC client for accounts owned by the given program ID, formatting the result as a string.
    @mcp.tool()
    async def get_program_accounts(program_id: str) -> str:
        """Returns all accounts owned by the provided program Pubkey.
    
        Args:
            program_id (str): Pubkey of program to query
    
        Returns:
            str: Program accounts in the format "Program accounts: {accounts}"
        """
        async with AsyncClient(rpc_url) as client:
            accounts = await client.get_program_accounts(Pubkey.from_string(program_id))
            return f"Program accounts: {accounts}"
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. It states the return format as a string, which adds some behavioral context, but fails to disclose critical traits like whether this is a read-only operation, potential rate limits, authentication needs, or pagination behavior for large result sets.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args/Returns sections are structured but slightly verbose; the return format explanation could be more concise without losing clarity.

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

Completeness3/5

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

Given no annotations, no output schema, and low schema coverage, the description is minimally adequate. It covers the basic purpose and parameter meaning but lacks details on behavioral traits, error handling, or output structure beyond a string format, leaving gaps for effective tool use.

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

Parameters4/5

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

With 0% schema description coverage and only 1 parameter, the description compensates well by explaining that 'program_id' is a 'Pubkey of program to query'. This adds meaningful semantics beyond the schema's generic 'Program Id' title, though it could specify the expected format (e.g., base58 string).

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 ('Returns') and resource ('all accounts owned by the provided program Pubkey'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_account_info' or 'get_multiple_accounts' that also retrieve account information, which prevents a perfect score.

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. It doesn't mention sibling tools like 'get_account_info' (for single accounts) or 'get_multiple_accounts' (for specific accounts), leaving the agent without context for tool selection.

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

Related 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/tywenk/mcp-sol'

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