chore(unity): 固定Unity CLI Loop本地包并移除UnitySkills依赖

This commit is contained in:
Liubing\LB
2026-09-28 18:14:59 +08:00
parent 0eb43b2b40
commit c4ae02def9
952 changed files with 70137 additions and 11 deletions

View File

@@ -0,0 +1,39 @@
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Response schema for SetClientName tool
/// Confirms client name registration
/// </summary>
public class SetClientNameResponse : BaseToolResponse
{
/// <summary>
/// Success status message
/// </summary>
public string Message { get; set; }
/// <summary>
/// Registered client name
/// </summary>
public string ClientName { get; set; }
/// <summary>
/// Create a new SetClientNameResponse
/// </summary>
/// <param name="message">Success message</param>
/// <param name="clientName">Registered client name</param>
public SetClientNameResponse(string message, string clientName)
{
Message = message;
ClientName = clientName;
}
/// <summary>
/// Parameterless constructor for JSON deserialization
/// </summary>
public SetClientNameResponse()
{
Message = string.Empty;
ClientName = string.Empty;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34ad7c17767574adfa8666eec6d14a1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System.ComponentModel;
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// Schema for SetClientName command parameters
/// Allows TypeScript clients to register their name for identification
/// </summary>
public class SetClientNameSchema : BaseToolSchema
{
/// <summary>
/// Name of the MCP client tool (e.g., "Claude Code", "Cursor")
/// </summary>
[Description("Name of the MCP client tool")]
public string ClientName { get; set; } = McpConstants.UNKNOWN_CLIENT_NAME;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d753695f81edc481bbf5e993128d68ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace io.github.hatayama.uLoopMCP
{
/// <summary>
/// SetClientName tool handler - Allows MCP clients to register their name
/// This tool is called by TypeScript clients to identify themselves
/// </summary>
[McpTool(
Description = "Register client name for identification in Unity MCP server",
DisplayDevelopmentOnly = true
)]
public class SetClientNameTool : AbstractUnityTool<SetClientNameSchema, SetClientNameResponse>
{
public override string ToolName => "set-client-name";
protected override Task<SetClientNameResponse> ExecuteAsync(SetClientNameSchema parameters, CancellationToken cancellationToken)
{
string clientName = parameters.ClientName;
UpdateClientNameInServer(clientName);
string message = string.Format(McpConstants.CLIENT_SUCCESS_MESSAGE_TEMPLATE, clientName);
SetClientNameResponse response = new SetClientNameResponse(message, clientName);
return Task.FromResult(response);
}
private void UpdateClientNameInServer(string clientName)
{
McpBridgeServer server = McpServerController.CurrentServer;
if (server == null) return;
var connectedClients = server.GetConnectedClients();
if (connectedClients.Count == 0) return;
// Get current client context
var clientContext = JsonRpcProcessor.CurrentClientContext;
if (clientContext == null)
{
return;
}
// Find client by endpoint
ConnectedClient targetClient = connectedClients
.FirstOrDefault(c => c.Endpoint == clientContext.Endpoint);
if (targetClient != null)
{
server.UpdateClientName(targetClient.Endpoint, clientName);
return;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e19ab575b909d4e08a55d200dd4dcc8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: