docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CreateScript

    Handles creation of new C# scripts at specified project paths.

    Inheritance
    object
    CreateScript
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AI.MCP.Editor.Tools
    Assembly: Unity.AI.MCP.Editor.dll
    Syntax
    public static class CreateScript

    Fields

    Description

    Human-readable description of the Unity.CreateScript tool functionality and usage.

    Declaration
    public const string Description = "Create a new C# script at the given project path.\n\nArgs: path (e.g., 'Assets/Scripts/My.cs'), contents (string), script_type, namespace.\nRules: path must be under Assets/. Contents will be Base64-encoded over transport."
    Field Value
    Type Description
    string

    Methods

    GetOutputSchema()

    Returns the output schema for this tool.

    Declaration
    [McpOutputSchema("Unity.CreateScript")]
    public static object GetOutputSchema()
    Returns
    Type Description
    object

    The output schema object defining the structure of successful responses.

    HandleCommand(CreateScriptParams)

    Main handler for script creation.

    Declaration
    [McpTool("Unity.CreateScript", "Create a new C# script at the given project path.\n\nArgs: path (e.g., 'Assets/Scripts/My.cs'), contents (string), script_type, namespace.\nRules: path must be under Assets/. Contents will be Base64-encoded over transport.", null, null, Groups = new string[] { "core", "scripting" })]
    public static object HandleCommand(CreateScriptParams parameters)
    Parameters
    Type Name Description
    CreateScriptParams parameters

    Parameters containing the script path, contents, type, and namespace.

    Returns
    Type Description
    object

    A response object indicating success or failure with relevant details.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)