get-soon-testnet-account-tokens
Retrieve token balances for a specified address on the Soon testnet using a single API call with the SVM-MCP server.
Instructions
Get the tokens of a address on the Soon testnet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The SOON address to get the tokens of |
Implementation Reference
- src/index.ts:101-131 (handler)The core handler function that implements the tool logic. It retrieves the token accounts owned by the given Solana address on the Soon testnet using getTokenAccountsByOwner, serializes to JSON, or returns an error message.async ({ address }) => { try { const tokens = await connectionTestnet.getTokenAccountsByOwner( new PublicKey(address), { programId: new PublicKey( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" ), } ); return { content: [ { type: "text", text: JSON.stringify(tokens), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting tokens: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/index.ts:98-100 (schema)The input schema definition using Zod, specifying the required 'address' parameter as a string.{ address: z.string().describe("The SOON address to get the tokens of"), },
- src/index.ts:95-132 (registration)The registration of the MCP tool via server.tool(), including name, description, input schema, and inline handler function.server.tool( "get-soon-testnet-account-tokens", "Get the tokens of a address on the Soon testnet", { address: z.string().describe("The SOON address to get the tokens of"), }, async ({ address }) => { try { const tokens = await connectionTestnet.getTokenAccountsByOwner( new PublicKey(address), { programId: new PublicKey( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" ), } ); return { content: [ { type: "text", text: JSON.stringify(tokens), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting tokens: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
- src/index.ts:15-15 (registration)Declaration of the tool in the server's capabilities array."get-soon-testnet-account-tokens",