Skip to main content
Glama

kya_reportPurchase

Report purchase outcomes using kyaLabs virtual cards to close audit trails. Submit success status, amount, merchant details, and items after each purchase attempt.

Instructions

Report the outcome of a purchase after using a kyaLabs virtual card. Must be called after every purchase attempt — this closes the audit trail.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intent_idYesThe intent_id returned by kya_getCard
successYesWhether the purchase succeeded
actual_amountNoActual amount charged in USD
merchant_nameNoMerchant name as it appeared on the receipt
itemsNoItems purchased (free-form description)
order_confirmationNoOrder confirmation number or ID

Implementation Reference

  • Tool registration for 'kya_reportPurchase' which delegates to the reportPurchase function.
    server.tool(
      "kya_reportPurchase",
      "Report the outcome of a purchase after using a kyaLabs virtual card. Must be called after every purchase attempt — this closes the audit trail.",
      {
        intent_id: z.string().uuid().describe("The intent_id returned by kya_getCard"),
        success: z.boolean().describe("Whether the purchase succeeded"),
        actual_amount: z.number().positive().max(500).optional().describe("Actual amount charged in USD"),
        merchant_name: z.string().max(500).optional().describe("Merchant name as it appeared on the receipt"),
        items: z.string().max(2000).optional().describe("Items purchased (free-form description)"),
        order_confirmation: z.string().max(200).optional().describe("Order confirmation number or ID"),
      },
      async ({ intent_id, success, actual_amount, merchant_name, items, order_confirmation }) => {
        const result = await reportPurchase({
          intent_id,
          success,
          actual_amount,
          merchant_name,
          items,
          order_confirmation,
        });
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
        };
      }
    );
  • The primary implementation of the reportPurchase logic, handling both API and Mock modes.
    export async function reportPurchase(input: ReportPurchaseInput): Promise<object> {
      if (!getStoredConsentKey()) {
        return {
          product_name: "kyaLabs",
          status: "error",
          message: "Not authenticated. Run kya_getAgentIdentity first to activate your agent, or set KYA_API_KEY in your MCP config.",
        };
      }
    
      if (api.isApiMode()) {
        try {
          return await reportViaApi(input);
        } catch (err) {
          return {
            product_name: "kyaLabs",
            status: "error",
            message: err instanceof Error ? err.message : String(err),
          };
        }
      }
    
      return reportViaMock(input);
    }
  • Type definition for the input expected by reportPurchase.
    export interface ReportPurchaseInput {
      intent_id: string;
      success: boolean;
      actual_amount?: number;
      merchant_name?: string;
      items?: string;
      order_confirmation?: string;
    }
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 communicates critical behavioral traits: this is a mandatory post-purchase reporting tool that 'closes the audit trail,' implying it's a write operation with compliance implications. However, it doesn't mention error handling, response format, or authentication requirements.

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 perfectly concise with two sentences that each serve a distinct purpose: stating the tool's function and providing mandatory usage instructions. There's no wasted language, and the most critical information (the mandatory nature of the call) is front-loaded.

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 mutation tool with no annotations and no output schema, the description does well by explaining the mandatory nature and audit trail closure. However, it doesn't describe what happens after reporting (e.g., confirmation, error responses) or potential side effects, leaving some behavioral context incomplete.

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. This meets the baseline expectation when schema coverage is complete.

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 the outcome of a purchase') and resource ('after using a kyaLabs virtual card'), distinguishing it from sibling tools like badge reporting tools. It precisely defines the tool's function beyond just restating the name.

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 instructions: 'Must be called after every purchase attempt' and 'this closes the audit trail.' It clearly indicates when to use this tool (after purchase attempts) and implies when not to use it (for non-purchase activities covered by sibling tools like badge reporting).

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