Skip to main content
Glama

mint_loyalty_tokens

Generate smart contract parameters to mint loyalty tokens for customer rewards in on-chain loyalty programs.

Instructions

Record mint intent and get smart contract call params

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address
recipientYesRecipient wallet (0x...)
amountYesTokens to mint

Implementation Reference

  • The handler function for the "mint_loyalty_tokens" MCP tool, which validates the request, checks the loyalty program in the database, records the mint intent, and generates contract calldata.
    handler: async ({ token_address, recipient, amount }: any) => {
      const err = authGuard(["mint"]);
      if (err) return T(err);
      if (!/^0x[a-fA-F0-9]{40}$/.test(recipient)) return T('{"error":"Invalid recipient address"}');
      const d = db();
      const { data: prog } = await d.from("loyalty_programs").select("id,name,symbol,status").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
      if (!prog) return T('{"error":"Program not found"}');
      if (prog.status !== "active") return T(JSON.stringify({ error: `Program is ${prog.status}` }));
      const { data: mint, error } = await d.from("token_mint_history").insert({ merchant_address: agent.ownerAddress.toLowerCase(), recipient_address: recipient.toLowerCase(), amount, token_address: token_address.toLowerCase(), token_name: prog.name, token_symbol: prog.symbol }).select("id,amount,recipient_address,token_address,created_at").single();
      if (error) return T(JSON.stringify({ error: error.message }));
      return T(JSON.stringify({ mint, contract_call: { to: token_address, function: "mint(address,uint256)", args: [recipient, amount], calldata: encodeMintCalldata(recipient, amount), chain: "Base (8453)", builder_code: BUILDER_CODE } }));
    },
  • Registration of the "mint_loyalty_tokens" tool within the MCP server setup.
    mcpServer.tool("mint_loyalty_tokens", {
      description: "Record mint intent and get smart contract call params",
      inputSchema: { type: "object" as const, properties: { token_address: { type: "string", description: "Token contract address" }, recipient: { type: "string", description: "Recipient wallet (0x...)" }, amount: { type: "number", description: "Tokens to mint" } }, required: ["token_address", "recipient", "amount"] },
      handler: async ({ token_address, recipient, amount }: any) => {
        const err = authGuard(["mint"]);
        if (err) return T(err);
        if (!/^0x[a-fA-F0-9]{40}$/.test(recipient)) return T('{"error":"Invalid recipient address"}');
        const d = db();
        const { data: prog } = await d.from("loyalty_programs").select("id,name,symbol,status").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
        if (!prog) return T('{"error":"Program not found"}');
        if (prog.status !== "active") return T(JSON.stringify({ error: `Program is ${prog.status}` }));
        const { data: mint, error } = await d.from("token_mint_history").insert({ merchant_address: agent.ownerAddress.toLowerCase(), recipient_address: recipient.toLowerCase(), amount, token_address: token_address.toLowerCase(), token_name: prog.name, token_symbol: prog.symbol }).select("id,amount,recipient_address,token_address,created_at").single();
        if (error) return T(JSON.stringify({ error: error.message }));
        return T(JSON.stringify({ mint, contract_call: { to: token_address, function: "mint(address,uint256)", args: [recipient, amount], calldata: encodeMintCalldata(recipient, amount), chain: "Base (8453)", builder_code: BUILDER_CODE } }));
      },
    });
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. It crucially clarifies that this tool returns 'smart contract call params' rather than executing the transaction itself—a key behavioral distinction. However, it omits authentication requirements, gas/fee implications, idempotency guarantees, or what the returned parameters contain.

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

Conciseness4/5

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

The description is extremely concise at nine words with no filler. It front-loads the core action. However, given the high-stakes blockchain context and zero annotations, it is arguably too terse—lacking safety warnings or output handling guidance that would justify its brevity.

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 blockchain operation tool with no output schema and no annotations, the description is insufficient. While it mentions returning 'smart contract call params,' it fails to describe the output structure, error cases, chain/network context, or how to use the returned parameters to actually execute the mint.

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?

The input schema has 100% description coverage for all three parameters (token_address, recipient, amount), establishing a baseline score of 3. The description adds no additional semantic context beyond what the schema already provides, such as address format validation or amount precision requirements.

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 tool records minting intent and retrieves smart contract parameters, using specific verbs ('record', 'get') and identifying the blockchain context. However, it does not explicitly differentiate from the sibling 'transfer_loyalty_tokens' tool, which also moves tokens to recipients but from existing supply rather than minting new ones.

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?

No guidance is provided on when to use this versus 'transfer_loyalty_tokens' or other alternatives. There are no prerequisites mentioned (e.g., program ownership requirements) nor warnings about the irreversible nature of minting operations in blockchain contexts.

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/aspekt19/unboxed-loyalty-spark'

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