{
  "name": "Collar Guardrail",
  "description": "Deterministic pre-trade risk layer for autonomous AI trading agents on Robinhood Chain. Returns allow / warn / deny verdicts with the reasons attached and a tamper-evident audit hash. MCP callers are evaluated at a fixed Tier 1 ceiling ($5,000 notional). The per-wallet rate limiter shares a 60-second sliding window across the MCP, demo, and analyze endpoints.",
  "url": "https://api.collarguardrail.com",
  "version": "1.0.2",
  "protocolVersion": "0.3.0",
  "preferredTransport": "HTTP+JSON",
  "provider": {
    "organization": "Collar",
    "url": "https://collarguardrail.com"
  },
  "documentationUrl": "https://collarguardrail.com/agent-docs.html",
  "capabilities": {
    "streaming": false,
    "pushNotifications": false,
    "stateTransitionHistory": false
  },
  "defaultInputModes": ["application/json"],
  "defaultOutputModes": ["application/json"],
  "securitySchemes": {
    "bearer": {
      "type": "http",
      "scheme": "bearer",
      "description": "JWT obtained via EIP-191 wallet signature at /api/v1/auth/wallet."
    },
    "x402": {
      "type": "http",
      "scheme": "x402",
      "description": "$0.01 USDG per call on Robinhood Chain (eip155:4663). No signup. Payment settles via the x402 protocol. Discovery document at /.well-known/x402.json."
    }
  },
  "security": [
    {"bearer": []},
    {"x402": []}
  ],
  "skills": [
    {
      "id": "evaluate_trade",
      "name": "Evaluate a trade",
      "description": "Pre-trade risk check. Returns allow, warn, or deny, with every reason attached and a tamper-evident audit hash. Checks tier limits, oracle/V4 price source, slippage, market hours, cluster rate limits, and daily loss. If check_token_safety returned severity=danger for the contract, this skill automatically returns deny regardless of other checks. If the response contains an 'error' key, no verdict was produced — treat as a hard stop and do not execute the trade.",
      "tags": ["risk", "guardrail", "trading", "compliance"],
      "examples": [
        "Evaluate a 10 NVDA buy from wallet 0x... before signing.",
        "Check if a proposed ETH sell of 5 units crosses any limit."
      ],
      "inputModes": ["application/json"],
      "outputModes": ["application/json"],
      "endpoint": {
        "method": "POST",
        "path": "https://api.collarguardrail.com/api/v1/analyze/trade",
        "requires": "bearer"
      },
      "inputSchema": {
        "type": "object",
        "required": ["wallet", "asset", "side", "amount", "contract_address"],
        "properties": {
          "wallet": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$", "description": "Wallet address the trade would execute from."},
          "asset": {"type": "string", "maxLength": 32, "description": "Asset symbol, e.g. NVDA, AAPL, ETH, USDG."},
          "side": {"type": "string", "enum": ["buy", "sell"]},
          "amount": {"type": "number", "exclusiveMinimum": 0, "description": "Quantity in token units, not USD."},
          "contract_address": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$", "description": "Must match the official registry entry for the symbol."},
          "max_slippage_bps": {"type": "integer", "minimum": 0, "maximum": 1000, "default": 100},
          "request_id": {"type": "string", "description": "Idempotency key, cached 5 minutes."}
        }
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "decision": {"type": "string", "enum": ["allow", "warn", "deny"]},
          "reasons": {"type": "array", "items": {"type": "string"}},
          "tier": {"type": "integer"},
          "max_trade_usd": {"type": "number"},
          "calculated_notional_usd": {"type": "number"},
          "price_usd": {"type": "number"},
          "price_source": {"type": "string", "enum": ["oracle", "uniswap_v4", "fallback_default", "unavailable"]},
          "risk_score": {"type": "integer", "minimum": 0, "maximum": 100},
          "timestamp": {"type": "integer"},
          "request_id": {"type": "string"},
          "audit_hash": {"type": "string"},
          "audit_seq": {"type": "integer"},
          "daily_pnl_usd": {"type": "number"},
          "error": {"type": "string", "description": "If present, no verdict was produced. Treat as a hard stop; do not execute the trade."}
        },
        "anyOf": [
          { "required": ["decision", "reasons", "risk_score"] },
          { "required": ["error"] }
        ]
      }
    },
    {
      "id": "check_token_safety",
      "name": "Check token safety",
      "description": "Honeypot and contract safety check for any ERC-20 token. Returns severity (safe, warn, danger) and the specific risk factors found, using bytecode analysis and a live sell simulation. CRITICAL: when severity=danger, the next evaluate_trade call for the same contract is automatically denied. Use before trading unknown tokens or tokens absent from the official registry. If the response contains an 'error' key, the check failed — do not assume 'safe'.",
      "tags": ["security", "honeypot", "token", "erc20"],
      "examples": [
        "Is contract 0x... a honeypot?",
        "Check this token before I let the agent buy it."
      ],
      "inputModes": ["application/json"],
      "outputModes": ["application/json"],
      "endpoint": {
        "method": "POST",
        "path": "https://api.collarguardrail.com/api/v1/token-safety",
        "requires": "none"
      },
      "inputSchema": {
        "type": "object",
        "required": ["contract_address"],
        "properties": {
          "contract_address": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"}
        }
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "severity": {"type": "string", "enum": ["safe", "warn", "danger"]},
          "is_honeypot": {"type": "boolean"},
          "risk_factors": {"type": "array", "items": {"type": "string"}},
          "owner_renounced": {"type": "boolean"},
          "owner_is_multisig": {"type": "boolean"},
          "sell_simulation": {"type": "object"},
          "error": {"type": "string", "description": "If present, the check failed. Do not assume 'safe'."}
        },
        "anyOf": [
          { "required": ["severity"] },
          { "required": ["error"] }
        ]
      }
    },
    {
      "id": "simulate_balance",
      "name": "Simulate a wallet balance",
      "description": "Read-only state-override simulation of an ERC-20 balance after a hypothetical trade. No transaction is sent. If the response contains an 'error' key, the simulation failed.",
      "tags": ["simulation", "balance", "erc20"],
      "inputModes": ["application/json"],
      "outputModes": ["application/json"],
      "endpoint": {
        "method": "POST",
        "path": "https://api.collarguardrail.com/api/v1/simulate-balance",
        "requires": "none"
      },
      "inputSchema": {
        "type": "object",
        "required": ["token_address", "holder", "delta"],
        "properties": {
          "token_address": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"},
          "holder": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"},
          "delta": {"type": "number", "description": "Signed amount. Negative = spend."},
          "balance_slot": {"type": "integer", "minimum": 0, "maximum": 64},
          "decimals": {"type": "integer", "minimum": 0, "maximum": 36, "default": 18}
        }
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "token_address": {"type": "string"},
          "holder": {"type": "string"},
          "balance_slot": {"type": "integer"},
          "current": {"type": "number"},
          "delta": {"type": "number"},
          "post_trade": {"type": "number"},
          "error": {"type": "string", "description": "If present, the simulation failed."}
        },
        "anyOf": [
          { "required": ["current", "delta", "post_trade"] },
          { "required": ["error"] }
        ]
      }
    },
    {
      "id": "get_supported_assets",
      "name": "List supported assets",
      "description": "The official Robinhood Chain asset registry with canonical contract addresses. Resolve a symbol correctly before calling evaluate_trade.",
      "tags": ["registry", "assets", "robinhood-chain"],
      "inputModes": ["application/json"],
      "outputModes": ["application/json"],
      "endpoint": {
        "method": "GET",
        "path": "https://api.collarguardrail.com/api/v1/assets",
        "requires": "none"
      },
      "inputSchema": {
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "symbol": {"type": "string"},
            "contract_address": {"type": "string"},
            "is_native": {"type": "boolean"}
          }
        }
      }
    },
    {
      "id": "verify_audit_trail",
      "name": "Verify audit trail",
      "description": "Recompute every past decision's SHA-256 hash and verify the hash-chain links. Proves no decision was edited, deleted, or reordered. If the response contains an 'error' key, verification could not run.",
      "tags": ["audit", "verification", "compliance"],
      "inputModes": ["application/json"],
      "outputModes": ["application/json"],
      "endpoint": {
        "method": "GET",
        "path": "https://api.collarguardrail.com/api/v1/audit/verify/{wallet}",
        "requires": "none"
      },
      "inputSchema": {
        "type": "object",
        "required": ["wallet"],
        "properties": {
          "wallet": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"},
          "limit": {"type": "integer", "minimum": 1, "maximum": 1000, "default": 100}
        }
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "wallet": {"type": "string"},
          "total": {"type": "integer"},
          "tampered": {"type": "integer"},
          "healthy": {"type": "boolean"},
          "records": {"type": "array", "items": {"type": "object"}},
          "error": {"type": "string", "description": "If present, verification could not run."}
        },
        "anyOf": [
          { "required": ["healthy"] },
          { "required": ["error"] }
        ]
      }
    }
  ]
}
