eval_ruby
Evaluate Ruby code directly inside a live SketchUp session. Use it to run modeling commands and return the last expression as a string.
Instructions
Evaluate arbitrary Ruby code in SketchUp.
Enabled by default; the user can close the gate in the SketchUp
extension's Settings. When closed, the SketchUp side returns JSON-RPC
code -32010 with a user-facing message explaining how to re-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 |