Skip to main content
Zod schemas and closed-vocabulary types for Glide agent banking. Every schema in this package serves two purposes: it validates data at runtime in TypeScript, and it generates the JSON Schema documents published at glide.co/schemas/agent-banking/draft/* via a build script that converts Zod’s output to JSON Schema 2020-12. The TypeScript schemas are the source of truth. The published JSON Schemas are downstream artifacts — derived, not maintained by hand.

Install

npmjs.com/package/@glideco/schemas

Zod schemas vs. JSON Schemas

The build script at scripts/build-json-schemas.mjs calls Zod’s JSON Schema converter, wraps each output with wrapSchema() to add the canonical $id, and writes both apps/web/public/schemas/ (the served copy) and dist/schemas/ (the standalone artifact). The $id URL is what external consumers should cite — the host is a deployment detail.

Published schema names

Schemas publish at /draft/ URLs until 3+ independent implementers exist. Promotion to /v1/ is an explicit, announced event.

Core schemas

AgentPolicyEnvelope — the 14-axis policy evaluated by @glideco/policy-engine on every agent tool call. Covers amount caps (per-tx, per-day, lifetime), step-up threshold, counterparty allowlist, velocity limits, chain allowlist, geo allowlist, MCC allow/block lists, and an absolute time window. An empty counterparty_allowlist is fail-closed: the engine denies all counterparties. GrantClaims — OAuth 2.0 / RFC 7519 JWT claims with RFC 8707 resource indicators. The aud field carries both vault_id and entity_id (non-standard object form); verifiers must check both. Max TTL is 60 minutes enforced by grantClaimsValidatedSchema. The act (RFC 8693 actor) claim is always required — missing means denied at the verifier. Receipt — the tool-call receipt persisted in activity_log after every money-touching MCP call settles. on_chain_tx is server-fetched from chain RPC, never from a facilitator response body — a money-safety rule inherited from x402.pay client-receipt-trust learnings. AgentScope — closed vocabulary of 15 MCP scopes a grant can carry. Adding a scope is a CODEOWNERS-protected change because the policy-engine evaluator must understand the same set.

Usage

CAIP-2 translation

@glideco/schemas exports chainIdToCaip2() and caip2ToChainId() for translating between Glide’s internal short-ids (eth, sol) and the CAIP-2 wire form that x402, AP2, and ACP protocols carry.
BSC (bsc) is deliberately excluded: USDC on BSC has 18 decimals vs. 6 everywhere else, which would silently underflow amount-in-cents math by 10^12.

Building a JSON Schema for publication

Reading list