execute_csharp
Execute C# code dynamically in the Unity Editor context. The code has access to UnityEngine, UnityEditor, and project assemblies.
分類: コード
| 名前 | 型 | 必須 | 既定値 | 説明 |
|---|---|---|---|---|
code |
string | 必須 | C# statements or a full script. Include statement semicolons and use ‘return value;’ to return results. Compiler and runtime failures are returned as errors without retrying the script. | |
timeout_ms |
integer | 5000 |
Maximum execution time in milliseconds | |
include_usings |
array | [] |
Additional using statements to include | |
force_roslyn |
boolean | false |
Force Roslyn compilation mode, disable fallback to reflection. Use for multi-statement code with var declarations. |
呼び出しの例
Section titled “呼び出しの例”必須の引数だけを入れています。ほかは必要に応じて足してください。
{ "name": "execute_csharp", "arguments": { "code": "…" }}SuperSave モードでは
Section titled “SuperSave モードでは”Unity を NANORA_MCP_SUPERSAVE=1 で起動したときは、メタツール execute から {"tool": "execute_csharp", "args": { … }} の形で呼びます。SuperSave モードを参照。
Assets/NanoraUnityMCP/Editor/Tools/ExecuteCSharpTool.cs(版 1.2.1)から生成しています。説明文はツール定義のまま(英語)です。AI クライアントは tools/list で同じスキーマを受け取ります。