Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
        };
      }
    },
  • 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,
          };
        }
      },
    );
  • The input schema for the 'get_credits' tool, which takes no arguments (empty object).
    inputSchema: z.object({}),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/integsec/turbopentest-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server