using System; namespace MCPForUnity.Editor.Tools { /// /// Marks a class as an MCP tool handler /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class McpForUnityToolAttribute : Attribute { /// /// Tool name (if null, derived from class name) /// public string Name { get; set; } /// /// Tool description for LLM /// public string Description { get; set; } /// /// Whether this tool returns structured output /// public bool StructuredOutput { get; set; } = true; /// /// Controls whether this tool is automatically registered with FastMCP. /// Defaults to true so most tools opt-in automatically. Set to false /// for legacy/built-in tools that already exist server-side. /// public bool AutoRegister { get; set; } = true; /// /// Tool group for dynamic visibility on the Python server. /// Core tools are enabled by default; other groups start hidden and /// can be activated per-session via the manage_tools meta-tool. /// Valid groups: core, vfx, animation, ui, scripting_ext, testing, menu. /// Set to null for server meta-tools that should always be visible. /// public string Group { get; set; } = "core"; /// /// Enables the polling middleware for long-running tools. When true, Unity /// should return a PendingResponse and the Python side will poll using /// until completion. /// public bool RequiresPolling { get; set; } = false; /// /// The action name to use when polling for status. Defaults to "status". /// public string PollAction { get; set; } = "status"; /// /// Maximum seconds to poll before timing out. 0 means use the server default. /// Useful for long-running operations like builds. /// public int MaxPollSeconds { get; set; } = 0; /// /// The command name used to route requests to this tool. /// If not specified, defaults to the PascalCase class name converted to snake_case. /// Kept for backward compatibility. /// public string CommandName { get => Name; set => Name = value; } /// /// Create an MCP tool attribute with auto-generated command name. /// The command name will be derived from the class name (PascalCase → snake_case). /// Example: ManageAsset → manage_asset /// public McpForUnityToolAttribute() { Name = null; // Will be auto-generated } /// /// Create an MCP tool attribute with explicit command name. /// /// The command name (e.g., "manage_asset") public McpForUnityToolAttribute(string name = null) { Name = name; } } /// /// Describes a tool parameter /// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public class ToolParameterAttribute : Attribute { /// /// Parameter name (if null, derived from property/field name) /// public string Name { get; } /// /// Parameter description for LLM /// public string Description { get; set; } /// /// Whether this parameter is required /// public bool Required { get; set; } = true; /// /// Default value (as string) /// public string DefaultValue { get; set; } public ToolParameterAttribute(string description) { Description = description; } } }