faf_init
Create a starter .faf file by specifying project name, goal, and language. Generates a valid FAF YAML without overwriting existing files.
Instructions
Create a starter .faf file with project name, goal, and language. Generates a valid FAF YAML file with all required sections. Will not overwrite an existing file — use faf_discover first to check.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | my-project | |
| goal | No | ||
| language | No | ||
| path | No | project.faf |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:110-149 (handler)The actual implementation of faf_init tool. It's an MCP tool decorated with @mcp.tool() that creates a starter .faf file with project name, goal, and language. Takes parameters: name (default 'my-project'), goal (default ''), language (default ''), path (default 'project.faf'). Checks if file exists to prevent overwrite, generates YAML content with all required sections, writes it to the specified path, and returns success info including absolute path.
@mcp.tool() def faf_init( name: str = "my-project", goal: str = "", language: str = "", path: str = "project.faf", ) -> dict: """Create a starter .faf file with project name, goal, and language. Generates a valid FAF YAML file with all required sections. Will not overwrite an existing file — use faf_discover first to check.""" if os.path.exists(path): return {"success": False, "error": f"File already exists: {path}"} content = f"""faf_version: '2.5.0' project: name: {name} goal: {goal or 'Describe your project goal'} main_language: {language or 'unknown'} stack: frontend: null backend: null database: null testing: null human_context: who: Developers what: {goal or 'What problem does this solve?'} why: Why does this project exist? ai_instructions: priority: Read project.faf first usage: Code-first, minimal explanations preferences: quality_bar: zero_errors commit_style: conventional state: phase: development version: 0.1.0 status: active """ Path(path).write_text(content) return {"success": True, "path": os.path.abspath(path), "message": f"Created {path} — edit to match your project"} - server.py:36-37 (registration)The tool registration mechanism. All tools in this file are registered via the @mcp.tool() decorator on line 39 for faf_read, but faf_init is specifically registered via @mcp.tool() on line 110, which is the decorator that registers it with the FastMCP server instance.
# --- Tools ---