get_sui_coins
Retrieve Sui blockchain coin holdings for any address, with options to filter by coin type, paginate results, and select network.
Instructions
Get coins owned by an address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Sui address | |
| coinType | No | Optional: Coin type to filter (e.g., "0x2::sui::SUI") | |
| cursor | No | Optional: Pagination cursor | |
| limit | No | Optional: Number of results to return | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/sui-handlers.ts:337-355 (handler)Handler function for the 'get_sui_coins' tool. Extracts parameters from args and calls suiService.getCoins to fetch coins owned by the address.case 'get_sui_coins': { const address = args?.address as string; const coinType = args?.coinType as string | undefined; const cursor = args?.cursor as string | undefined; const limit = args?.limit as number | undefined; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await suiService.getCoins(address, coinType, cursor, limit, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- src/handlers/sui-handlers.ts:53-83 (registration)Tool registration for 'get_sui_coins', including name, description, and input schema definition used by the MCP server.{ name: 'get_sui_coins', description: 'Get coins owned by an address', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Sui address', }, coinType: { type: 'string', description: 'Optional: Coin type to filter (e.g., "0x2::sui::SUI")', }, cursor: { type: 'string', description: 'Optional: Pagination cursor', }, limit: { type: 'number', description: 'Optional: Number of results to return', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['address'], }, },
- src/services/sui-service.ts:82-104 (helper)Helper method in SuiService that constructs RPC parameters and calls the 'suix_getCoins' RPC method via blockchainService to retrieve coins.async getCoins( address: string, coinType?: string, cursor?: string, limit?: number, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain('sui', network); if (!service) { return { success: false, error: `Sui service not found for ${network}`, }; } const params: any[] = [address]; if (coinType) params.push(coinType); if (cursor) params.push(cursor); if (limit) params.push(limit); return this.blockchainService.callRPCMethod(service.id, 'suix_getCoins', params); }