Editor MCP tool bindings for viewport and multiplayer helpers. Exposes two tools: ViewportDisplay which configures editor viewport options and returns JSON, and MultiplayerOrchestrate which calls an async orchestrator to manage dedicated server or client instances and returns JSON.
#nullable enable
using System;
using System.ComponentModel;
using System.Threading.Tasks;
namespace Editor.Mcp
{
public static partial class SboxMcpAssistant
{
[McpTool( "pocketknife_viewport_display" )]
public static string ViewportDisplay(
[Description( "Render debug mode: normal, wireframe, roughness, normal_map, lighting_only" )] string? renderMode = null,
[Description( "Projection view: perspective, top, front, left, right" )] string? view = null,
[Description( "Toggle wireframe overlay" )] bool? wireframe = null,
[Description( "Toggle 3D editor grid" )] bool? showGrid = null,
[Description( "Toggle camera post-processing" )] bool? enablePostProcessing = null )
{
try
{
return McpJson.Write( ViewportAndMultiplayerDriver.ConfigureViewport( renderMode, view, wireframe, showGrid, enablePostProcessing ) );
}
catch ( Exception ex )
{
return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "viewport.configure_failed", "Viewport configuration failed.", ex ) );
}
}
[McpTool( "pocketknife_multiplayer_orchestrate" )]
public static async Task<string> MultiplayerOrchestrate(
[Description( "Action: start_dedicated, spawn_client_instance, migrate_host, status" )] string action,
[Description( "Command-line arguments for dedicated server" )] string? serverArgs = null )
{
try
{
var result = await ViewportAndMultiplayerDriver.OrchestrateMultiplayerAsync( action, serverArgs );
return McpJson.Write( result );
}
catch ( Exception ex )
{
return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "multiplayer.orchestrate_failed", "Multiplayer orchestration failed.", ex ) );
}
}
}
}