Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_solana_program_accounts

Retrieve accounts owned by a Solana program using program ID and optional filters to query blockchain data through Grove's MCP Server for Pocket Network.

Instructions

Get accounts owned by a Solana program with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filtersNoOptional RPC filters (memcmp, dataSize, etc.)
networkNoNetwork type (defaults to mainnet)
programIdYesProgram ID (public key)

Implementation Reference

  • Tool registration object defining name, description, and input schema for 'get_solana_program_accounts' in the registerSolanaHandlers function.
    { name: 'get_solana_program_accounts', description: 'Get accounts owned by a Solana program with optional filters', inputSchema: { type: 'object', properties: { programId: { type: 'string', description: 'Program ID (public key)', }, filters: { type: 'array', description: 'Optional RPC filters (memcmp, dataSize, etc.)', items: { type: 'object' }, }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['programId'], }, },
  • Handler implementation for 'get_solana_program_accounts' tool, which delegates to SolanaService.getProgramAccounts and formats the response.
    case 'get_solana_program_accounts': { const programId = args?.programId as string; const filters = args?.filters as any[] | undefined; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await solanaService.getProgramAccounts(programId, filters, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Helper method in SolanaService that constructs RPC parameters and calls the underlying blockchain service for getProgramAccounts RPC method.
    async getProgramAccounts( programId: string, filters?: any[], network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain('solana', network); if (!service) { return { success: false, error: `Solana service not found for ${network}`, }; } const params: any = [ programId, { encoding: 'jsonParsed', }, ]; if (filters && filters.length > 0) { params[1].filters = filters; } return this.blockchainService.callRPCMethod(service.id, 'getProgramAccounts', params); }

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/buildwithgrove/mcp-pocket'

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