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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of notes to return (default: 10) |
Implementation Reference
- src/index.ts:1192-1256 (handler)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}`, }, ], }; }
- src/index.ts:149-161 (schema)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)', }, }, }, },