aga_export_bundle
Package artifacts, receipts, and Merkle proofs for offline verification to ensure tamper-evident continuity and cryptographic attestation.
Instructions
Package artifact + receipts + Merkle proofs for offline verification. (Claim 9)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/export-bundle.ts:6-24 (handler)The main handler function for the `aga_export_bundle` tool. It retrieves the latest artifact, checkpoint, and receipts, generates inclusion proofs, and creates a bundle for offline verification.
export async function handleExportBundle(_args: Record<string, never>, ctx: ServerContext) { const artifact = await ctx.storage.getLatestArtifact(); if (!artifact) return ctx.error('No artifact'); const cp = await ctx.storage.getLatestCheckpoint(); if (!cp) return ctx.error('No checkpoint. Call aga_create_checkpoint first.'); const receipts = await ctx.storage.getReceiptsByArtifact(hashArtifact(artifact)); const batchEvents = await ctx.storage.getEvents(cp.batch_start_sequence, cp.batch_end_sequence); const proofs = receipts .filter(r => r.sequence_number >= cp.batch_start_sequence && r.sequence_number <= cp.batch_end_sequence) .map(r => eventInclusionProof(batchEvents, r.sequence_number)); const bundle = generateBundle(artifact, receipts, proofs, cp, ctx.portalKP); return ctx.json({ success: true, bundle, offline_verifiable: true, receipt_count: receipts.length, proof_count: proofs.length, }); } - src/server.ts:200-205 (registration)The registration of the `aga_export_bundle` tool within the MCP server using the `governedTool` helper.
// 10. aga_export_bundle (governed) governedTool('aga_export_bundle', 'Package artifact + receipts + Merkle proofs for offline verification. (Claim 9)', {}, async () => handleExportBundle({} as any, ctx), );