Skip to main content
Glama
CommandFactory.cs1.12 kB
using System; using System.Collections.Generic; using UnityEngine; namespace UnityMCP.Client.Editor.Commands { /// <summary> /// Factory for creating commands from code /// </summary> public static class CommandFactory { /// <summary> /// Create a command from code /// </summary> /// <param name="code">The code to parse into a command</param> /// <returns>The command to execute</returns> public static ICommand CreateCommand(string code) { // Parse the code into a command using the CommandParser var commands = CommandParser.Parse(code); // If we got multiple commands, create a composite command if (commands.Count > 1) { return new CompositeCommand(commands); } // If we got a single command, return it if (commands.Count == 1) { return commands[0]; } // If we couldn't parse the code, return a generic command return new GenericCommand(code); } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TSavo/Unity-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server