notes_search_notes
Search macOS Notes app content by title or text to find specific information quickly. Enter a query to locate relevant notes.
Instructions
Search notes by title or content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for note title or content |
Implementation Reference
- src/index.ts:1257-1328 (handler)Handler for notes_search_notes tool: executes AppleScript to search Notes app for notes whose name contains the query string, returns matching note names with modification dates.case 'notes_search_notes': try { const query = (args?.query as string) || ''; if (!query) { return { content: [ { type: 'text', text: 'Error: query is required', }, ], }; } const command = `osascript -e 'on run argv set queryString to item 1 of argv tell application "Notes" set matchingNotes to {} repeat with aNote in notes set noteName to name of aNote if noteName contains queryString then set modDate to modification date of aNote set end of matchingNotes to (noteName & " (Modified: " & (modDate as string) & ")") end if end repeat return matchingNotes as string end tell end run' -- "${query}"`; const { stdout, stderr } = await execAsync(command); if (stderr.trim()) { return { content: [ { type: 'text', text: `Error searching notes: ${stderr.trim()}`, }, ], }; } const output = stdout.trim(); if (!output || output === '') { return { content: [ { type: 'text', text: `No notes found matching "${query}"`, }, ], }; } return { content: [ { type: 'text', text: `Notes matching "${query}":\n${output}`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error executing notes search command: ${error.message}`, }, ], }; }
- src/index.ts:165-174 (schema)Input schema for notes_search_notes: requires a 'query' string parameter.inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for note title or content', }, }, required: ['query'], },
- src/index.ts:162-175 (registration)Tool registration in the ListTools response, including name, description, and schema.{ name: 'notes_search_notes', description: 'Search notes by title or content', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for note title or content', }, }, required: ['query'], }, },