list_loyalty_programs
Retrieve loyalty programs managed by your merchant on Base L2 blockchain, with options to include expired programs for comprehensive oversight.
Instructions
List loyalty programs owned by the agent's merchant
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_expired | No | Include expired programs |
Implementation Reference
- The implementation of the `list_loyalty_programs` tool, which queries the `loyalty_programs` table in the database for programs owned by the merchant, optionally filtering out expired programs.
mcpServer.tool("list_loyalty_programs", { description: "List loyalty programs owned by the agent's merchant", inputSchema: { type: "object" as const, properties: { include_expired: { type: "boolean", description: "Include expired programs" } } }, handler: async ({ include_expired }: any) => { const err = authGuard(["read"]); if (err) return T(err); let q = db().from("loyalty_programs").select("id,name,symbol,token_address,status,expiration_date,created_at").eq("merchant_address", agent.ownerAddress).order("created_at", { ascending: false }); if (!include_expired) q = q.neq("status", "expired"); const { data, error } = await q; if (error) return T(JSON.stringify({ error: error.message })); return T(JSON.stringify({ programs: data || [] })); }, });