Skip to main content
Glama
bazylhorsey
by bazylhorsey

get_periodic_note_info

Retrieve information about periodic notes from your Obsidian vault, including daily, weekly, monthly, or yearly entries for specific dates.

Instructions

Get info about a periodic note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate (YYYY-MM-DD), defaults to today
typeYesNote type
vaultYesVault name

Implementation Reference

  • Core handler function that computes the periodic note path and title, checks if the file exists in the vault, and returns structured PeriodicNoteInfo or error.
    async getPeriodicNoteInfo(
      vaultPath: string,
      type: PeriodicNoteType,
      date?: Date
    ): Promise<VaultOperationResult<PeriodicNoteInfo>> {
      try {
        const noteDate = date || new Date();
        const notePath = this.getPeriodicNotePath(type, noteDate);
        const fullPath = path.join(vaultPath, notePath);
    
        let exists = false;
        try {
          await fs.access(fullPath);
          exists = true;
        } catch {
          exists = false;
        }
    
        const info: PeriodicNoteInfo = {
          type,
          date: noteDate,
          path: notePath,
          title: this.getPeriodicNoteTitle(type, noteDate),
          exists,
        };
    
        return { success: true, data: info };
      } catch (error) {
        return {
          success: false,
          error: `Failed to get ${type} note info: ${error instanceof Error ? error.message : String(error)}`
        };
      }
    }
  • MCP tool registration with input schema defining parameters: vault (required), type (enum: daily/weekly/monthly/yearly, required), date (optional YYYY-MM-DD).
      name: 'get_periodic_note_info',
      description: 'Get info about a periodic note',
      inputSchema: {
        type: 'object',
        properties: {
          vault: { type: 'string', description: 'Vault name' },
          type: { type: 'string', enum: ['daily', 'weekly', 'monthly', 'yearly'], description: 'Note type' },
          date: { type: 'string', description: 'Date (YYYY-MM-DD), defaults to today' },
        },
        required: ['vault', 'type'],
      },
    },
  • src/index.ts:950-967 (registration)
    Dispatch handler in MCP CallToolRequestSchema that validates vault, parses arguments, calls PeriodicNotesService.getPeriodicNoteInfo, and returns JSON result.
    case 'get_periodic_note_info': {
      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 type = args?.type as 'daily' | 'weekly' | 'monthly' | 'yearly';
      const date = args?.date ? new Date(args.date as string) : undefined;
      const result = await this.periodicNotesService.getPeriodicNoteInfo(
        connector.vaultPath,
        type,
        date
      );
    
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • TypeScript type definitions for input 'type' enum and output PeriodicNoteInfo structure used by the handler.
    export type PeriodicNoteType = 'daily' | 'weekly' | 'monthly' | 'yearly';
    
    export interface PeriodicNoteConfig {
      enabled: boolean;
      folder: string;
      templatePath?: string;
      format: string; // Date format for filename
    }
    
    export interface PeriodicNotesSettings {
      daily: PeriodicNoteConfig;
      weekly: PeriodicNoteConfig;
      monthly: PeriodicNoteConfig;
      yearly: PeriodicNoteConfig;
    }
    
    export interface PeriodicNoteInfo {
      type: PeriodicNoteType;
      date: Date;
      path: string;
      title: string;
      exists: boolean;
    }

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