list_rewards
Retrieve available rewards for a loyalty program by providing the token contract address to view program benefits.
Instructions
List rewards for a loyalty program by token_address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_address | Yes | Token contract address (0x...) |
Implementation Reference
- Tool registration and handler implementation for "list_rewards" within the loyalty MCP server.
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 || [] }));