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;
///
/// 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";
///
/// 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;
}
}
}