Skip to main content
Glama

create_monthly_note

Create a monthly note for your Obsidian vault with template variables, organizing your monthly planning and documentation in one centralized location.

Instructions

Create a monthly note for a specific date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate in the month (YYYY-MM-DD), defaults to this month
variablesNoAdditional template variables
vaultYesVault name

Implementation Reference

  • Tool schema definition including name, description, and input schema for create_monthly_note, part of the tools list returned by listTools.
    { name: 'create_monthly_note', description: 'Create a monthly note for a specific date', inputSchema: { type: 'object', properties: { vault: { type: 'string', description: 'Vault name' }, date: { type: 'string', description: 'Date in the month (YYYY-MM-DD), defaults to this month' }, variables: { type: 'object', description: 'Additional template variables' }, }, required: ['vault'], }, },
  • Dispatch handler in the MCP CallToolRequestSchema that extracts parameters and calls PeriodicNotesService.createPeriodicNote with type 'monthly'.
    case 'create_monthly_note': { const connector = this.connectors.get(args?.vault as string); if (!connector || !connector.vaultPath) { throw new Error(`Vault "${args?.vault}" not found or not a local vault`); } const date = args?.date ? new Date(args.date as string) : undefined; const result = await this.periodicNotesService.createPeriodicNote( connector.vaultPath, 'monthly', date, args?.variables as Record<string, any> | undefined ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Core handler function createPeriodicNote in PeriodicNotesService that implements the logic for creating monthly notes (when type='monthly'). Handles path generation, template rendering (if configured), default content generation, and file creation.
    async createPeriodicNote( vaultPath: string, type: PeriodicNoteType, date?: Date, variables?: Record<string, any> ): Promise<VaultOperationResult<string>> { try { const noteDate = date || new Date(); const config = this.settings[type]; if (!config.enabled) { return { success: false, error: `${type} notes are not enabled` }; } // Generate note path const notePath = this.getPeriodicNotePath(type, noteDate); const fullPath = path.join(vaultPath, notePath); // Check if note already exists try { await fs.access(fullPath); return { success: true, data: notePath }; // Already exists } catch { // Note doesn't exist, continue to create } // Ensure directory exists await fs.mkdir(path.dirname(fullPath), { recursive: true }); let content: string; // Use template if specified if (config.templatePath) { const renderResult = await this.templateService.renderTemplate( vaultPath, config.templatePath, { targetPath: notePath, variables: { ...this.getPeriodicNoteVariables(type, noteDate), ...variables, }, } ); if (!renderResult.success || !renderResult.data) { return { success: false, error: renderResult.error }; } content = renderResult.data.content; } else { // Generate default content content = this.generateDefaultContent(type, noteDate); } // Write file await fs.writeFile(fullPath, content, 'utf-8'); return { success: true, data: notePath }; } catch (error) { return { success: false, error: `Failed to create ${type} note: ${error instanceof Error ? error.message : String(error)}` }; }

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/bazylhorsey/obsidian-mcp-server'

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