get_credits
Check your credit balance and available scan tiers with pricing to launch penetration tests in TurboPentest.
Instructions
Check your credit balance and available scan tiers with pricing. Credits are required to launch pentests.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get-credits.ts:15-67 (handler)The async handler function that fetches credit balance and tier information, formats it into a text summary, and returns it.
async () => { try { const [balance, tiersData] = await Promise.all([ client.getCreditBalance(), client.getCreditTiers(), ]); const lines = [ "--- Credit Balance ---", ` Available: ${balance.available}`, ` Used: ${balance.used}`, ` Scheduled: ${balance.scheduled}`, ` Expired: ${balance.expired}`, ]; if (balance.expiringSoon > 0) { lines.push(` Expiring soon (30 days): ${balance.expiringSoon}`); } lines.push( "", " Available by tier:", ` Recon: ${balance.byTier.recon || 0}`, ` Standard: ${balance.byTier.standard || 0}`, ` Deep: ${balance.byTier.deep || 0}`, ` Blitz: ${balance.byTier.blitz || 0}`, "", "--- Available Tiers ---", ); for (const tier of tiersData.tiers ?? []) { lines.push( ` ${tier.label} ($${(tier.priceCents / 100).toFixed(0)})`, ` Agents: ${tier.agents}, Duration: ${tier.durationMin}min, Agent-hours: ${tier.agentHours}`, ); } if ((tiersData.volumeDiscounts ?? []).length > 0) { lines.push("", " Volume discounts:"); for (const d of tiersData.volumeDiscounts ?? []) { lines.push(` ${d.minQuantity}+ credits: ${d.discountPercent}% off`); } } return { content: [{ type: "text" as const, text: lines.join("\n") }] }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text" as const, text: `Failed to get credits: ${message}` }], isError: true, }; } }, - src/tools/get-credits.ts:6-68 (registration)The registration of the 'get_credits' tool within the MCP server, defining its schema and handler.
server.registerTool( "get_credits", { title: "Get Credits", description: "Check your credit balance and available scan tiers with pricing. " + "Credits are required to launch pentests.", inputSchema: z.object({}), }, async () => { try { const [balance, tiersData] = await Promise.all([ client.getCreditBalance(), client.getCreditTiers(), ]); const lines = [ "--- Credit Balance ---", ` Available: ${balance.available}`, ` Used: ${balance.used}`, ` Scheduled: ${balance.scheduled}`, ` Expired: ${balance.expired}`, ]; if (balance.expiringSoon > 0) { lines.push(` Expiring soon (30 days): ${balance.expiringSoon}`); } lines.push( "", " Available by tier:", ` Recon: ${balance.byTier.recon || 0}`, ` Standard: ${balance.byTier.standard || 0}`, ` Deep: ${balance.byTier.deep || 0}`, ` Blitz: ${balance.byTier.blitz || 0}`, "", "--- Available Tiers ---", ); for (const tier of tiersData.tiers ?? []) { lines.push( ` ${tier.label} ($${(tier.priceCents / 100).toFixed(0)})`, ` Agents: ${tier.agents}, Duration: ${tier.durationMin}min, Agent-hours: ${tier.agentHours}`, ); } if ((tiersData.volumeDiscounts ?? []).length > 0) { lines.push("", " Volume discounts:"); for (const d of tiersData.volumeDiscounts ?? []) { lines.push(` ${d.minQuantity}+ credits: ${d.discountPercent}% off`); } } return { content: [{ type: "text" as const, text: lines.join("\n") }] }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text" as const, text: `Failed to get credits: ${message}` }], isError: true, }; } }, ); - src/tools/get-credits.ts:13-13 (schema)The input schema for the 'get_credits' tool, which takes no arguments (empty object).
inputSchema: z.object({}),