Skip to content

feat(decopilot): add built-in render_html tool#3206

Open
guitavano wants to merge 1 commit intomainfrom
feat/render-html-builtin-tool
Open

feat(decopilot): add built-in render_html tool#3206
guitavano wants to merge 1 commit intomainfrom
feat/render-html-builtin-tool

Conversation

@guitavano
Copy link
Copy Markdown
Contributor

@guitavano guitavano commented Apr 28, 2026

Summary

  • Adds a new render_html built-in tool that lets the agent render arbitrary HTML inline in the chat via a sandboxed iframe (allow-scripts only, no allow-same-origin)
  • The iframe auto-resizes based on content height via postMessage + ResizeObserver
  • Includes an expand button (visible on hover) that opens a near-fullscreen modal with the rendered HTML and an X button to close
  • Tool is read-only, no server-side execution — HTML is passed through to the frontend

Test plan

  • Start dev server with bun run dev
  • Ask the agent to "render an HTML table" or "show me a bar chart" — verify it calls render_html
  • Verify the HTML renders in a sandboxed iframe inline in the chat
  • Verify the iframe auto-resizes to fit content
  • Hover over the iframe and verify the expand button appears
  • Click expand and verify the near-fullscreen modal opens with the HTML preview
  • Click X to close the modal
  • Verify bun run check and bun run fmt pass

🤖 Generated with Claude Code


Summary by cubic

Adds a built-in render_html tool that lets the agent render HTML inline in chat using a sandboxed iframe. Includes auto-resize and a fullscreen preview; no server-side execution.

  • New Features
    • Introduced render_html tool (read-only) that passes HTML to the client; schema via zod, returns { html }.
    • UI renders HTML in an iframe with sandbox="allow-scripts", auto-resizes via postMessage + ResizeObserver, and adds a hover “expand” button to open a near-fullscreen modal.
    • Wired into the tool registry and assistant message renderer.
    • Updated prompting guidance in constants to suggest render_html for charts, tables, and interactive previews.

Written for commit 106fb88. Summary will update on new commits. Review in cubic

Allows the agent to render arbitrary HTML inline in the chat inside a
sandboxed iframe, without requiring an external MCP server. Useful for
charts, tables, interactive previews, and mini-apps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

Release Options

Suggested: Minor (2.282.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.281.4-alpha.2
🎉 Patch 2.281.5
❤️ Minor 2.282.0
🚀 Major 3.0.0

Current version: 2.281.4-alpha.1

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant