create_directory_script
Saves supplied Lua code to a user-selected project directory under scripts/ or drafts/, creating parent folders and replacing the target file.
Instructions
Save supplied Lua code under a user-selected project directory. Inputs: directory (required string, project root path); file_name (required string, relative .lua path); code (required string, complete Lua source); sync (optional boolean, default true: choose scripts/; false: choose drafts/). An initial scripts/ or drafts/ prefix matching the selected section is accepted. Effects: creates parent folders and atomically replaces the file without a backup; does not prepare metadata, validate, or directly upload. Returns: resolved directory, root-relative file_name, absolute path, sync selection, and bytes.
Context: Preferred when the user supplies a local directory path. Use create_project_script for a named MCP-managed project or create_script for the MCP root's scripts/. sync selects where to save; it does not call Code Sync. Validate with validate_directory_script, then preview_directory_sync and connect_sync or sync_directory. An already-running matching watcher may upload the saved file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| sync | No | ||
| directory | Yes | ||
| file_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||