Editor tool bindings for world-building environment features. It exposes MCP tools that call CreativeEnvironmentDriver methods for tuning environment, lighting, audio, postprocess, clothing, material composition, and physics rigging, returning JSON-wrapped outcomes and catching exceptions.
#nullable enable
using System;
using System.ComponentModel;
namespace Editor.Mcp
{
public static partial class SboxMcpAssistant
{
[McpTool( "pocketknife_environment_tune" )]
public static string EnvironmentTune(
[Description( "Sun elevation pitch degrees" )] float? sunPitch = null,
[Description( "Sun azimuth yaw degrees" )] float? sunYaw = null,
[Description( "Sun hex color" )] string? sunColor = null,
[Description( "Fog density multiplier" )] float? fogDensity = null )
{
try { return McpJson.Write( CreativeEnvironmentDriver.TuneEnvironment( sunPitch, sunYaw, sunColor, fogDensity ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "env.tune_failed", "Environment tuning failed.", ex ) ); }
}
[McpTool( "pocketknife_lighting_setup" )]
public static string LightingSetup(
[Description( "Type: directional, point, spot" )] string lightType,
[Description( "GameObject name" )] string? name = null,
[Description( "Intensity multiplier" )] float intensity = 1.0f,
[Description( "Light hex color" )] string color = "#FFFFFF" )
{
try { return McpJson.Write( CreativeEnvironmentDriver.SetupLighting( lightType, name, intensity, color ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "light.setup_failed", "Lighting setup failed.", ex ) ); }
}
[McpTool( "pocketknife_audio_setup" )]
public static string AudioSetup(
[Description( "Type: sound_point, soundscape, listener" )] string audioType,
[Description( "Path to .sound asset" )] string? soundAsset = null,
[Description( "Volume (0.0 - 1.0)" )] float volume = 1.0f )
{
try { return McpJson.Write( CreativeEnvironmentDriver.SetupAudio( audioType, soundAsset, volume ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "audio.setup_failed", "Audio setup failed.", ex ) ); }
}
[McpTool( "pocketknife_postprocess_tune" )]
public static string PostprocessTune(
[Description( "Effect: bloom, vignette, color_adjustments, depth_of_field" )] string effect,
[Description( "Enable or disable" )] bool enabled = true,
[Description( "Intensity factor" )] float intensity = 1.0f )
{
try { return McpJson.Write( CreativeEnvironmentDriver.TunePostprocess( effect, enabled, intensity ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "postprocess.tune_failed", "Postprocess tuning failed.", ex ) ); }
}
[McpTool( "pocketknife_clothing_manage" )]
public static string ClothingManage(
[Description( "Target avatar GameObject name" )] string targetAvatar,
[Description( "Action: list, equip, unequip, clear" )] string action = "list",
[Description( "Path to .clothing asset" )] string? clothingAsset = null )
{
try { return McpJson.Write( CreativeEnvironmentDriver.ManageClothing( targetAvatar, action, clothingAsset ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "clothing.manage_failed", "Clothing management failed.", ex ) ); }
}
[McpTool( "pocketknife_material_compose" )]
public static string MaterialCompose(
[Description( "Destination .vmat path" )] string outputPath,
[Description( "Shader path" )] string shader = "shaders/complex.shader",
[Description( "Base color hex" )] string color = "#FFFFFF" )
{
try { return McpJson.Write( CreativeEnvironmentDriver.ComposeMaterial( outputPath, shader, color ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "material.compose_failed", "Material composition failed.", ex ) ); }
}
[McpTool( "pocketknife_physics_rig" )]
public static string PhysicsRig(
[Description( "Chassis GameObject name" )] string chassisGameObject,
[Description( "Rig type: vehicle_4w, ragdoll, turret" )] string rigType = "vehicle_4w" )
{
try { return McpJson.Write( CreativeEnvironmentDriver.RigPhysics( chassisGameObject, rigType ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "physics.rig_failed", "Physics rigging failed.", ex ) ); }
}
}
}