Skip to main content
Glama

activate

Register your device to activate a pex.bot simulated trading account and receive 100M KRW for practice trading.

Instructions

Activate your pex.bot account by registering this device. Grants 100M KRW for simulated trading.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the 'activate' tool logic. It collects device fingerprint via getFingerprint(), calls the /auth/activate API endpoint via apiPost(), and returns success message with account balance or error message.
    async () => {
      const fingerprint = getFingerprint();
      try {
        const result = await apiPost<{ activated: boolean; balance: string }>(
          "/auth/activate",
          fingerprint
        );
        return {
          content: [
            {
              type: "text" as const,
              text: `Account activated successfully! Balance: ${Number(result.balance).toLocaleString()} KRW`,
            },
          ],
        };
      } catch (err: any) {
        return {
          content: [{ type: "text" as const, text: `Activation failed: ${err.message}` }],
          isError: true,
        };
      }
    }
  • src/index.ts:224-250 (registration)
    Registration of the 'activate' tool using server.tool(). Defines the tool name, description, empty schema (no input parameters), and the handler function.
    server.tool(
      "activate",
      "Activate your pex.bot account by registering this device. Grants 100M KRW for simulated trading.",
      {},
      async () => {
        const fingerprint = getFingerprint();
        try {
          const result = await apiPost<{ activated: boolean; balance: string }>(
            "/auth/activate",
            fingerprint
          );
          return {
            content: [
              {
                type: "text" as const,
                text: `Account activated successfully! Balance: ${Number(result.balance).toLocaleString()} KRW`,
              },
            ],
          };
        } catch (err: any) {
          return {
            content: [{ type: "text" as const, text: `Activation failed: ${err.message}` }],
            isError: true,
          };
        }
      }
    );
  • Helper function getFingerprint() that collects device information (MAC address, hostname, OS, CPU model) used as the payload for the activate tool.
    function getFingerprint() {
      const interfaces = os.networkInterfaces();
      let macAddress = "00:00:00:00:00:00";
      for (const name of Object.keys(interfaces)) {
        const nets = interfaces[name];
        if (!nets) continue;
        for (const net of nets) {
          if (!net.internal && net.mac && net.mac !== "00:00:00:00:00:00") {
            macAddress = net.mac;
            break;
          }
        }
        if (macAddress !== "00:00:00:00:00:00") break;
      }
    
      const cpus = os.cpus();
      return {
        mac_address: macAddress,
        hostname: os.hostname(),
        os: `${os.type()} ${os.release()}`,
        model_name: cpus.length > 0 ? cpus[0].model : undefined,
        cpu_info: cpus.length > 0 ? `${cpus[0].model} (${cpus.length} cores)` : undefined,
      };
    }
  • Helper function apiPost<T>() that performs authenticated POST requests to the API. Used by the activate handler to call /auth/activate endpoint.
    async function apiPost<T>(path: string, body: unknown): Promise<T> {
      const res = await fetch(`${API_BASE}${path}`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          ...getAuthHeaders(),
        },
        body: JSON.stringify(body),
      });
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`API POST ${path} failed (${res.status}): ${text}`);
      }
      return res.json() as Promise<T>;
    }

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/mikusnuz/pexbot-mcp'

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