Editor/Mcp/BridgeSceneTools.cs

Editor bridge for scene-related MCP tools. It declares static methods that call McpGate.Run to create, describe, and load .scene files in the s&box editor.

Networking
// AUTO-GENERATED by scripts/emit-mcp-wrappers.mjs — DO NOT EDIT.
// Regenerate: node scripts/extract-manifest.mjs && node scripts/emit-mcp-wrappers.mjs
// Source of truth: sbox-mcp-server/src/tools/ (zod schemas) → scripts/tools-manifest.json

using System.Text.Json.Nodes;
using System.Threading.Tasks;
using Editor.Mcp;

/// <summary>
/// Create and load scene files in the s&amp;box editor. For saving/listing scenes use the built-in
/// scene toolset (save_scene, list_scenes).
/// </summary>
[McpToolset( "bridge_scene", "Create and load scene files in the s&box editor. For saving/listing scenes use the built-in scene toolset (save_scene, list_scenes)." )]
public static class BridgeSceneTools
{
	/// <summary>
	/// Create a new EMPTY .scene file under the project's Assets folder and register it with the
	/// AssetSystem so load_scene works immediately. Errors if the scene already exists. NOTE:
	/// includeDefaults is not yet honored — the scene is always created empty, so after load_scene add
	/// a camera/light/ground yourself (create_gameobject, add_light). Returns a confirmation with the
	/// path — pass it to load_scene next.
	/// </summary>
	/// <param name="path">Relative path for the new scene (e.g. 'scenes/level_01.scene').</param>
	/// <param name="name">Display name for the scene.</param>
	/// <param name="includeDefaults">If true, includes a Camera, Directional Light, and ground plane. Defaults to true.</param>
	[McpTool( "create_scene" )]
	public static Task<object> CreateScene( string path, string name = null, bool? includeDefaults = null )
		=> McpGate.Run( "create_scene", McpGate.Args( ( "path", path ), ( "name", name ), ( "includeDefaults", includeDefaults ) ) );

	/// <summary>
	/// One-call orientation for the OPEN scene (works in edit and play mode): total/root object counts,
	/// component histogram (top 20 types), every camera with position, light count, tag histogram (top
	/// 12), and the aggregate world bounds of renderable content. Returns a structured summary — orient
	/// here, then find_objects by component/tag, get_scene_hierarchy for structure,
	/// find_broken_references for health, screenshot_orbit to look at something. Complements
	/// describe_project (project-level). Read-only.
	/// </summary>
	[McpTool.ReadOnly( "describe_scene" )]
	public static Task<object> DescribeScene()
		=> McpGate.Run( "describe_scene", McpGate.Args() );

	/// <summary>
	/// Open a scene in the s&amp;box editor by its path.
	/// </summary>
	/// <param name="path">Relative path to the .scene file (e.g. 'scenes/main.scene').</param>
	[McpTool( "load_scene" )]
	public static Task<object> LoadScene( string path )
		=> McpGate.Run( "load_scene", McpGate.Args( ( "path", path ) ) );
}