Skip to main content
Glama

kya_reportBadgeNotPresented

Report when a badge was not presented during a merchant transaction, such as for abandoned carts or when merchants don't request it.

Instructions

Report that you did NOT present your Badge at a merchant.

Call this when you have a badge but chose not to present it (e.g., abandoned cart, merchant didn't ask).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verification_tokenYesThe verification_token from kya_getAgentIdentity
merchantYesThe merchant where you did not present (e.g., 'starbucks.com')
reasonYesWhy you did not present: abandoned, merchant_didnt_ask, other
trip_idNoTrip ID from kya_getAgentIdentity — links events in this shopping session

Implementation Reference

  • The handler implementation of reportBadgeNotPresented.
    export async function reportBadgeNotPresented(
      verificationToken: string,
      merchant: string,
      reason: "abandoned" | "merchant_didnt_ask" | "other",
      tripId?: string
    ): Promise<void> {
      const apiUrl = getEnvApiUrl() || DEFAULT_API_URL;
      const key = getStoredConsentKey();
      const installId = getOrCreateInstallId();
    
      try {
        if (key) {
          // Enriched payload: full auth, user-linked, includes install_id
          const res = await fetch(`${apiUrl}/api/badge/report`, {
            method: "POST",
            headers: {
              Authorization: `Bearer ${key}`,
              "Content-Type": "application/json",
            },
            body: JSON.stringify({
              verification_token: verificationToken,
              event_type: "badge_not_presented",
              merchant,
              reason,
              install_id: installId,
              ...(tripId && { trip_id: tripId }),
            }),
          });
          if (!res.ok) {
            const body = await res.text().catch(() => "");
            process.stderr.write(
              `[BADGE] reportBadgeNotPresented failed (${res.status}): ${body}\n`
            );
          }
        } else {
          // Anonymous payload: no auth header, install_id only
          const res = await fetch(`${apiUrl}/api/badge/report`, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({
              install_id: installId,
              badge_version: BADGE_VERSION,
              event_type: "badge_not_presented",
              merchant,
              reason,
              agent_type: AGENT_TYPE,
              agent_model: getAgentModel(),
              timestamp: Date.now(),
              ...(tripId && { trip_id: tripId }),
            }),
          });
          if (!res.ok) {
            const body = await res.text().catch(() => "");
            process.stderr.write(
              `[BADGE] anonymous reportBadgeNotPresented failed (${res.status}): ${body}\n`
            );
          }
        }
      } catch (err) {
        // [EC-1] Fire-and-forget but never silent
        process.stderr.write(
          `[BADGE] reportBadgeNotPresented error: ${err instanceof Error ? err.message : err}\n`
        );
      }
    }
  • src/index.ts:137-165 (registration)
    The tool registration of kya_reportBadgeNotPresented.
    server.tool(
      "kya_reportBadgeNotPresented",
      `Report that you did NOT present your Badge at a merchant.
    
    Call this when you have a badge but chose not to present it (e.g., abandoned cart, merchant didn't ask).`,
      {
        verification_token: z.string().describe(
          "The verification_token from kya_getAgentIdentity"
        ),
        merchant: z.string().max(200).describe(
          "The merchant where you did not present (e.g., 'starbucks.com')"
        ),
        reason: z
          .enum(["abandoned", "merchant_didnt_ask", "other"])
          .describe("Why you did not present: abandoned, merchant_didnt_ask, other"),
        trip_id: z.string().uuid().optional().describe(
          "Trip ID from kya_getAgentIdentity — links events in this shopping session"
        ),
      },
      async ({ verification_token, merchant, reason, trip_id }) => {
        await reportBadgeNotPresented(verification_token, merchant, reason, trip_id);
        return {
          content: [{
            type: "text",
            text: `✓ Not presented recorded at ${merchant} (${reason})`,
          }],
        };
      }
    );
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It explains the tool's purpose (reporting non-presentation) and gives context (e.g., abandoned cart scenarios), but lacks details on permissions, rate limits, or what happens after reporting (e.g., confirmation, data storage). For a reporting tool with zero annotation coverage, this is adequate but not rich in behavioral context.

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 two sentences, front-loaded with the core purpose, followed by usage guidance. Every word earns its place with no redundancy or fluff, making it highly efficient and easy to parse.

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?

Given no annotations, no output schema, and 4 parameters (with 100% schema coverage), the description is mostly complete. It covers purpose, usage, and context well, but lacks details on behavioral aspects like response format or error handling. For a reporting tool, this is sufficient but could be more comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters well (e.g., verification_token from kya_getAgentIdentity, reason enum values). The description adds minimal param semantics by implying 'merchant' context and 'reason' examples, but doesn't provide syntax or format details beyond the schema. Baseline is 3 with high coverage, but the description slightly enhances understanding of parameter usage in context.

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 clearly states the specific action: 'Report that you did NOT present your Badge at a merchant.' It distinguishes from siblings like kya_reportBadgePresented (which reports presentation) and kya_reportBadgeOutcome (which reports outcomes, not non-presentation). The verb 'report' and resource 'badge not presented' are precise.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'Call this when you have a badge but chose not to present it (e.g., abandoned cart, merchant didn't ask).' It provides clear examples (abandoned cart, merchant didn't ask) and implicitly distinguishes from kya_reportBadgePresented (for presentation) and kya_reportPurchase (for purchases).

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/kyalabs-Io/payclaw-mcp'

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