Skip to main content
Glama

create_note

Create new notes in Obsidian vaults by specifying file paths and content for organized knowledge management.

Instructions

Create a new note in the Obsidian vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath where the note should be created
contentYesContent of the note

Implementation Reference

  • Core handler function that creates a new note by POSTing to the Obsidian Local REST API endpoint or falling back to direct filesystem operations including automatic directory creation.
    private async createNote(notePath: string, content: string): Promise<void> { try { // First try using the Obsidian API await this.api.post(`/vault/${encodeURIComponent(notePath)}`, { content }); } catch (error) { console.warn('API request failed, falling back to file system:', error); // Fallback to file system if API fails const fullPath = path.join(VAULT_PATH, notePath); const dir = path.dirname(fullPath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(fullPath, content, 'utf-8'); } }
  • MCP tool call handler for 'create_note' that performs input validation and delegates to the createNote implementation.
    private async handleCreateNote(args: any) { if (!args?.path || !args?.content) { throw new Error('Path and content are required'); } await this.createNote(args.path, args.content); return { content: [ { type: 'text', text: `Note created successfully at ${args.path}`, }, ], }; }
  • src/index.ts:1146-1162 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and input schema.
    name: 'create_note', description: 'Create a new note in the Obsidian vault', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path where the note should be created', }, content: { type: 'string', description: 'Content of the note', }, }, required: ['path', 'content'], }, },
  • Input schema definition specifying required 'path' and 'content' string parameters for the tool.
    inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path where the note should be created', }, content: { type: 'string', description: 'Content of the note', }, }, required: ['path', 'content'], },

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/newtype-01/obsidian-mcp'

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