get_token_supply
Retrieve the total supply of a Solana SPL token using its mint address to verify circulating tokens and monitor token economics.
Instructions
Get the total supply of a token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tokenMint | Yes | Token mint address |
Implementation Reference
- src/index.ts:1123-1141 (handler)Core handler function that implements the get_token_supply tool logic. Ensures connection, fetches mint account data using Solana's getMint RPC call, computes human-readable supply, and returns detailed mint information.async function handleGetTokenSupply(args: any) { const { tokenMint } = args; ensureConnection(); const tokenMintPubkey = new PublicKey(tokenMint); const mintInfo = await getMint(connection, tokenMintPubkey); const supply = Number(mintInfo.supply) / Math.pow(10, mintInfo.decimals); return { tokenMint, supply, rawSupply: mintInfo.supply.toString(), decimals: mintInfo.decimals, mintAuthority: mintInfo.mintAuthority ? mintInfo.mintAuthority.toString() : null, freezeAuthority: mintInfo.freezeAuthority ? mintInfo.freezeAuthority.toString() : null, isInitialized: mintInfo.isInitialized }; }
- src/index.ts:447-456 (schema)Input schema definition for the get_token_supply tool, specifying that it requires a 'tokenMint' string parameter.inputSchema: { type: "object", properties: { tokenMint: { type: "string", description: "Token mint address" } }, required: ["tokenMint"] }
- src/index.ts:444-457 (registration)Registration of the get_token_supply tool in the MCP tools array, including name, description, and input schema.{ name: "get_token_supply", description: "Get the total supply of a token", inputSchema: { type: "object", properties: { tokenMint: { type: "string", description: "Token mint address" } }, required: ["tokenMint"] } },
- src/index.ts:1348-1350 (helper)Dispatch logic in the main CallToolRequestSchema handler that routes 'get_token_supply' calls to the specific handler function.case "get_token_supply": result = await handleGetTokenSupply(args); break;