Skip to main content
Glama
j-shelfwood

Obsidian Local REST API MCP Server

by j-shelfwood

create_or_update_note

Create or update Obsidian notes with content and metadata using an upsert operation that creates new notes or updates existing ones.

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
NameRequiredDescriptionDefault
pathYesPath for the note (without .md extension)
contentYesNote content
frontmatterNoFrontmatter metadata

Implementation Reference

  • The core handler function in the ObsidianApiClient class that executes the tool logic by making a POST request to the Obsidian REST API /notes/upsert endpoint with the provided path, content, and frontmatter.
    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 }), }); }
  • JSON schema defining the input parameters and validation for the create_or_update_note tool: path and content required, frontmatter optional.
    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:327-339 (registration)
    Tool registration in the listTools response, including name, description, and 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"], }, },
  • Dispatch handler in the MCP server's CallToolRequestSchema that routes the tool call 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;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/j-shelfwood/obsidian-local-rest-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server