create_or_update_note
Create or update a note in Obsidian via REST API. Specify path, content, and optional frontmatter to insert or modify notes in your vault.
Instructions
Create or update a note with content and frontmatter. Performs upsert operation - creates if doesn't exist, updates if it does.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Note content | |
| frontmatter | No | Frontmatter metadata | |
| path | Yes | Path for the note (without .md extension) |
Implementation Reference
- src/index.ts:130-139 (handler)Core handler function in ObsidianApiClient that executes the create_or_update_note tool logic by sending a POST request to the Obsidian REST API /notes/upsert endpoint.async createOrUpdateNote(path: string, content: string, frontmatter: Record<string, any> = {}) { return this.request("/notes/upsert", { method: "POST", body: JSON.stringify({ path, content, front_matter: frontmatter }), }); }
- src/index.ts:327-339 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: "create_or_update_note", description: "Create or update a note with content and frontmatter. Performs upsert operation - creates if doesn't exist, updates if it does.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Path for the note (without .md extension)" }, content: { type: "string", description: "Note content" }, frontmatter: { type: "object", description: "Frontmatter metadata", default: {} }, }, required: ["path", "content"], }, },
- src/index.ts:476-482 (handler)Dispatch handler in the MCP CallToolRequestSchema that routes calls to create_or_update_note to the client method.case "create_or_update_note": result = await this.client.createOrUpdateNote( args?.path as string, args?.content as string, args?.frontmatter as Record<string, any> ); break;