Skip to main content
Glama

create_daily_note

Create a daily note in Obsidian for today or a specified date, with optional content and templates to organize your thoughts and tasks.

Instructions

Create today's daily note or a note for a specific date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate in YYYY-MM-DD format (defaults to today)
contentNoInitial content for the daily note
templatePathNoPath to a template note to use (replaces {{date}} placeholder)

Implementation Reference

  • Implementation and registration of the create_daily_note tool.
    // 5. create_daily_note
    server.registerTool(
      "create_daily_note",
      {
        description: "Create today's daily note or a note for a specific date",
        inputSchema: {
          date: z
            .string()
            .optional()
            .describe("Date in YYYY-MM-DD format (defaults to today)"),
          content: z.string().optional().describe("Initial content for the daily note"),
          templatePath: z
            .string()
            .optional()
            .describe("Path to a template note to use (replaces {{date}} placeholder)"),
        },
      },
      async ({ date, content, templatePath }) => {
        try {
          const config = getDailyNoteConfig(vaultPath);
          const targetDate = date ? new Date(date + "T00:00:00") : new Date();
    
          if (isNaN(targetDate.getTime())) {
            return errorResult("Error: Invalid date format. Use YYYY-MM-DD.");
          }
    
          const dateStr = formatDate(targetDate, config.format);
          const folder = config.folder ? `${config.folder}/` : "";
          const notePath = `${folder}${dateStr}.md`;
    
          if (await noteExists(vaultPath, notePath)) {
            return errorResult(`Error: Daily note already exists at '${notePath}'.`);
          }
    
          let finalContent = content ?? "";
    
          if (templatePath) {
            try {
              const templateContent = await readNote(vaultPath, templatePath);
              finalContent = templateContent.replace(/\{\{date\}\}/g, dateStr);
            } catch (err) {
              return errorResult(`Error reading template: ${err instanceof Error ? err.message : String(err)}`);
            }
          }
    
          await writeNote(vaultPath, notePath, finalContent);
          return textResult(`Created daily note at '${notePath}'.`);
        } catch (err) {
          console.error("create_daily_note error:", err);
          return errorResult(`Error creating daily note: ${err instanceof Error ? err.message : String(err)}`);
        }
      },
    );

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/rps321321/obsidian-mcp-pro'

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