Skip to main content
Glama

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
NameRequiredDescriptionDefault
include_expiredNoInclude 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 || [] }));
      },
    });

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