Skip to main content
Glama

kya_reportBadgeOutcome

Report merchant acceptance or denial after presenting your Badge. Use when Extended Auth is disabled or to report outcomes earlier than the 7-second check.

Instructions

Report how the merchant responded when you presented your Badge.

Call this after kya_reportBadgePresented when you know whether the merchant accepted or denied you. Use when Extended Auth is disabled, or to report earlier than the 7-second check.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verification_tokenYesThe verification_token returned by kya_getAgentIdentity
merchantYesThe merchant where you presented (e.g., 'starbucks.com')
outcomeYesaccepted = merchant let you through; denied = blocked/bot-walled; inconclusive = unknown or timed out
trip_idNoTrip ID from kya_getAgentIdentity — links events in this shopping session

Implementation Reference

  • Registration of the kya_reportBadgeOutcome tool in src/index.ts.
    server.tool(
      "kya_reportBadgeOutcome",
      `Report how the merchant responded when you presented your Badge.
    
    Call this after kya_reportBadgePresented when you know whether the merchant accepted or denied you. Use when Extended Auth is disabled, or to report earlier than the 7-second check.`,
      {
        verification_token: z.string().describe(
          "The verification_token returned by kya_getAgentIdentity"
        ),
        merchant: z.string().max(200).describe(
          "The merchant where you presented (e.g., 'starbucks.com')"
        ),
        outcome: z
          .enum(["accepted", "denied", "inconclusive"])
          .describe(
            "accepted = merchant let you through; denied = blocked/bot-walled; inconclusive = unknown or timed out"
          ),
        trip_id: z.string().uuid().optional().describe(
          "Trip ID from kya_getAgentIdentity — links events in this shopping session"
        ),
      },
      async ({ verification_token, merchant, outcome, trip_id }) => {
        reportOutcomeFromAgent(verification_token, merchant, outcome, trip_id);
        return {
          content: [{
            type: "text",
            text: `✓ Outcome recorded: ${outcome} at ${merchant}`,
          }],
        };
      }
    );
  • Implementation of the reportOutcomeFromAgent function used by the kya_reportBadgeOutcome tool.
    export function reportOutcomeFromAgent(
      token: string,
      merchant: string,
      outcome: "accepted" | "denied" | "inconclusive",
      tripId?: string
    ): void {
      if (activeTrips.has(token)) {
        // Attach trip_id to the active trip before resolving
        if (tripId) activeTrips.get(token)!.tripId = tripId;
        resolveTrip(token, outcome, "agent_reported");
        return;
      }
      // Token may be from before restart — try to find a unique trip by merchant
      let matchToken: string | null = null;
      let matchCount = 0;
      for (const [t, trip] of activeTrips) {
        if (trip.merchant === merchant && trip.presented && !trip.outcome) {
          matchToken = t;
          matchCount++;
          if (matchCount > 1) break;
        }
      }
      if (matchCount === 1 && matchToken) {
        if (tripId) activeTrips.get(matchToken)!.tripId = tripId;
        resolveTrip(matchToken, outcome, "agent_reported");
        return;
      }
      // No matching trip — still report to API so outcome is recorded
      reportOutcome(token, outcome, merchant, "agent_reported", tripId).catch((err) => {
        process.stderr.write(`[BADGE] Failed to report outcome: ${err}\n`);
      });
    }
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 discloses that this tool is for reporting outcomes (implying it's a write operation, not read-only) and mentions timing constraints ('earlier than the 7-second check'), which adds useful context. However, it doesn't cover other behavioral aspects like authentication needs, rate limits, error handling, or what happens after reporting (e.g., data storage effects).

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 concise and well-structured with two sentences. The first sentence states the purpose, and the second provides usage guidelines, with no wasted words. It's front-loaded with the core function, making it easy to understand quickly.

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 the tool's complexity (reporting outcomes with timing constraints), no annotations, and no output schema, the description is reasonably complete. It covers purpose, usage context, and prerequisites. However, it lacks details on behavioral aspects like error cases or system impacts, which could be important for a reporting tool with no structured output documentation.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly (e.g., verification_token from kya_getAgentIdentity, outcome enum meanings). The description doesn't add any parameter-specific semantics beyond what's in the schema, such as explaining how 'merchant' should be formatted or the implications of 'inconclusive' outcomes. Baseline 3 is appropriate when schema does the heavy lifting.

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 tool's purpose: 'Report how the merchant responded when you presented your Badge.' It specifies the action (report) and resource (merchant response to badge presentation), distinguishing it from siblings like kya_reportBadgePresented (which reports presentation) and kya_reportBadgeNotPresented (which reports non-presentation). However, it doesn't explicitly differentiate from kya_reportPurchase, which might also involve merchant interactions.

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 provides explicit usage guidelines: 'Call this after kya_reportBadgePresented when you know whether the merchant accepted or denied you.' It also specifies when to use it: 'Use when Extended Auth is disabled, or to report earlier than the 7-second check.' This clearly defines the context and prerequisites, distinguishing it from alternatives (e.g., not for use with Extended Auth enabled unless reporting early).

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