Skip to main content
The built-in code execution tools mirror the MCP templates highlighted in Working with MCP. They let agents run small scripts inside one-off dynos—without maintaining a separate MCP server—using the same execution model as the open-source templates.

Supported runtimes

ToolRuntimeMatching MCP template
code_exec_rubyRuby with Gemfile supportmcp-code-exec-ruby
code_exec_pythonPython with pip packagesmcp-code-exec-python
code_exec_goGo modulesmcp-code-exec-go
code_exec_nodeNode.js with npm packagesmcp-code-exec-node
Use the table to decide whether the built-in tool is sufficient or if you need to fork the corresponding template for additional customization.

Usage

Provide the language (python, ruby, node, go) and source code. The tool returns stdout, stderr, and the exit status. Keep executions short—long-running jobs should be promoted to a dedicated dyno or background worker.

Example prompt

Run this Python code that sums numbers 1 through 10.

Best practices

  • Validate input before execution to avoid unintended side effects.
  • Keep scripts idempotent—agents may retry on errors.
  • Log execution metadata (target_app_name, timestamps) for auditing.
  • When you need more control, deploy your own MCP server using the templates above.