Skip to content

Commit 9b08dcb

Browse files
committed
feat: restructure server instructions into workflow-focused format
- Reorganized instructions from flat bullet list into categorized workflow sections - Emphasized critical script management workflow with numbered steps - Improved readability and scannability for AI agents using the MCP server It doesn't make sense to repeat the fucnction tools, they're already parsed
1 parent 3f37682 commit 9b08dcb

File tree

2 files changed

+50
-36
lines changed

2 files changed

+50
-36
lines changed

MCPForUnity/UnityMcpServer~/src/server.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,32 @@ def _emit_startup():
159159
name="mcp-for-unity-server",
160160
lifespan=server_lifespan,
161161
instructions="""
162-
This server provides tools to interact with the Unity Game Engine Editor.\n\n
163-
Available tools:\n
164-
- `manage_editor`: Controls editor state and queries info.\n
165-
- `execute_menu_item`: Executes, lists and checks for the existence of Unity Editor menu items.\n
166-
- `read_console`: Reads or clears Unity console messages, with filtering options.\n
167-
- `manage_scene`: Manages scenes.\n
168-
- `manage_gameobject`: Manages GameObjects in the scene.\n
169-
- `manage_script`: Manages C# script files.\n
170-
- `manage_asset`: Manages prefabs and assets.\n
171-
- `manage_shader`: Manages shaders.\n
172-
- `reload_domain`: Triggers Unity domain reload to recompile scripts and refresh assemblies.\n\n
173-
Tips:\n
174-
- Always reload the domain after creating or modifying scripts before attempting to use them. Use `reload_domain` immediately after script changes, then check `read_console` for compile errors.\n
175-
- Create prefabs for reusable GameObjects.\n
176-
- Always include a camera and main light in your scenes.\n
177-
- Unless specified otherwise, paths are relative to the project's `Assets/` folder.\n
178-
- After creating or modifying scripts with `manage_script`, allow Unity to recompile; use `read_console` to check for compile errors.\n
179-
- Use `execute_menu_item` for interacting with Unity systems and third party tools like a user would.\n
162+
This server provides tools to interact with the Unity Game Engine Editor.
180163
164+
Important Workflows:
165+
166+
Script Management:
167+
1. After creating or modifying scripts with `manage_script`, ALWAYS call `reload_domain` immediately
168+
2. Wait for Unity to recompile (domain reload is asynchronous)
169+
3. Use `read_console` to check for compilation errors before proceeding
170+
4. Only after successful compilation can new components/types be used
171+
172+
Scene Setup:
173+
- Always include a Camera and main Light (Directional Light) in new scenes
174+
- Create prefabs with `manage_asset` for reusable GameObjects
175+
- Use `manage_scene` to load, save, and query scene information
176+
177+
Path Conventions:
178+
- Unless specified otherwise, all paths are relative to the project's `Assets/` folder
179+
- Use forward slashes (/) in paths for cross-platform compatibility
180+
181+
Console Monitoring:
182+
- Check `read_console` regularly to catch errors, warnings, and compilation status
183+
- Filter by log type (Error, Warning, Log) to focus on specific issues
184+
185+
Menu Items:
186+
- Use `execute_menu_item` when you have read the menu items resource
187+
- This let's you interact with Unity's menu system and third-party tools
181188
"""
182189
)
183190

Server/server.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,32 @@ def _emit_startup():
159159
name="mcp-for-unity-server",
160160
lifespan=server_lifespan,
161161
instructions="""
162-
This server provides tools to interact with the Unity Game Engine Editor.\n\n
163-
Available tools:\n
164-
- `manage_editor`: Controls editor state and queries info.\n
165-
- `execute_menu_item`: Executes, lists and checks for the existence of Unity Editor menu items.\n
166-
- `read_console`: Reads or clears Unity console messages, with filtering options.\n
167-
- `manage_scene`: Manages scenes.\n
168-
- `manage_gameobject`: Manages GameObjects in the scene.\n
169-
- `manage_script`: Manages C# script files.\n
170-
- `manage_asset`: Manages prefabs and assets.\n
171-
- `manage_shader`: Manages shaders.\n
172-
- `reload_domain`: Triggers Unity domain reload to recompile scripts and refresh assemblies.\n\n
173-
Tips:\n
174-
- Always reload the domain after creating or modifying scripts before attempting to use them. Use `reload_domain` immediately after script changes, then check `read_console` for compile errors.\n
175-
- Create prefabs for reusable GameObjects.\n
176-
- Always include a camera and main light in your scenes.\n
177-
- Unless specified otherwise, paths are relative to the project's `Assets/` folder.\n
178-
- After creating or modifying scripts with `manage_script`, allow Unity to recompile; use `read_console` to check for compile errors.\n
179-
- Use `execute_menu_item` for interacting with Unity systems and third party tools like a user would.\n
162+
This server provides tools to interact with the Unity Game Engine Editor.
180163
164+
Important Workflows:
165+
166+
Script Management:
167+
1. After creating or modifying scripts with `manage_script`, ALWAYS call `reload_domain` immediately
168+
2. Wait for Unity to recompile (domain reload is asynchronous)
169+
3. Use `read_console` to check for compilation errors before proceeding
170+
4. Only after successful compilation can new components/types be used
171+
172+
Scene Setup:
173+
- Always include a Camera and main Light (Directional Light) in new scenes
174+
- Create prefabs with `manage_asset` for reusable GameObjects
175+
- Use `manage_scene` to load, save, and query scene information
176+
177+
Path Conventions:
178+
- Unless specified otherwise, all paths are relative to the project's `Assets/` folder
179+
- Use forward slashes (/) in paths for cross-platform compatibility
180+
181+
Console Monitoring:
182+
- Check `read_console` regularly to catch errors, warnings, and compilation status
183+
- Filter by log type (Error, Warning, Log) to focus on specific issues
184+
185+
Menu Items:
186+
- Use `execute_menu_item` when you have read the menu items resource
187+
- This let's you interact with Unity's menu system and third-party tools
181188
"""
182189
)
183190

0 commit comments

Comments
 (0)