Files
EnglewoodLAB/SKILLS/unity-editor/script-update-or-create.md

1.8 KiB

name, description
name description
script-update-or-create Updates or creates script file with the provided C# code. Does AssetDatabase.Refresh() at the end. Provides compilation error details if the code has syntax errors. Use 'script-read' tool to read existing script files first.

Script / Update or Create

Updates or creates script file with the provided C# code. Does AssetDatabase.Refresh() at the end. Provides compilation error details if the code has syntax errors. Use 'script-read' tool to read existing script files first.

How to Call

HTTP API (Direct Tool Execution)

Execute this tool directly via the MCP Plugin HTTP API:

curl -X POST http://localhost:8080/api/tools/script-update-or-create \
  -H "Content-Type: application/json" \
  -d '{
  "filePath": "string_value",
  "content": "string_value"
}'

With Authorization (if required)

curl -X POST http://localhost:8080/api/tools/script-update-or-create \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
  "filePath": "string_value",
  "content": "string_value"
}'

Input

Name Type Required Description
filePath string Yes The path to the file. Sample: "Assets/Scripts/MyScript.cs".
content string Yes C# code - content of the file.

Input JSON Schema

{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "description": "The path to the file. Sample: \u0022Assets/Scripts/MyScript.cs\u0022."
    },
    "content": {
      "type": "string",
      "description": "C# code - content of the file."
    }
  },
  "required": [
    "filePath",
    "content"
  ]
}

Output

This tool does not return structured output.