Editor MCP assistant tools for asset publishing. Defines three static tool entry points (SpriteManage, ShadergraphManage, HotspotManage) that call SpecializedAssetDriver methods and return JSON-wrapped results, with exception handling that returns failure outcomes.
#nullable enable
using System;
using System.ComponentModel;
namespace Editor.Mcp
{
public static partial class SboxMcpAssistant
{
[McpTool( "pocketknife_sprite_manage" )]
public static string SpriteManage(
[Description( "Path to .sprite asset" )] string spritePath,
[Description( "Action: inspect, create, add_animation" )] string action = "inspect",
[Description( "Frame count" )] int frameCount = 1,
[Description( "Playback frame rate (FPS)" )] float frameRate = 12.0f )
{
try { return McpJson.Write( SpecializedAssetDriver.ManageSprite( spritePath, action, frameCount, frameRate ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "sprite.failed", "Sprite operation failed.", ex ) ); }
}
[McpTool( "pocketknife_shadergraph_manage" )]
public static string ShadergraphManage(
[Description( "Path to .shadergraph asset" )] string shaderPath,
[Description( "Action: inspect, create_template, compile" )] string action = "inspect",
[Description( "Template type: lit, unlit, postprocess, ui" )] string templateType = "lit" )
{
try { return McpJson.Write( SpecializedAssetDriver.ManageShaderGraph( shaderPath, action, templateType ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "shadergraph.failed", "ShaderGraph operation failed.", ex ) ); }
}
[McpTool( "pocketknife_hotspot_manage" )]
public static string HotspotManage(
[Description( "Path to .rect hotspot asset" )] string rectPath,
[Description( "Action: inspect, create_rect, apply_to_mesh" )] string action = "inspect",
[Description( "Target mesh GameObject name" )] string? targetMesh = null )
{
try { return McpJson.Write( SpecializedAssetDriver.ManageHotspot( rectPath, action, targetMesh ) ); }
catch ( Exception ex ) { return McpJson.Write( ToolOutcome<object>.Failure( null, ToolStatus.Failed, "hotspot.failed", "Hotspot operation failed.", ex ) ); }
}
}
}