Skip to main content
Glama

update_program_status

Update loyalty program status in the database to reflect on-chain activation or pausing, ensuring data consistency 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 tool 'update_program_status' is registered here.
    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 } }));
      },
    });
  • The implementation of the 'update_program_status' tool handler.
    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 } }));
    },
Behavior3/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. It successfully clarifies that this operates on the database (not the blockchain), which is critical context. However, it omits details about idempotency, error handling if the on-chain state differs, or what the function returns.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence of nine words with no filler. It front-loads the action ('Update program status') and every word contributes essential information about scope and timing.

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 two-parameter mutation tool without output schema or annotations, the description is minimally sufficient. It explains the 'where' (database) and 'when' (after on-chain events), but lacks information about success indicators, failure modes, or state validation requirements that would make it fully complete.

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?

The input schema has 100% description coverage, establishing a baseline of 3. The description adds workflow context ('after on-chain activation/pause') that semantically links the 'status' parameter values (active/paused) to their on-chain counterparts, but does not elaborate on token address format or validation rules beyond the schema.

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 action (Update), resource (program status in database), and scope limitation (after on-chain activation/pause). It effectively distinguishes this database-sync tool from the sibling 'activate_loyalty_program' by specifying 'database' and 'after on-chain', though it could explicitly name the sibling to be perfect.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'after on-chain activation/pause' provides implicit temporal guidance for when to invoke this tool (i.e., following blockchain state changes). However, it lacks explicit contrast with alternatives like 'activate_loyalty_program' or clear statements about when NOT to use it.

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