Skip to main content
Glama

notes_get_recent_notes

Retrieve recently modified notes from macOS Notes app to access updated content quickly.

Instructions

Get recently modified notes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of notes to return (default: 10)

Implementation Reference

  • The handler logic for the 'notes_get_recent_notes' tool. It constructs and executes an AppleScript command via osascript to retrieve up to 'limit' (default 10) most recent notes from the macOS Notes app, including name and modification date, and returns formatted text output.
    case 'notes_get_recent_notes':
      try {
        const limit = (args?.limit as number) || 10;
        
        const command = `osascript -e 'on run argv
          set numLimit to (item 1 of argv) as number
          tell application "Notes"
            set recentNotes to {}
            set noteCount to 0
            repeat with aNote in notes
              if noteCount < numLimit then
                set noteName to name of aNote
                set modDate to modification date of aNote
                set end of recentNotes to (noteName & " (Modified: " & (modDate as string) & ")")
                set noteCount to noteCount + 1
              end if
            end repeat
            return recentNotes as string
          end tell
        end run' -- ${limit}`;
        
        const { stdout, stderr } = await execAsync(command);
        
        if (stderr.trim()) {
          return {
            content: [
              {
                type: 'text',
                text: `Error getting recent notes: ${stderr.trim()}`,
              },
            ],
          };
        }
        
        const output = stdout.trim();
        if (!output || output === '') {
          return {
            content: [
              {
                type: 'text',
                text: 'No notes found',
              },
            ],
          };
        }
        
        return {
          content: [
            {
              type: 'text',
              text: `Recent Notes (limit: ${limit}):\n${output}`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error executing recent notes command: ${error.message}`,
            },
          ],
        };
      }
  • The tool schema definition, including name, description, and inputSchema with optional 'limit' parameter of type number.
    {
      name: 'notes_get_recent_notes',
      description: 'Get recently modified notes',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of notes to return (default: 10)',
          },
        },
      },
    },
  • src/index.ts:149-161 (registration)
    Registration of the tool in the ListTools response, where it is listed among available tools with its schema.
    {
      name: 'notes_get_recent_notes',
      description: 'Get recently modified notes',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of notes to return (default: 10)',
          },
        },
      },
    },

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/samicokar/mcp-mac'

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