πŸ“„ display_modal Tool β€” CF Pages Approach

Generated by Justin β€’ 2026-04-05 09:06 PDT

How it works

  1. Agent calls display_modal(title, content, channel)
  2. Tool renders content as a mobile-optimized HTML page
  3. Deploys to CF Pages with a unique short-lived URL
  4. Sends a V2 Container message with:
  5. User taps button β†’ opens in Discord's in-app browser β†’ sees formatted report

Security

Pages deployed to CF Pages under justin.vin β€” only we control the domain.

URLs are unguessable (random hash in path or subdomain).

Content is static HTML β€” no JS needed, no tracking, no cookies.

Optional: Add CF Access (zero-trust) so only Dom's email can view.

Optional: Auto-expire pages after 24h via CF Workers cron.

Message Format

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ“Š Infrastructure Report        β”‚
β”‚ All systems nominal β€” 4 servicesβ”‚
β”‚                                 β”‚
β”‚  [πŸ“– View Full Report]          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The button is a link button (style 5) β€” no interaction handling needed. No "expired" issues. No modal. No extension hooks. Just a URL.

Implementation

  1. Accept markdown content from the agent
  2. Convert to HTML with a dark-themed template
  3. Deploy via wrangler pages deploy (~3s)
  4. Send V2 Container message with link button

βœ… Pros

⚠️ Cons