Editing tools
Surgical statement-level edits and granular inspection of files, methods, statements, directories, and routes. Edits to referenced code fork only the units they touch (copy-on-write) — the canonical stays untouched.
These tools live in the on-demand catalog rather than the default tool list, keeping the connected client's context small. Discover them with search_tools (e.g. search_tools(queries: ["editing"])) and run them with execute_tools — or call them directly if your client has already loaded them.
Save File
save_file
via execute_tools
Finalize a file. Full replacement - call get_file first to update existing files.
Required: uuid, name, type. For significant changes, include context fields: summary, rationale, references, decisions.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the file to save
-
- Name
name- Type
- string
- Required
- required
- Description
-
File name (without extension)
-
- Name
type- Type
- string
- Required
- required
- Description
-
File type: "js" for JavaScript/Vue, others for PHP. Files must be type "test" for run_tests to accept them and type "migration" for run_migration to accept them.
-
- Name
extension- Type
- string
- Description
-
File extension: "vue" for Vue SFCs, "js" for JavaScript
-
- Name
template- Type
- array
- Description
-
Root element UUIDs for Vue <template>
-
- Name
data- Type
- array
- Description
-
Method UUIDs (from create_method)
-
- Name
statements- Type
- array
- Description
-
Statement UUIDs (imports, variables, refs)
-
- Name
includes- Type
- array
- Description
-
File UUIDs for local imports (e.g., Vue components imported by app.js) AND framework class UUIDs/namespaces. CRITICAL: For JS mount files, add imported Vue component UUIDs here or they won't be bundled. Use models array for project models.
-
- Name
models- Type
- array
- Description
-
Project model UUIDs (auto-namespaced). Do NOT duplicate in includes.
-
- Name
frameworkImports- Type
- array
- Description
-
Stellify framework modules to import (e.g., ["Http", "Form", "Collection"]). Auto-generates: import { Http, Form, Collection } from 'stellify-framework';
-
- Name
summary- Type
- string
- Description
-
Context: What this file does and why it exists
-
- Name
rationale- Type
- string
- Description
-
Context: Why it was built this way
-
- Name
references- Type
- array
- Description
-
Context: Related entities [{uuid, type, relationship, note}]
-
- Name
decisions- Type
- array
- Description
-
Context: Design decisions
-
- Name
attributes- Type
- array
- Description
-
PHP 8 class-level attributes (e.g., ["ObservedBy(UserObserver::class)"]). Use search_attributes tool to find available attributes. NOTE: a model's mass-assignable columns are NOT set here — use the dedicated "fillable" param below, which drives the emitted protected $fillable property.
-
- Name
fillable- Type
- array
- Description
-
Model only: mass-assignable column names, rendered as protected $fillable = [...]. Pass the COMPLETE list (full replacement) — e.g. to add "tags" send ["title","body","author","tags"], not just ["tags"]. Omit to leave the existing $fillable untouched.
-
- Name
casts- Type
- object
- Description
-
Model only: attribute cast map rendered as protected $casts = [...], keyed by column name (e.g. {"published_at":"datetime","price":"decimal:2","status":"App\\Enums\\Status"}). Full replacement; omit to leave existing casts untouched.
-
- Name
soft_deletes- Type
- boolean
- Description
-
Model only: whether the model uses the SoftDeletes trait. Omit to leave unchanged.
Save Method
save_method
via execute_tools
Update a method's properties. Use add_method_body to append code.
For significant changes, include context fields: summary, rationale, references, decisions.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the method to update
-
- Name
name- Type
- string
- Description
-
Method name
-
- Name
visibility- Type
- string
- Description
-
Method visibility (PHP only)
-
- Name
is_static- Type
- boolean
- Description
-
Whether the method is static (PHP only)
-
- Name
returnType- Type
- string
- Description
-
Return type (e.g., "int", "string", "void", "object")
-
- Name
nullable- Type
- boolean
- Description
-
Whether the return type is nullable
-
- Name
parameters- Type
- array
- Description
-
Array of parameter clause UUIDs
-
- Name
data- Type
- array
- Description
-
Array of statement UUIDs that form the method body. Use to reorder or remove statements.
-
- Name
is_async- Type
- boolean
- Description
-
Whether the method is async (JavaScript/Vue only). Set to true for methods that use await.
-
- Name
file- Type
- string
- Description
-
UUID of the file that contains this method. Enables copy-on-write when editing a method inside referenced (reused) code — pass it whenever you know it, so the platform forks into your project instead of touching the shared original.
-
- Name
summary- Type
- string
- Description
-
Context: Brief description of what this method does
-
- Name
rationale- Type
- string
- Description
-
Context: Why it was built this way
-
- Name
references- Type
- array
- Description
-
Context: Links to related entities [{uuid, type, relationship, note}]
-
- Name
decisions- Type
- array
- Description
-
Context: Design decisions made
-
- Name
attributes- Type
- array
- Description
-
PHP 8 attributes for the method (e.g., ["Route(\"/api/users\")"], ["Middleware(\"auth\")"]). Use search_attributes tool to find available attributes.
Save Statement
save_statement
via execute_tools
Update an existing statement. Use this to modify statement properties after creation. Always pass the containing method (and file, if known): when the statement lives in reused-by-reference code, this lets the platform fork just the edited statement into your project and leave the shared original untouched. Omitting them still works for statements your project already owns.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the statement to update
-
- Name
data- Type
- object
- Description
-
Statement data to update. Pass the clause-token LIST as {data: ['p-1', '<clause-uuid>', ...]} — that list becomes the statement's tokens.
-
- Name
method- Type
- string
- Description
-
UUID of the method that contains this statement. Enables copy-on-write when editing referenced (reused) code — pass it whenever you know it.
-
- Name
file- Type
- string
- Description
-
UUID of the file that contains the method. Optional extra ancestor context for copy-on-write.
Save Directory
save_directory
via execute_tools
Update an existing directory. Use this to rename or modify directory properties.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the directory to update
-
- Name
name- Type
- string
- Description
-
New directory name
Create Method
create_method
via execute_tools
Create a method in a file. Pass 'body' to include implementation. Async auto-detected from await. For significant methods, include context fields.
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file to add the method to
-
- Name
name- Type
- string
- Required
- required
- Description
-
Method name (e.g., "increment", "store", "handleClick")
-
- Name
visibility- Type
- string
- Description
-
Method visibility (PHP only)
-
- Name
is_static- Type
- boolean
- Description
-
Static method (PHP only)
-
- Name
is_async- Type
- boolean
- Description
-
Async method (JS/Vue). Auto-detected if body contains await.
-
- Name
returnType- Type
- string
- Description
-
Return type (e.g., "int", "string", "void", "object")
-
- Name
nullable- Type
- boolean
- Description
-
Nullable return type (e.g., ?object)
-
- Name
parameters- Type
- array
- Description
-
Method parameters (created as clauses). Include datatype for TypeScript annotations.
-
- Name
body- Type
- string
- Description
-
Method body code. Auto-parses statements.
-
- Name
summary- Type
- string
- Description
-
Context: What this method does
-
- Name
rationale- Type
- string
- Description
-
Context: Why built this way
-
- Name
references- Type
- array
- Description
-
Context: Related entities [{uuid, type, relationship, note}]
-
- Name
decisions- Type
- array
- Description
-
Context: Design decisions
-
- Name
attributes- Type
- array
- Description
-
PHP 8 attributes for the method (e.g., ["Route(\"/api/users\")"], ["Middleware(\"auth\")"]). Use search_attributes tool to find available attributes.
Create Statement
create_statement
via execute_tools
Create empty statement (step 1 of 2). Call add_statement_code next. Prefer create_statement_with_code for single call.
Parameters
-
- Name
file- Type
- string
- Description
-
UUID of the file to add the statement to
-
- Name
method- Type
- string
- Description
-
UUID of the method to add the statement to (for method body statements)
Create Statement with Code
create_statement_with_code
via execute_tools
Create a statement with code in one call. Preferred over two-step create_statement + add_statement_code.
Pass 'types' to specify TypeScript types for variables. The assembler infers the full type from code structure:
ref([])+ type "Todo" → outputsconst todos: Ref<Todo[]>ref(0)+ type "number" → outputsconst count: Ref<number>reactive({})+ type "State" → outputsconst state: State
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file to add the statement to
-
- Name
code- Type
- string
- Required
- required
- Description
-
The code for the statement (e.g., "const count = ref(0);")
-
- Name
method- Type
- string
- Description
-
UUID of the method to add the statement to (optional, for method body statements)
-
- Name
types- Type
- object
- Description
-
Map of variable names to their base TypeScript types (e.g., { "todos": "Todo", "count": "number" }). The assembler infers Ref<>, arrays, etc. from the code structure.
Create Directory
create_directory
via execute_tools
Create a new directory for organizing files.
Common directories:
- 'js' for JavaScript/Vue files
- 'css' for stylesheets
- 'components' for reusable components
IMPORTANT: Check existing directories first using get_project and get_directory before creating new ones.
Parameters
-
- Name
name- Type
- string
- Required
- required
- Description
-
Directory name (e.g., "js", "css", "components")
Add Method Body
add_method_body
via execute_tools
APPEND code to the end of an existing method that already has statements. (For a NEW method use create_method with its 'body' param. To REPLACE / CHANGE what a method does, use replace_method_body — do NOT delete and recreate the method.) Nested code is handled: the parser tracks brace/bracket/paren depth and only splits semicolons at top level, so arrow functions, computed properties etc. stay as single statements. Pass 'types' for TS variable types.
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file containing the method
-
- Name
method- Type
- string
- Required
- required
- Description
-
UUID of the method to add code to
-
- Name
code- Type
- string
- Required
- required
- Description
-
PHP code for the method body (just the statements, no function declaration). Example: "return $a + $b;"
-
- Name
types- Type
- object
- Description
-
Map of variable names to their base TypeScript types (e.g., { "result": "Todo" }). The assembler infers full types from code structure.
Add Statement Code
add_statement_code
via execute_tools
Add code to an existing statement. This is step 2 of 2 - call this AFTER create_statement.
ALTERNATIVE: Use create_statement_with_code for a single-call approach that combines both steps.
The statement must already exist (created via create_statement). This parses and stores the code.
Examples:
- PHP: "use Illuminate\Http\Request;" or "private $items = [];"
- JS/Vue: "const count = ref(0);" or "import { ref } from 'vue';"
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file containing the statement
-
- Name
statement- Type
- string
- Required
- required
- Description
-
UUID of the statement to add code to
-
- Name
code- Type
- string
- Required
- required
- Description
-
The code to add (e.g., "const count = ref(0);")
Replace Method Body
replace_method_body
via execute_tools
Replace what an existing method does — IN PLACE. Clears the method's current statements and re-parses your new code into fresh ones, KEEPING the method's UUID, name and parameters, so file.data, routes and click handlers stay wired. This is the surgical, cheap way to CHANGE a method: do NOT delete_method + create_method (that re-emits the whole method and forces you to re-wire references). Use this whenever you need to modify, fix, or rewrite a method's body.
Works on REFERENCED (reused) code too: pass your project's file uuid and either the canonical method uuid (what assembled views show) or the local placeholder uuid — the platform forks the method into your project via copy-on-write and edits the fork; the canonical original is never touched.
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file containing the method
-
- Name
method- Type
- string
- Required
- required
- Description
-
UUID of the method whose body to replace
-
- Name
body- Type
- string
- Required
- required
- Description
-
The new method body — just the statements, no function declaration. Example: "$q = Article::query(); if ($category) { $q->where('category', $category); } return $q->latest()->paginate();"
Rename Variable
rename_variable
via execute_tools
Rename EVERY occurrence of a variable within one method, atomically. This is the safe way to rename: editing a single variable clause only changes that ONE occurrence (occurrences are independent references, like retyping one occurrence in a text editor), which leaves the others behind and breaks the code. Do NOT stitch a rename together with statement-by-statement edits — use this.
Scoped to the method: other methods using the same variable name are untouched. Parameters are renamed too (keeping their type hints). Works on referenced (reused) code via copy-on-write. Returns counts and warnings — a warning means the variable also appears interpolated inside a string, which is NOT renamed; fix those with replace_method_body or save_clause.
Parameters
-
- Name
method- Type
- string
- Required
- required
- Description
-
UUID of the method to rename the variable in
-
- Name
from- Type
- string
- Required
- required
- Description
-
Current variable name, with or without the leading $ (e.g., "$user" or "user")
-
- Name
to- Type
- string
- Required
- required
- Description
-
New variable name, with or without the leading $
Delete File
delete_file
via execute_tools
Delete a file from the project by UUID. This permanently removes the file and all its methods/statements.
WARNING: This is destructive and cannot be undone. Make sure the file is not referenced elsewhere before deleting.
Parameters
-
- Name
directory- Type
- string
- Description
-
Optional. The platform removes the file from whichever directory lists it, so this is only kept for backwards compatibility.
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the file to delete
Delete Method
delete_method
via execute_tools
Delete a method from a file by UUID. This permanently removes the method and all its code. Requires both the file UUID and method UUID.
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file containing the method (required)
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the method to delete
Delete Statement
delete_statement
via execute_tools
Delete a statement from a file by UUID. This permanently removes the statement (import, variable, ref, etc.).
Parameters
-
- Name
file- Type
- string
- Required
- required
- Description
-
UUID of the file containing the statement
-
- Name
method- Type
- string
- Required
- required
- Description
-
UUID of the method containing the statement (use "file" for file-level statements)
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the statement to delete
Delete Route
delete_route
via execute_tools
Delete a route/page from the project by UUID. This permanently removes the route.
WARNING: This is destructive and cannot be undone. Any elements attached to this route will be deleted also.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the route to delete
Get File
get_file
read-only
via execute_tools
Get a file by UUID with all its metadata, methods, and statements.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the file to retrieve
Get Method
get_method
read-only
via execute_tools
Get a method by UUID. Returns the method data including its parameters and body.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
UUID of the method to retrieve
Get Statement
get_statement
read-only
via execute_tools
Get a statement by UUID. Returns the statement data including its clauses (code tokens).
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
The UUID of the statement to retrieve
Get Route
get_route
read-only
via execute_tools
Get a route/page by UUID. Returns route details including name, path, and attached elements.
Use this to look up a route you created or to find existing routes in the project.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
The UUID of the route to retrieve
Get Directory
get_directory
read-only
via execute_tools
Get a directory by UUID to see its contents.
Use this to inspect directories returned by get_project. The project's data array contains directory UUIDs. Returns the directory name and list of files/subdirectories inside it.
Parameters
-
- Name
uuid- Type
- string
- Required
- required
- Description
-
The UUID of the directory to retrieve