Skip to content

create_file

MCP tools › Workspace and files

Create a file or folder in the workspace, as New in the project tree does. Refuses invalid names and never overwrites: an existing file or folder of that name is an error. Typed kinds add their extension; java writes a class of the file's name with the package of its folder. text gives the file's content in place of the kind's template. dry_run defaults to true and returns the path and the content it would have, creating nothing; dry_run=false creates it (needs the user-granted write right). Returns the workspace-relative path.

Capabilityworkspace.create_file
AreaWorkspace and files
Accesschanges files
Reaches—
Rightswrite
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
dirrequiredstringWorkspace-relative folder to create it in ("" or "." for the workspace folder).
namerequiredstringName; a/b/c.txt creates the folders on the way. The kind's extension is added when missing.
kindstringOne of file (default), directory, sql, http, java (a class of the file's name in the package of its folder), kotlin, python, typescript, javascript.
textstringThe file's content in place of the kind's template (SPEC-0006 v56 behaviour 10); not for a directory.
dry_runbooleanOnly report what would be created (default true); false creates it, which needs the write right.

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project create_file '{"dir":"<string>","name":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"dir",
"name"
],
"properties": {
"dir": {
"description": "Workspace-relative folder to create it in (\"\" or \".\" for the workspace folder).",
"type": "string"
},
"name": {
"description": "Name; `a/b/c.txt` creates the folders on the way. The kind's extension is added when\nmissing.",
"type": "string"
},
"kind": {
"description": "One of `file` (default), `directory`, `sql`, `http`, `java` (a class of the file's name in\nthe package of its folder), `kotlin`, `python`, `typescript`, `javascript`.",
"type": [
"string",
"null"
]
},
"text": {
"description": "The file's content in place of the kind's template (SPEC-0006 v56 behaviour 10); not for a\ndirectory.",
"type": [
"string",
"null"
]
},
"dry_run": {
"description": "Only report what would be created (default true); false creates it, which needs the\n`write` right.",
"type": [
"boolean",
"null"
]
}
}
}