eval_ruby
Execute Ruby code inside SketchUp to automate 3D modeling tasks. Returns the last evaluated expression; use a final result.to_json for structured output.
Instructions
Evaluate arbitrary Ruby code in SketchUp.
Disabled by default in the Extension Warehouse build. If disabled, the
SketchUp side returns JSON-RPC code -32010 with a user-facing message
explaining how to enable it. This wrapper surfaces that message as a
plain string so the LLM can repeat it to the user verbatim — without
the [code] prefix that format_error would otherwise add.
Returns the .to_s of the LAST evaluated expression; stdout (puts) is NOT
captured. End scripts with an explicit expression — e.g. a final
result.to_json — to get structured data back. Errors return
"[code] message" with the Ruby exception class and message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Ruby code to evaluate inside SketchUp |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |