create_method
Create a method in a file with optional visibility, static, async, return type, parameters, and body. Includes context fields for summary, rationale, and references.
Instructions
Create a method in a file. Pass 'body' to include implementation. Async auto-detected from await. For significant methods, include context fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | UUID of the file to add the method to | |
| name | Yes | Method name (e.g., "increment", "store", "handleClick") | |
| visibility | No | Method visibility (PHP only) | |
| is_static | No | Static method (PHP only) | |
| is_async | No | Async method (JS/Vue). Auto-detected if body contains await. | |
| returnType | No | Return type (e.g., "int", "string", "void", "object") | |
| nullable | No | Nullable return type (e.g., ?object) | |
| parameters | No | Method parameters (created as clauses). Include datatype for TypeScript annotations. | |
| body | No | Method body code. Auto-parses statements. | |
| summary | No | Context: What this method does | |
| rationale | No | Context: Why built this way | |
| references | No | Context: Related entities [{uuid, type, relationship, note}] | |
| decisions | No | Context: Design decisions | |
| attributes | No | PHP 8 attributes for the method (e.g., ["Route(\"/api/users\")"], ["Middleware(\"auth\")"]). Use search_attributes tool to find available attributes. |