create_note
Create new notes with Markdown content in Obsidian vaults, supporting nested folder structures and optional overwrite functionality.
Instructions
Create a new note in the Obsidian vault. Supports nested folder creation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path for the new note relative to vault root (e.g., 'folder/note.md') | |
| content | Yes | Content of the note in Markdown format | |
| overwrite | No | If true, overwrite existing note. Default: false |
Implementation Reference
- src/index.ts:435-451 (handler)The handler function that executes the create_note tool: resolves the full path, checks for existence unless overwrite is true, ensures the directory exists, writes the content to the file, and returns a success message.async function handleCreateNote(args: { path: string; content: string; overwrite?: boolean; }): Promise<string> { const fullPath = resolvePath(args.path); if (!args.overwrite && (await fileExists(fullPath))) { throw new Error( `Note already exists at ${args.path}. Use overwrite: true to replace.` ); } await ensureDir(fullPath); await fs.writeFile(fullPath, args.content, "utf-8"); return `Successfully created note at ${args.path}`; }
- src/index.ts:29-48 (schema)The input schema defining parameters for the create_note tool: path (string, required), content (string, required), overwrite (boolean, optional, default false).inputSchema: { type: "object", properties: { path: { type: "string", description: "Path for the new note relative to vault root (e.g., 'folder/note.md')", }, content: { type: "string", description: "Content of the note in Markdown format", }, overwrite: { type: "boolean", description: "If true, overwrite existing note. Default: false", default: false, }, }, required: ["path", "content"], },
- src/index.ts:25-49 (registration)The tool registration entry in the tools array, including name, description, and input schema. This is used for listing available tools.{ name: "create_note", description: "Create a new note in the Obsidian vault. Supports nested folder creation.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Path for the new note relative to vault root (e.g., 'folder/note.md')", }, content: { type: "string", description: "Content of the note in Markdown format", }, overwrite: { type: "boolean", description: "If true, overwrite existing note. Default: false", default: false, }, }, required: ["path", "content"], }, },
- src/index.ts:865-869 (registration)The dispatch case in the tool call handler switch statement that routes 'create_note' calls to the handleCreateNote function.case "create_note": result = await handleCreateNote( args as { path: string; content: string; overwrite?: boolean } ); break;