Skip to main content
Glama

update_program_status

Update loyalty program status in the database after on-chain activation or pause. Synchronize program state between blockchain and backend systems.

Instructions

Update program status in database after on-chain activation/pause

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address
statusYesNew status: active, paused, or inactive

Implementation Reference

  • The 'update_program_status' tool is defined here. It updates the loyalty program status in the database, verifying the merchant's ownership of the token address and enforcing valid status values.
    mcpServer.tool("update_program_status", {
      description: "Update program status in database after on-chain activation/pause",
      inputSchema: { type: "object" as const, properties: { token_address: { type: "string", description: "Token contract address" }, status: { type: "string", description: "New status: active, paused, or inactive" } }, required: ["token_address", "status"] },
      handler: async ({ token_address, status }: any) => {
        const err = authGuard(["mint", "create_program"]);
        if (err) return T(err);
        const valid = ["active", "paused", "inactive"];
        if (!valid.includes(status)) return T(`{"error":"Invalid status. Use: ${valid.join(", ")}"}`);
        const d = db();
        const { data: prog } = await d.from("loyalty_programs").select("id,name,status").eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress).single();
        if (!prog) return T('{"error":"Program not found"}');
        const { error } = await d.from("loyalty_programs").update({ status, updated_at: new Date().toISOString() }).eq("token_address", token_address.toLowerCase()).eq("merchant_address", agent.ownerAddress);
        if (error) return T(JSON.stringify({ error: error.message }));
        return T(JSON.stringify({ message: `Status updated from '${prog.status}' to '${status}'`, program: { id: prog.id, name: prog.name, new_status: status } }));
      },
    });

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