Skip to main content
Glama

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
NameRequiredDescriptionDefault
queryYesSearch query for note title or content

Implementation Reference

  • 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}`,
            },
          ],
        };
      }
  • 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'],
      },
    },

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