Skip to main content
Glama

kya_reportBadgePresented

Report badge presentation to a merchant for transaction recording in the kyaLabs system. Use after merging checkoutPatch into checkout payload to track shopping sessions.

Instructions

Report that you presented your Badge to a merchant. Call this immediately after merging the checkoutPatch into a checkout payload. Required for kyaLabs to record the trip.

When Extended Auth is enabled, kyaLabs checks back 7 seconds later. Otherwise, call kya_reportBadgeOutcome when you know the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verification_tokenYesThe verification_token returned by kya_getAgentIdentity
merchantNoThe merchant name (e.g., 'starbucks.com'). Provide merchantUrl or merchant.
merchantUrlNoThe merchant base URL (e.g., 'https://starbucks.com'). Preferred over merchant.
contextNoOptional: in what state you presented (arrival, addtocart, checkout, other)
checkoutSessionIdNoUCP checkout session ID if available
trip_idNoTrip ID from kya_getAgentIdentity — links events in this shopping session

Implementation Reference

  • The handler function for kya_reportBadgePresented that logs the badge presentation.
    export async function handleReportBadgePresented(
      verification_token: string,
      merchant: string,
      context?: "arrival" | "addtocart" | "checkout" | "other",
      checkoutSessionId?: string,
      tripId?: string
    ): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      onIdentityPresented(verification_token, merchant, tripId);
      await reportBadgePresented(verification_token, merchant, context, checkoutSessionId, tripId);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ recorded: true }),
          },
          {
            type: "text",
            text: [
              `✓ Badge presentation logged at ${merchant}`,
              ``,
              `  Token:    ${verification_token.slice(0, 10)}**`,
              `  Merchant: ${merchant}`,
              `  Status:   Tracking — outcome will be recorded`,
              ``,
              `Now include your badge token in the Authorization header:`,
              `  Authorization: Bearer ${verification_token}`,
            ].join("\n"),
          },
        ],
      };
    }
  • src/index.ts:66-103 (registration)
    MCP tool registration for kya_reportBadgePresented in src/index.ts.
    server.tool(
      "kya_reportBadgePresented",
      `Report that you presented your Badge to a merchant. Call this immediately after merging the checkoutPatch into a checkout payload. Required for kyaLabs to record the trip.
    
    When Extended Auth is enabled, kyaLabs checks back 7 seconds later. Otherwise, call kya_reportBadgeOutcome when you know the result.`,
      {
        verification_token: z.string().describe(
          "The verification_token returned by kya_getAgentIdentity"
        ),
        merchant: z.string().max(200).optional().describe(
          "The merchant name (e.g., 'starbucks.com'). Provide merchantUrl or merchant."
        ),
        merchantUrl: z.string().max(500).optional().describe(
          "The merchant base URL (e.g., 'https://starbucks.com'). Preferred over merchant."
        ),
        context: z
          .enum(["arrival", "addtocart", "checkout", "other"])
          .optional()
          .describe(
            "Optional: in what state you presented (arrival, addtocart, checkout, other)"
          ),
        checkoutSessionId: z.string().optional().describe(
          "UCP checkout session ID if available"
        ),
        trip_id: z.string().uuid().optional().describe(
          "Trip ID from kya_getAgentIdentity — links events in this shopping session"
        ),
      },
      async ({ verification_token, merchant, merchantUrl, context, checkoutSessionId, trip_id }) => {
        const resolvedMerchant = merchantUrl || merchant;
        if (!resolvedMerchant) {
          return {
            content: [{ type: "text" as const, text: "✗ Error: merchantUrl or merchant is required." }],
          };
        }
        return handleReportBadgePresented(verification_token, resolvedMerchant, context, checkoutSessionId, trip_id);
      }
    );
Behavior4/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 effectively describes key behaviors: the tool is required for recording trips, mentions timing constraints (7-second checkback with Extended Auth), and specifies follow-up actions. However, it doesn't cover potential errors, rate limits, or authentication requirements beyond the verification_token parameter.

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

Conciseness4/5

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

The description is appropriately concise with three sentences that each serve a distinct purpose: stating the tool's function, specifying when to call it, and describing Extended Auth behavior. It's front-loaded with the core purpose and avoids unnecessary elaboration.

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 tool with 6 parameters, 100% schema coverage, and no output schema, the description provides good contextual completeness. It explains the tool's role in the workflow, timing requirements, and relationship to other tools. The main gap is lack of output information, but given the schema coverage and clear behavioral context, it's mostly 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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema descriptions. It mentions the verification_token indirectly through the kya_getAgentIdentity reference but doesn't provide additional semantic context for parameters.

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 that you presented your Badge to a merchant.' It specifies the action (reporting) and resource (Badge presentation), but doesn't explicitly differentiate it from sibling tools like kya_reportBadgeNotPresented or kya_reportBadgeOutcome, which handle different reporting scenarios.

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 immediately after merging the checkoutPatch into a checkout payload.' It also specifies when to use alternatives: 'call kya_reportBadgeOutcome when you know the result' and mentions Extended Auth behavior. This clearly guides the agent on timing and alternative tools.

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