eval_ruby
Execute Ruby code inside SketchUp to automate 3D modeling, manipulate geometry, and retrieve model data. Returns the last evaluated expression's string output for direct use.
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 |