Editor/Tools/WorkflowTools.MultiViewSnapshot.cs

Editor tool that exposes a multi-viewport snapshot command for the MCP assistant. It parses parameters (layout, targets, presets, size, filename, include UI), calls MultiViewSnapshotDriver.CaptureMultiView, and returns a JSON-encoded result or a failure with exception info.

File Access
#nullable enable
using System;
using System.ComponentModel;

namespace Editor.Mcp
{
	public static partial class SboxMcpAssistant
	{
		/// <summary>
		/// Captures a token-efficient composite multi-viewport verification snapshot (quad 2x2 grid, vertical 1v1 split,
		/// or horizontal split) stitching synchronized camera angles into a single image canvas using Sandbox.Bitmap.
		/// Supports specialized game-type camera rigs: 'fps' (first-person), 'third_person' (chase), 'isometric' (ARPG),
		/// 'rts' (overhead tactical), and 'sidescroller' (2.5D brawler).
		/// </summary>
		[McpTool( "pocketknife_multiview_snapshot" )]
		public static string MultiViewSnapshot(
			[Description( "Layout mode: 'quad_4view' (2x2 grid), 'split_vertical' (left/right 1v1), 'split_horizontal' (top/bottom)" )] string layout = "quad_4view",
			[Description( "Primary target GameObject name or GUID" )] string? target = null,
			[Description( "Viewport 0 target (if different from primary)" )] string? v0Target = null,
			[Description( "Viewport 0 preset ('fps', 'third_person', 'isometric', 'rts', 'sidescroller')" )] string? v0Preset = null,
			[Description( "Viewport 1 target" )] string? v1Target = null,
			[Description( "Viewport 1 preset" )] string? v1Preset = null,
			[Description( "Viewport 2 target (quad mode)" )] string? v2Target = null,
			[Description( "Viewport 2 preset (quad mode)" )] string? v2Preset = null,
			[Description( "Viewport 3 target (quad mode)" )] string? v3Target = null,
			[Description( "Viewport 3 preset (quad mode)" )] string? v3Preset = null,
			[Description( "Total composite canvas width (256-4096, default 1024)" )] int width = 1024,
			[Description( "Total composite canvas height (256-4096, default 1024)" )] int height = 1024,
			[Description( "Custom destination filename (e.g. 'verification_split.png')" )] string? fileName = null,
			[Description( "Whether to render UI panels in viewports" )] bool includeUi = false )
		{
			try
			{
				var result = MultiViewSnapshotDriver.CaptureMultiView(
					layout,
					target,
					v0Target,
					v0Preset,
					v1Target,
					v1Preset,
					v2Target,
					v2Preset,
					v3Target,
					v3Preset,
					width,
					height,
					fileName,
					includeUi
				);
				return McpJson.Write( result );
			}
			catch ( Exception ex )
			{
				return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "multiview.capture_failed", "Multi-view composite snapshot failed.", ex ) );
			}
		}
	}
}