get-soon-mainnet-last-transaction
Retrieve the most recent transaction for a SOON mainnet address to monitor account activity and verify blockchain interactions.
Instructions
Get the last transaction of an address on the Soon mainnet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The SOON address to get the last transaction for |
Implementation Reference
- src/index.ts:161-204 (handler)The handler function that implements the tool logic: fetches the most recent transaction signature for the given address on Soon mainnet (using Solana Web3.js Connection), retrieves the confirmed transaction details, and returns it as a JSON string in the MCP response format. Handles no-transaction and error cases.async ({ address }) => { try { const signatures = await connectionMainnet.getSignaturesForAddress( new PublicKey(address), { limit: 1 } ); if (signatures.length === 0) { return { content: [ { type: "text", text: "No transactions found for this address", }, ], }; } const latestSignature = signatures[0].signature; const transaction = await connectionMainnet.getConfirmedTransaction( latestSignature ); return { content: [ { type: "text", text: JSON.stringify(transaction), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting transaction: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/index.ts:156-160 (schema)Zod schema defining the input parameter: 'address' as a string describing the SOON (Solana) public key.{ address: z .string() .describe("The SOON address to get the last transaction for"), },
- src/index.ts:153-205 (registration)The server.tool() call that registers the tool with MCP server, specifying name, description, input schema, and handler function.server.tool( "get-soon-mainnet-last-transaction", "Get the last transaction of an address on the Soon mainnet", { address: z .string() .describe("The SOON address to get the last transaction for"), }, async ({ address }) => { try { const signatures = await connectionMainnet.getSignaturesForAddress( new PublicKey(address), { limit: 1 } ); if (signatures.length === 0) { return { content: [ { type: "text", text: "No transactions found for this address", }, ], }; } const latestSignature = signatures[0].signature; const transaction = await connectionMainnet.getConfirmedTransaction( latestSignature ); return { content: [ { type: "text", text: JSON.stringify(transaction), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting transaction: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
- src/index.ts:9-20 (registration)MCP server initialization listing 'get-soon-mainnet-last-transaction' in capabilities.const server = new McpServer({ name: "svm-mcp", version: "0.0.1", capabilities: [ "get-soon-testnet-balance", "get-soon-testnet-last-transaction", "get-soon-testnet-account-tokens", "get-soon-mainnet-balance", "get-soon-mainnet-last-transaction", "get-soon-mainnet-account-tokens", ], });
- src/index.ts:7-7 (helper)Solana Web3.js Connection instance for Soon mainnet RPC endpoint, used by the handler.const connectionMainnet = new Connection("https://rpc.mainnet.soo.network/rpc");