Skip to main content
Glama

list_rewards

Retrieve available rewards for a loyalty program using its token contract address on Base L2.

Instructions

List rewards for a loyalty program by token_address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address (0x...)

Implementation Reference

  • The handler function that executes the "list_rewards" tool, querying the "rewards" table from Supabase.
    handler: async ({ token_address }: any) => {
      const err = authGuard(["read"]);
      if (err) return T(err);
      const { data, error } = await db().from("rewards").select("id,name,description,cost,is_active,created_at").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress);
      if (error) return T(JSON.stringify({ error: error.message }));
      return T(JSON.stringify({ rewards: data || [] }));
    },
  • Registration of the "list_rewards" tool within the MCP server definition.
    mcpServer.tool("list_rewards", {
      description: "List rewards for a loyalty program by token_address",
      inputSchema: { type: "object" as const, properties: { token_address: { type: "string", description: "Token contract address (0x...)" } }, required: ["token_address"] },
      handler: async ({ token_address }: any) => {
        const err = authGuard(["read"]);
        if (err) return T(err);
        const { data, error } = await db().from("rewards").select("id,name,description,cost,is_active,created_at").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress);
        if (error) return T(JSON.stringify({ error: error.message }));
        return T(JSON.stringify({ rewards: data || [] }));
      },
    });
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 only implies read-only safety through the verb 'List'. It fails to mention pagination behavior, rate limiting, authentication requirements, or what data structure is returned (rewards as objects, array, etc.).

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 9 words with no filler content. However, given the absence of annotations and output schema, this brevity may be excessive—every sentence earns its place, but there aren't enough sentences to fully document the tool's behavior.

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?

For a single-parameter tool with 100% schema coverage, the description meets minimum viability by identifying the core operation. However, given no output schema and no annotations, it should explain what constitutes a 'reward' or provide return value context to be complete. It stops at the bare minimum.

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 coverage is 100%, so the baseline is 3. The description acknowledges the 'token_address' parameter but adds no semantic value beyond the schema's description ('Token contract address (0x...)'). It doesn't clarify if this is the program's token or a specific reward token.

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 verb (List), resource (rewards), and scope (for a loyalty program), which distinguishes it from sibling tools like 'create_reward' or 'list_loyalty_programs'. However, it doesn't clarify the relationship to 'list_marketplace_offers' or what distinguishes a 'reward' from an 'offer' in this domain.

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 mentions the filter criterion ('by token_address') but provides no explicit guidance on when to use this tool versus alternatives, nor any prerequisites for the token_address value. It lacks 'when-not' guidance or context about program states (e.g., active vs. inactive programs).

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