Skip to main content
Glama

create_reward

Create new rewards redeemable with loyalty tokens to enhance customer engagement and retention in blockchain loyalty programs.

Instructions

Create a new reward redeemable with loyalty tokens

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address
nameYesReward name
descriptionNoReward description
costYesToken cost to redeem

Implementation Reference

  • The handler function for "create_reward" inside the loyalty-mcp MCP server. It validates the request, checks ownership of the loyalty program, and inserts the new reward record into the database.
    mcpServer.tool("create_reward", {
      description: "Create a new reward redeemable with loyalty tokens",
      inputSchema: { type: "object" as const, properties: { token_address: { type: "string", description: "Token contract address" }, name: { type: "string", description: "Reward name" }, description: { type: "string", description: "Reward description" }, cost: { type: "number", description: "Token cost to redeem" } }, required: ["token_address", "name", "cost"] },
      handler: async ({ token_address, name, description, cost }: any) => {
        const err = authGuard(["manage_rewards"]);
        if (err) return T(err);
        const d = db();
        const { data: prog } = await d.from("loyalty_programs").select("id").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
        if (!prog) return T('{"error":"Program not found or not owned by you"}');
        const { data: reward, error } = await d.from("rewards").insert({ name: name.trim(), description: description?.trim() || null, cost, token_address: token_address.toLowerCase(), merchant_address: agent.ownerAddress, is_active: true }).select("id,name,description,cost,is_active,created_at").single();
        if (error) return T(JSON.stringify({ error: error.message }));
        return T(JSON.stringify({ reward, message: "Reward created" }));
      },
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but fails to deliver. It does not specify what the tool returns (reward ID? full object?), error conditions, idempotency behavior, or side effects. The phrase 'redeemable with loyalty tokens' offers minimal context about the cost mechanism but lacks operational details.

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 a single, efficient sentence of seven words with no redundancy. It is front-loaded with the action verb. However, given the lack of annotations and output schema, the 'appropriate size' criterion suggests it may be overly terse for the complexity of a resource creation operation.

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 creation tool with four parameters and no output schema or annotations, the description is insufficient. It fails to explain the return value (critical for creation operations), the relationship between the reward and existing loyalty programs (implied by token_address), or behavioral constraints. The agent lacks sufficient context to handle error cases or understand the full lifecycle implications.

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 ('Token contract address', 'Token cost to redeem', etc.), establishing a baseline of 3. The description adds semantic framing that the reward is 'redeemable with loyalty tokens,' which helps connect the 'token_address' and 'cost' parameters conceptually, but does not add syntax details, validation rules, or format specifications beyond the schema.

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 ('reward'), and specifies the domain context ('redeemable with loyalty tokens') which distinguishes it from creating loyalty programs or minting tokens. However, it does not explicitly differentiate from sibling 'list_rewards' or 'redeem_reward' beyond the implied verb difference.

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 like 'redeem_reward' or 'list_rewards'. It omits prerequisites (e.g., whether an active loyalty program must exist first) and does not mention required permissions or admin privileges typically needed for reward creation.

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