render_code
Render source code as a syntax-highlighted SVG or PNG image for clear visual presentation on any device.
Instructions
Render source code as a syntax-highlighted image (SVG or PNG). Perfect for AI agents to show code visually to humans on mobile devices.
The output is an SVG string by default (crisp, copyable, small). Set output_format='png' for a raster image (written to a temp file).
Supports 40+ themes including github-dark, github-light, nord, dracula, one-dark-pro, catppuccin, material-theme, and more.
Supports 40+ languages via shiki: TypeScript, Rust, Python, Go, JavaScript, JSX/TSX, CSS, HTML, JSON, YAML, Markdown, SQL, Dockerfile, GraphQL, Ruby, PHP, Java, C/C++, C#, Swift, Kotlin, Scala, Lua, Perl, R, Elixir, Haskell, Zig, Nim, Solidity, Move, TOML, XML, shell/bash, PowerShell, and more.
When you call this tool, include the full code and tell the user the image is being rendered.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The source code to render as an image | |
| language | No | Programming language for syntax highlighting. Auto-detected if omitted. | auto |
| theme | No | Color theme name. Popular: github-dark, github-light, nord, dracula-soft, one-dark-pro, catppuccin-mocha, material-theme, min-dark, solarized-dark, vitesse-dark. | github-dark |
| title | No | Optional title shown in a window title bar (e.g. the filename) | |
| show_line_numbers | No | Show line numbers in the gutter | |
| font_size | No | Font size in pixels | |
| output_format | No | Output format. 'svg' produces crisp, copyable vector output. 'png' produces a raster image saved to a temp file. | svg |
| width | No | Width of the code area in characters. Default: fits the longest line. | |
| padding | No | Padding around the code block in pixels |