Skip to main content
Glama

get_daily_note

Retrieve today's daily note or access notes for specific dates in your Obsidian vault. Use this tool to quickly find and open dated notes by providing a date in YYYY-MM-DD format.

Instructions

Get today's daily note or a specific date's daily note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate in YYYY-MM-DD format (defaults to today)

Implementation Reference

  • Implementation and registration of the 'get_daily_note' tool, which constructs the daily note path based on configuration and retrieves its content.
    server.registerTool(
      "get_daily_note",
      {
        description: "Get today's daily note or a specific date's daily note",
        inputSchema: {
          date: z
            .string()
            .optional()
            .describe(
              "Date in YYYY-MM-DD format (defaults to today)",
            ),
        },
      },
      async ({ date }) => {
        try {
          const config = getDailyNoteConfig(vaultPath);
          const targetDate = date ?? new Date().toISOString().slice(0, 10);
    
          // Build the filename from the configured format
          // Replace common date tokens with actual date parts
          const [year, month, day] = targetDate.split("-");
          let filename = config.format
            .replace("YYYY", year)
            .replace("MM", month)
            .replace("DD", day);
    
          if (!filename.endsWith(".md")) {
            filename += ".md";
          }
    
          const notePath = config.folder
            ? `${config.folder}/${filename}`
            : filename;
    
          let content: string;
          try {
            content = await readNote(vaultPath, notePath);
          } catch {
            return errorResult(`Daily note not found for ${targetDate} (expected at "${notePath}")`);
          }
    
          const { data: dailyFrontmatter, content: dailyBody } = parseFrontmatter(content);
          const header: string[] = [
            `Daily Note: ${targetDate}`,
            `Path: ${notePath}`,
            "",
          ];
    
          if (Object.keys(dailyFrontmatter).length > 0) {
            header.push("--- Frontmatter ---");
            for (const [key, value] of Object.entries(dailyFrontmatter)) {
              header.push(`${key}: ${JSON.stringify(value)}`);
            }
            header.push("--- End Frontmatter ---");
            header.push("");
          }
    
          return {
            content: [
              { type: "text" as const, text: header.join("\n") + dailyBody },
            ],
          };
        } catch (err) {
          console.error("get_daily_note error:", err);
          return errorResult(`Error reading 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