Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe source code to render as an image
languageNoProgramming language for syntax highlighting. Auto-detected if omitted.auto
themeNoColor 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
titleNoOptional title shown in a window title bar (e.g. the filename)
show_line_numbersNoShow line numbers in the gutter
font_sizeNoFont size in pixels
output_formatNoOutput format. 'svg' produces crisp, copyable vector output. 'png' produces a raster image saved to a temp file.svg
widthNoWidth of the code area in characters. Default: fits the longest line.
paddingNoPadding around the code block in pixels
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite no annotations, the description discloses key behaviors: default output is SVG string, PNG saves to temp file, supports 40+ themes and languages. It does not mention side effects or rate limits, but these are unlikely for a render tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear first sentence followed by bullet-like lists of themes and languages. It is concise but includes all necessary details without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (9 parameters, no output schema), the description covers essential aspects: output format, supported themes/languages, and usage guidance. It lacks mention of return value structure but that is acceptable without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds context about output format behavior but does not significantly enhance parameter meaning beyond the schema definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool renders source code as a syntax-highlighted image (SVG or PNG) for showing code visually to humans. It distinguishes from sibling tool 'render_diff' by focusing on code rather than diffs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: 'Perfect for AI agents to show code visually to humans on mobile devices' and instructs to include full code and notify the user. It could explicitly compare with 'render_diff' but overall offers good guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thesimonharms/code-shot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server