/** * In-band x402 metadata helpers for the MCP transport (x402 v2 MCP spec). * * The x402 v2 MCP transport signals payments *in band* via the MCP tool-call * machinery instead of HTTP status codes / headers: * * - The client sends the `PaymentPayload` in the request params * `_meta["x402/payment"]` (plain JSON). * - The server returns the settlement receipt in the response * `_meta["x402/payment-response"]` (plain JSON). * - Payment-required is signalled as a tool result with `isError: true` whose * `structuredContent` carries the `PaymentRequired` object and whose * `content[0].text` is the JSON-stringified copy of it. * * Nevermined-specific observability (txHash, creditsRedeemed, …) is kept under * a namespaced `_meta["nevermined/credits"]` key so it never collides with the * spec-defined keys. */ /** Spec-defined JSON-RPC `_meta` keys (x402 v2 MCP transport). */ export declare const X402_PAYMENT_META_KEY = "x402/payment"; export declare const X402_PAYMENT_RESPONSE_META_KEY = "x402/payment-response"; /** Nevermined-namespaced observability key (NOT part of the x402 spec). */ export declare const NEVERMINED_CREDITS_META_KEY = "nevermined/credits"; /** * Read the in-band x402 payment payload from the current request's `_meta`. * * The MCP TS SDK exposes the incoming request `_meta` on the tool handler's * `extra` argument (`extra._meta`), and its schema is a passthrough object, so * non-standard keys like `"x402/payment"` survive parsing. * * @param extra - The MCP handler `extra` argument. * @returns The decoded PaymentPayload object, or `undefined` when absent. */ export declare function readPaymentPayload(extra: any): Record | undefined; /** * Build a spec-shaped payment-required tool result. * * Per the x402 v2 MCP transport, payment-required is an *error* tool result * that carries the `PaymentRequired` object in BOTH `structuredContent` (the * object) and `content[0].text` (the JSON-stringified copy, for clients that * cannot read structured content). * * @param paymentRequired - The `PaymentRequired` object. * @returns A `CallToolResult`-shaped object with `isError: true`. */ export declare function paymentRequiredResult(paymentRequired: Record): { isError: boolean; structuredContent: Record; content: { type: "text"; text: string; }[]; }; //# sourceMappingURL=meta.d.ts.map