Skip to main content
Glama

check_voucher_status

Verify the current status of loyalty program vouchers using either voucher codes or IDs. This public tool requires no authentication and works with the Loyal Spark Loyalty Protocol on Base L2.

Instructions

Check voucher status by code or ID. Public endpoint — no API key or authentication required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoVoucher code (e.g. LOYAL-XXXX-XXXX-XXXX-XXXX)
voucher_idNoVoucher UUID (alternative to code)

Implementation Reference

  • The handler function for 'check_voucher_status' that fetches voucher details from the database based on either code or voucher_id.
    handler: async ({ code, voucher_id }: any) => {
      if (!code && !voucher_id) return T(JSON.stringify({ error: "Provide code or voucher_id" }));
    
      const d = db();
      let q = d.from("vouchers").select("id, code, reward_name, reward_description, cost, status, token_address, token_symbol, merchant_address, activated_at, used_at");
      if (code) q = q.eq("code", code);
      else q = q.eq("id", voucher_id);
    
      const { data: v, error: e } = await q.maybeSingle();
      if (e || !v) return T(JSON.stringify({ error: "Voucher not found" }));
    
      return T(JSON.stringify({ voucher: v }));
    },
  • The registration of the 'check_voucher_status' tool in the MCP server.
    mcpServer.tool("check_voucher_status", {
      description: "Check voucher status by code or ID. Public endpoint — no API key or authentication required.",
      inputSchema: {
        type: "object" as const,
        properties: {
          code: { type: "string", description: "Voucher code (e.g. LOYAL-XXXX-XXXX-XXXX-XXXX)" },
          voucher_id: { type: "string", description: "Voucher UUID (alternative to code)" },
        },
      },
      handler: async ({ code, voucher_id }: any) => {
        if (!code && !voucher_id) return T(JSON.stringify({ error: "Provide code or voucher_id" }));
    
        const d = db();
        let q = d.from("vouchers").select("id, code, reward_name, reward_description, cost, status, token_address, token_symbol, merchant_address, activated_at, used_at");
        if (code) q = q.eq("code", code);
        else q = q.eq("id", voucher_id);
    
        const { data: v, error: e } = await q.maybeSingle();
        if (e || !v) return T(JSON.stringify({ error: "Voucher not found" }));
    
        return T(JSON.stringify({ voucher: v }));
      },
  • The input schema for 'check_voucher_status' validating code and voucher_id.
    inputSchema: {
      type: "object" as const,
      properties: {
        code: { type: "string", description: "Voucher code (e.g. LOYAL-XXXX-XXXX-XXXX-XXXX)" },
        voucher_id: { type: "string", description: "Voucher UUID (alternative to code)" },
      },
    },
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 documents authentication requirements (public, no key needed), but does not explicitly confirm this is a read-only operation, describe potential rate limits, or explain what status values (valid, used, expired) might be returned.

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 consists of two efficient sentences with zero redundancy. The first sentence front-loads the core purpose and parameters, while the second provides critical authentication context. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple lookup tool with two optional parameters and no output schema, the description adequately covers purpose, inputs, and authentication requirements. It appropriately omits redundant return value explanation given the self-documenting tool name, though it could benefit from explicitly stating the read-only nature of the operation.

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 marginal value by noting the parameters are alternatives ('code or ID'), but does not elaborate on syntax details beyond the schema's example format for the code parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description provides a specific verb ('Check'), resource ('voucher status'), and identification methods ('by code or ID'), clearly distinguishing it from the sibling 'use_voucher' tool through the semantic difference between checking status versus using/consuming the voucher.

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

Usage Guidelines4/5

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

The description provides explicit usage context by disclosing 'Public endpoint — no API key or authentication required,' which signals when to use this tool (for unauthenticated lookups). However, it does not explicitly reference sibling 'use_voucher' as the alternative for redeeming the voucher, which would prevent confusion between reading and mutating operations.

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