Skip to main content
Glama

insumer_validate_code

Validate INSR-XXXXX discount codes during checkout by confirming validity, discount percent, and expiry. Returns valid or invalid status with a reason. No authentication required.

Instructions

Validate an INSR-XXXXX discount code. For merchant backends during ACP/UCP checkout to confirm code validity, discount percent, and expiry. Returns valid/invalid status with reason. No authentication required, no credits consumed. Does not expose wallet or token data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesDiscount code in INSR-XXXXX format

Implementation Reference

  • src/index.ts:750-763 (registration)
    Tool registration for 'insumer_validate_code' using server.tool() — defines name, description, schema, and handler.
    server.tool(
      "insumer_validate_code",
      "Validate an INSR-XXXXX discount code. For merchant backends during ACP/UCP checkout to confirm code validity, discount percent, and expiry. Returns valid/invalid status with reason. No authentication required, no credits consumed. Does not expose wallet or token data.",
      {
        code: z.string().regex(/^INSR-[A-Z0-9]{5}$/).describe("Discount code in INSR-XXXXX format"),
      },
      async (args) => {
        const res = await fetch(`${API_BASE}/codes/${encodeURIComponent(args.code)}`);
        const data = await res.json();
        return {
          content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
        };
      }
    );
  • Input schema for the tool: a single required 'code' parameter validated with regex /^INSR-[A-Z0-9]{5}$/ matching the INSR-XXXXX format.
    {
      code: z.string().regex(/^INSR-[A-Z0-9]{5}$/).describe("Discount code in INSR-XXXXX format"),
    },
  • Handler function: fetches code validation from API_BASE/codes/{code} endpoint without API key auth, returns the response as JSON text.
    async (args) => {
      const res = await fetch(`${API_BASE}/codes/${encodeURIComponent(args.code)}`);
      const data = await res.json();
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It clearly states 'No authentication required, no credits consumed. Does not expose wallet or token data.' Also explains return value (valid/invalid status with reason).

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?

Three short sentences, each earning its place: purpose, context, and behavioral traits. No redundant or vague wording.

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

Completeness5/5

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

For a simple validation tool with no output schema, the description explains return value, authentication requirements, side effects (none), and data exposure. Completely covers what an agent needs to invoke correctly.

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?

Only one parameter 'code' with schema description covering 100%. Description adds the 'INSR-XXXXX' context which matches the schema pattern, but does not add significant new semantics beyond what schema already provides. Baseline 3 due to high coverage.

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?

Description clearly states the specific verb 'Validate' and resource 'INSR-XXXXX discount code'. It specifies the context (merchant backends during ACP/UCP checkout) and distinguishes from sibling tools like insumer_check_discount by focusing on a specific code format.

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?

Explicitly states when to use ('For merchant backends during ACP/UCP checkout to confirm code validity'). While it doesn't explicitly exclude other scenarios, the context is clear and alternatives are implied by sibling tool names.

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/douglasborthwick-crypto/mcp-server-insumer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server