Skip to main content
Glama

create-token

Create new meme tokens on the Pump.fun platform by specifying name, symbol, description, and initial SOL buy amount. This tool enables AI assistants to launch tokens on Solana with optional image URLs and account management.

Instructions

Create a new Pump.fun token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesToken name
symbolYesToken symbol
descriptionYesToken description
imageUrlNoURL to token image (optional)
initialBuyAmountYesInitial buy amount in SOL
accountNameNoName of the account to use (will be created if it doesn't exist)default

Implementation Reference

  • The core handler function that implements the create-token tool logic. It initializes the SDK, manages the account keypair, checks SOL balance, generates a mint keypair, optionally loads an image, calls PumpFunSDK.createAndBuy, saves the mint key, fetches token balance, and returns success details or error.
    export async function createToken(
      name: string,
      symbol: string,
      description: string,
      imageUrl: string | undefined,
      initialBuyAmount: number,
      accountName: string = "default"
    ) {
      try {
        const { sdk, connection } = initializeSDK();
        const keysFolder = path.resolve(rootDir, ".keys");
    
        const account = getOrCreateKeypair(keysFolder, accountName);
        const balance = await connection.getBalance(account.publicKey);
        const requiredBalance =
          initialBuyAmount * LAMPORTS_PER_SOL + 0.003 * LAMPORTS_PER_SOL;
    
        if (balance < requiredBalance) {
          return {
            success: false,
            error: `Insufficient SOL balance. Account ${account.publicKey.toString()} has ${
              balance / LAMPORTS_PER_SOL
            } SOL, but needs at least ${
              requiredBalance / LAMPORTS_PER_SOL
            } SOL. Please send SOL to this address and try again.`,
          };
        }
    
        const mint = Keypair.generate();
    
        let fileBlob: Blob | undefined;
        if (imageUrl) {
          const imageData = fs.readFileSync(imageUrl);
          fileBlob = new Blob([imageData], { type: "image/png" });
        }
    
        const tokenMetadata: any = {
          name,
          symbol,
          description,
          file: fileBlob,
        };
    
        const result = await sdk.createAndBuy(
          account,
          mint,
          tokenMetadata,
          BigInt(initialBuyAmount * LAMPORTS_PER_SOL),
          DEFAULT_SLIPPAGE_BASIS_POINTS,
          DEFAULT_PRIORITY_FEES
        );
    
        if (!result.success) {
          return {
            success: false,
            error: result.error || "Unknown error",
          };
        }
    
        fs.writeFileSync(
          path.join(keysFolder, `mint-${mint.publicKey.toString()}.json`),
          safeStringify(Array.from(mint.secretKey))
        );
    
        const tokenBalance = await getSPLBalance(
          connection,
          mint.publicKey,
          account.publicKey
        );
    
        return {
          success: true,
          tokenAddress: mint.publicKey.toString(),
          tokenName: name,
          tokenSymbol: symbol,
          tokenBalance,
          signature: result.signature,
          pumpfunUrl: `https://pump.fun/${mint.publicKey.toString()}`,
        };
      } catch (error: any) {
        console.error("Error creating token:", error);
        return { success: false, error: error?.message || "Unknown error" };
      }
    }
  • src/index.ts:98-150 (registration)
    The MCP tool registration for 'create-token', including the tool name, description, input schema using Zod, and the thin wrapper handler that calls the core createToken function and formats the response.
    server.tool(
      "create-token",
      "Create a new Pump.fun token",
      {
        name: z.string().describe("Token name"),
        symbol: z.string().describe("Token symbol"),
        description: z.string().describe("Token description"),
        imageUrl: z.string().optional().describe("URL to token image (optional)"),
        initialBuyAmount: z
          .number()
          .min(0.0001)
          .describe("Initial buy amount in SOL"),
        accountName: z
          .string()
          .default("default")
          .describe(
            "Name of the account to use (will be created if it doesn't exist)"
          ),
      },
      async ({
        name,
        symbol,
        description,
        imageUrl,
        initialBuyAmount,
        accountName,
      }) => {
        try {
          const result = await createToken(
            name,
            symbol,
            description,
            imageUrl,
            initialBuyAmount,
            accountName
          );
    
          const formattedResult = formatCreateTokenResult(result);
    
          return createMcpResponse(formattedResult);
        } catch (error: any) {
          console.error("Error creating token:", error);
          return {
            content: [
              {
                type: "text",
                text: `Error creating token: ${error?.message || "Unknown error"}`,
              },
            ],
          };
        }
      }
    );
  • The Zod input schema defining parameters for the create-token tool: name, symbol, description, optional imageUrl, initialBuyAmount (min 0.0001), and accountName (default 'default').
      name: z.string().describe("Token name"),
      symbol: z.string().describe("Token symbol"),
      description: z.string().describe("Token description"),
      imageUrl: z.string().optional().describe("URL to token image (optional)"),
      initialBuyAmount: z
        .number()
        .min(0.0001)
        .describe("Initial buy amount in SOL"),
      accountName: z
        .string()
        .default("default")
        .describe(
          "Name of the account to use (will be created if it doesn't exist)"
        ),
    },
    async ({
      name,
      symbol,
  • Helper function to format the result of createToken into a human-readable string for the MCP response.
    export function formatCreateTokenResult(
      result: ReturnType<typeof createToken> extends Promise<infer T> ? T : never
    ) {
      if (!result.success) {
        return `Error creating token: ${result.error}`;
      }
    
      return [
        `Successfully created token!`,
        `Token Address: ${result.tokenAddress}`,
        `Token Name: ${result.tokenName}`,
        `Token Symbol: ${result.tokenSymbol}`,
        `Your Balance: ${result.tokenBalance}`,
        `Transaction Signature: ${result.signature}`,
        `Pump.fun URL: ${result.pumpfunUrl}`,
      ].join("\n");
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Create' which implies a write/mutation operation, but doesn't mention critical behaviors: whether this requires authentication, consumes SOL (implied by 'initialBuyAmount' but not explicitly stated), has rate limits, or what happens on success/failure. For a token creation tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states exactly what the tool does without any wasted words. It's appropriately sized for a creation tool and front-loads the core purpose immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a token creation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what happens after creation (e.g., returns token address, triggers transactions), doesn't mention SOL cost implications beyond the parameter name, and provides no error handling context. The combination of mutation operation + financial implications + no structured behavioral data requires more descriptive coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't compensate with any extra context about parameter relationships or usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new Pump.fun token'), making the purpose immediately understandable. It distinguishes from siblings like 'buy-token' or 'sell-token' by focusing on creation rather than trading operations. However, it doesn't specify what kind of token creation this is (e.g., minting vs. deployment), which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing SOL balance), when not to use it, or how it relates to sibling tools like 'buy-token' or 'get-token-info'. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/dexoryn/pumpfun-mcp-server'

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