New Features
1. **Robust Script Output Capture**
- **Description**: The `run_script` tool now captures all standard output (e.g., `print` statements) from executed Python scripts in Blender, alongside any user-defined `result` variable, providing comprehensive feedback.
- **Benefit**: Users and AI models can see exactly what a script outputs, not just a success message, enabling better debugging and interaction with Blender’s state.
- **Example**: Running `print("Hello")` and `result = {"key": "value"}` returns:
json
{
"message": "Script executed successfully",
"output": "Hello\n",
"result": {"key": "value"}
}
2. **Animation Rig Data Integration**
- **Description**: Added optional `include_rig_data` and `armature_name` parameters to `run_script`, allowing automatic retrieval of detailed animation rig information (e.g., bone positions, keyframes) without requiring custom scripting.
- **Benefit**: Simplifies access to armature data for animation workflows, reducing the need for complex script logic in AI-driven tasks.
- **Details**: Returns a `rig_data` field with bone counts, positions, and keyframe data for the specified or first armature.
- **Example**: `{"script": "import bpy", "include_rig_data": true, "armature_name": "CharacterRig"}` might return:
json
{
"rig_data": {
"name": "CharacterRig",
"bone_count": 3,
"bones": {...},
"keyframes": {...}
}
}
3. **Enhanced Error Handling**
- **Description**: Script execution errors now include full stack traces in the response, making it easier to diagnose and fix issues.
- **Benefit**: Provides actionable insights into script failures, improving reliability for automated systems and manual debugging.
- **Example**: A syntax error returns:
json
{
"message": "Script execution failed: invalid syntax...\n<full traceback>",
"output": "",
"result": null
}
---
Improvements
- **Script Execution Safety**: Limited the global namespace during script execution to `{bpy, math, random}`, reducing the risk of unintended side effects while maintaining flexibility.
- **Response Structure**: Standardized the `run_script` response to always include `message`, `output`, and `result` fields (plus `rig_data` if requested), ensuring consistent output for parsing.
- **Logging**: Enhanced logging in both the addon and server to track script execution details, stored in `/tmp/blender_mcp_addon.log` and `/tmp/blender_mcp_server.log`.