Skip to main content
Glama

generate_deploy_link

Generate a TON deployment deeplink for a compiled Tolk contract by providing the compiled code BoC and optional initial data. Computes the contract address and outputs ton:// deeplinks for wallet deployment.

Instructions

Generates a TON deployment deeplink for a compiled Tolk contract. Accepts the compiled code BoC (base64) and optionally initial data BoC. Computes the contract address and returns ton:// deeplinks for wallet deployment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeBoc64YesBase64-encoded BoC of the compiled contract code (from compile_tolk output)
initialDataBoc64NoBase64-encoded BoC for the contract initial data cell (default: empty cell)
workchainNoTarget workchain ID (default: 0, the basechain)
amountNoAmount in nanoTON to send with deploy message (default: "50000000" = 0.05 TON)

Implementation Reference

  • src/tools.ts:228-230 (registration)
    Registration of the 'generate_deploy_link' tool via server.tool() with its description.
    server.tool(
      "generate_deploy_link",
      "Generates a TON deployment deeplink for a compiled Tolk contract. " +
  • Input schema for generate_deploy_link: codeBoc64 (required), initialDataBoc64 (optional), workchain (optional), amount (optional regex-validated string).
    {
      codeBoc64: z.string().describe("Base64-encoded BoC of the compiled contract code (from compile_tolk output)"),
      initialDataBoc64: z
        .string()
        .optional()
        .describe("Base64-encoded BoC for the contract initial data cell (default: empty cell)"),
      workchain: z.number().optional().describe("Target workchain ID (default: 0, the basechain)"),
      amount: z
        .string()
        .regex(/^\d+$/, "amount must be a non-negative integer string (nanoTON)")
        .optional()
        .describe('Amount in nanoTON to send with deploy message (default: "50000000" = 0.05 TON)'),
    },
  • Handler function that decodes BoC, computes contract address using @ton/core, generates ton:// and Tonkeeper deeplinks, and returns deployment info.
    async (args) => {
      const { codeBoc64, initialDataBoc64, workchain, amount } = args;
      const wc = workchain ?? 0;
      const deployAmount = amount ?? "50000000";
    
      let code: Cell;
      try {
        code = Cell.fromBase64(codeBoc64);
      } catch (err) {
        return {
          content: [{ type: "text", text: `Error: invalid codeBoc64 — ${getErrorMessage(err)}` }],
          isError: true,
        };
      }
    
      let data: Cell;
      if (initialDataBoc64) {
        try {
          data = Cell.fromBase64(initialDataBoc64);
        } catch (err) {
          return {
            content: [{ type: "text", text: `Error: invalid initialDataBoc64 — ${getErrorMessage(err)}` }],
            isError: true,
          };
        }
      } else {
        data = beginCell().endCell();
      }
    
      const stateInit = { code, data };
      const address = contractAddress(wc, stateInit);
      const stateInitCell = beginCell().store(storeStateInit(stateInit)).endCell();
      const stateInitBoc64 = stateInitCell.toBoc().toString("base64");
    
      const tonLink = `ton://transfer/${address.toString()}?amount=${deployAmount}&stateInit=${encodeURIComponent(stateInitBoc64)}`;
      const tonkeeperLink = `https://app.tonkeeper.com/transfer/${address.toString()}?amount=${deployAmount}&stateInit=${encodeURIComponent(stateInitBoc64)}`;
    
      const lines: string[] = [
        `## Deployment Information`,
        "",
        `**Contract address:** \`${address.toString()}\``,
        `**Address (raw):** \`${address.toRawString()}\``,
        `**Target workchain:** ${wc}`,
        `**Deploy amount:** ${deployAmount} nanoTON (${Number(deployAmount) / 1e9} TON)`,
        "",
        "### Deployment Links",
        "",
        `**ton:// deeplink** (universal):`,
        "```",
        tonLink,
        "```",
        "",
        `**Tonkeeper link:**`,
        "```",
        tonkeeperLink,
        "```",
        "",
        "### How to deploy",
        "",
        "1. Open one of the links above in a TON wallet (Tonkeeper, Tonhub, etc.)",
        "2. Confirm the transaction — it will deploy the contract to the address shown above",
        "3. The contract address is deterministic — same code + data always produces the same address",
        "",
        `> **Note:** Different initial data produces a different contract address. ` +
          `If no initialDataBoc64 was provided, an empty cell was used.`,
        "",
        "### StateInit BoC (base64)",
        "```",
        stateInitBoc64,
        "```",
      ];
    
      return { content: [{ type: "text", text: lines.join("\n") }] };
    },
  • Helper function getErrorMessage used by the handler for error formatting.
    function getErrorMessage(err: unknown): string {
      return err instanceof Error ? err.message : String(err);
    }
  • Imports used by the tool: @ton/core (Cell, beginCell, contractAddress, storeStateInit), zod for schema validation.
    import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { beginCell, Cell, contractAddress, storeStateInit } from "@ton/core";
    import { getTolkCompilerVersion, runTolkCompiler } from "@ton/tolk-js";
    import { z } from "zod";
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions computing address and returning deeplinks, but does not disclose side effects, error conditions, or whether network access is required.

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?

Two concise sentences front-load the main purpose and provide key details without waste. Every sentence adds value.

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

Completeness3/5

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

Given the tool generates deeplinks with no output schema, the description lacks return format details (e.g., how many links, usage in wallet). It is adequate but not fully complete for agent invocation.

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

Parameters4/5

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

Input schema has 100% coverage with detailed parameter descriptions (e.g., linking codeBoc64 to compile_tolk output, specifying defaults for workchain and amount). The tool description adds no extra but schema is sufficient.

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

Purpose5/5

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

The description clearly states the tool generates a TON deployment deeplink for a compiled Tolk contract, distinguishing it from sibling tools like compile_tolk and check_tolk_syntax.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives. It implies usage after compilation but lacks when-not-to-use guidance or alternative tool references.

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/izzzzzi/izTolkMcp'

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