Skip to main content
Glama
tywenk

Model Context Protocol Server for Solana Client

by tywenk

get_token_accounts_by_owner

Retrieve all SPL Token accounts associated with a specific owner and mint address using the Solana blockchain. This method simplifies token account management and querying.

Instructions

Returns all SPL Token accounts by token owner.

Args: owner (str): Public key of token owner mint (str): Token mint address

Returns: str: Token accounts information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mintYes
ownerYes

Implementation Reference

  • The @mcp.tool() decorator registers this async handler function, which executes the core logic: connects to Solana RPC, fetches token accounts by owner and mint using solana-py library, and returns a formatted string result.
    @mcp.tool()
    async def get_token_accounts_by_owner(owner: str, mint: str) -> str:
        """Returns all SPL Token accounts by token owner.
    
        Args:
            owner (str): Public key of token owner
            mint (str): Token mint address
    
        Returns:
            str: Token accounts information
        """
        async with AsyncClient(rpc_url) as client:
            accounts = await client.get_token_accounts_by_owner(
                Pubkey.from_string(owner), TokenAccountOpts(Pubkey.from_string(mint))
            )
            return f"Token accounts by owner: {accounts}"
  • src/server.py:589-589 (registration)
    The @mcp.tool() decorator registers the get_token_accounts_by_owner tool with the MCP server.
    @mcp.tool()
  • Docstring provides input parameter descriptions and return type for schema validation in MCP tools.
    """Returns all SPL Token accounts by token owner.
    
    Args:
        owner (str): Public key of token owner
        mint (str): Token mint address
    
    Returns:
        str: Token accounts information
    """
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 tool returns data ('Returns all SPL Token accounts'), implying a read-only operation, but doesn't disclose behavioral traits like rate limits, authentication needs, error conditions, or what 'all' means (e.g., pagination, limits). For a tool with zero annotation coverage, this is a significant gap.

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: the first sentence states the purpose, followed by structured Args and Returns sections. There's minimal waste, though the Returns section could be more informative (e.g., specifying JSON format instead of just 'str').

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 (2 required parameters, no annotations, no output schema), the description is incomplete. It lacks details on return format (beyond 'str'), error handling, performance considerations, and how it differs from sibling tools. For a blockchain-related tool with specific parameter formats, this leaves too much ambiguity.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics: 'owner (str): Public key of token owner' and 'mint (str): Token mint address', clarifying what each parameter represents. However, it doesn't provide format details (e.g., base58 encoding), validation rules, or examples, leaving gaps for a tool with 2 required parameters.

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 tool's purpose: 'Returns all SPL Token accounts by token owner.' It specifies the verb ('Returns'), resource ('SPL Token accounts'), and scope ('by token owner'). However, it doesn't explicitly differentiate from sibling tools like 'get_token_accounts_by_delegate' or 'get_token_account_balance', which would require a 5.

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_token_accounts_by_delegate' (which uses a delegate instead of owner) or 'get_token_account_balance' (which returns balance info rather than accounts). There's no context about prerequisites or exclusions.

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