Skip to main content
Glama

script_create

Create new C# scripts in Unity projects with customizable file names, content, and folder locations to streamline development workflows.

Instructions

Create a new C# script in Unity project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNameYesName of the script file (without .cs extension)
contentNoScript content (optional, will use template if not provided)
folderNoTarget folder path (default: Assets/Scripts)

Implementation Reference

  • Handler function for the 'script_create' tool. Validates required 'fileName' parameter and delegates to UnityHttpAdapter.createScript, returning success message with path and GUID.
    case 'script_create': {
      if (!args.fileName) {
        throw new Error('fileName is required');
      }
      const result = await this.adapter.createScript(args.fileName, args.content, args.folder);
      return {
        content: [{
          type: 'text',
          text: `Script created successfully:\nPath: ${result.path}\nGUID: ${result.guid}`
        }]
      };
    }
  • Input schema defining parameters for script_create: required fileName, optional content and folder.
    inputSchema: {
      type: 'object',
      properties: {
        fileName: {
          type: 'string',
          description: 'Name of the script file (without .cs extension)'
        },
        content: {
          type: 'string',
          description: 'Script content (optional, will use template if not provided)'
        },
        folder: {
          type: 'string',
          description: 'Target folder path (default: Assets/Scripts)'
        }
      },
      required: ['fileName']
  • Tool registration in getTools() array, including name, description, and schema.
    {
      name: 'script_create',
      description: 'Create a new C# script in Unity project',
      inputSchema: {
        type: 'object',
        properties: {
          fileName: {
            type: 'string',
            description: 'Name of the script file (without .cs extension)'
          },
          content: {
            type: 'string',
            description: 'Script content (optional, will use template if not provided)'
          },
          folder: {
            type: 'string',
            description: 'Target folder path (default: Assets/Scripts)'
          }
        },
        required: ['fileName']
      }
    },
  • Helper method in adapter that sends HTTP request to Unity server endpoint 'script/create' with parameters.
    async createScript(fileName: string, content?: string, folder?: string): Promise<any> {
      return this.call('script/create', { fileName, content, folder });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions creation but doesn't specify permissions needed, whether it overwrites existing files, error handling, or what happens upon success. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't cover behavioral aspects like side effects, error cases, or return values, leaving the agent with incomplete context for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond implying creation, which aligns with the baseline score when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new C# script in Unity project'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'shader_create' or 'script_apply_diff' beyond the resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'script_read' or 'script_delete', nor does it mention prerequisites or context for creating scripts. It simply states what the tool does without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/zabaglione/mcp-server-unity'

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