Skip to main content
Glama

notes_search

Search Apple Notes for specific text in titles and bodies, optionally filtering by folder and controlling result details.

Instructions

[Apple Notes operations] Search for notes containing specific text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesText to search for in notes (title and body)
folderNoOptional folder name to search in
limitNoMaximum number of results to return (default: 5)
includeBodyNoWhether to include note body in results (default: true)

Implementation Reference

  • Handler function for notes_search (notes.search) that generates AppleScript to search notes by query in title or body, optionally in a folder, with limit and includeBody options.
    const { query, folder = "", limit = 5, includeBody = true } = args;
    
    if (folder) {
      return `
        tell application "Notes"
          set folderList to folders whose name is "${folder}"
          if length of folderList > 0 then
            set targetFolder to item 1 of folderList
            set matchingNotes to {}
            set allNotes to notes of targetFolder
            repeat with n in allNotes
              if name of n contains "${query}" or body of n contains "${query}" then
                set end of matchingNotes to n
              end if
            end repeat
            
            set resultCount to length of matchingNotes
            if resultCount > ${limit} then set resultCount to ${limit}
            
            set jsonResult to "["
            repeat with i from 1 to resultCount
              set n to item i of matchingNotes
              set noteTitle to name of n
              set noteCreationDate to creation date of n
              set noteModDate to modification date of n
              ${includeBody ? 'set noteBody to body of n' : ''}
              
              set noteJson to "{\\"title\\": \\""
              set noteJson to noteJson & noteTitle & "\\""
              ${includeBody ? 'set noteJson to noteJson & ", \\"body\\": \\"" & noteBody & "\\""' : ''}
              set noteJson to noteJson & ", \\"creationDate\\": \\"" & noteCreationDate & "\\""
              set noteJson to noteJson & ", \\"modificationDate\\": \\"" & noteModDate & "\\"}"
              
              set jsonResult to jsonResult & noteJson
              if i < resultCount then set jsonResult to jsonResult & ", "
            end repeat
            set jsonResult to jsonResult & "]"
            
            return jsonResult
          else
            return "Folder not found: ${folder}"
          end if
        end tell
      `;
    } else {
      return `
        tell application "Notes"
          set matchingNotes to {}
          set allNotes to notes
          repeat with n in allNotes
            if name of n contains "${query}" or body of n contains "${query}" then
              set end of matchingNotes to n
            end if
          end repeat
          
          set resultCount to length of matchingNotes
          if resultCount > ${limit} then set resultCount to ${limit}
          
          set jsonResult to "["
          repeat with i from 1 to resultCount
            set n to item i of matchingNotes
            set noteTitle to name of n
            set noteCreationDate to creation date of n
            set noteModDate to modification date of n
            ${includeBody ? 'set noteBody to body of n' : ''}
            
            set noteJson to "{\\"title\\": \\""
            set noteJson to noteJson & noteTitle & "\\""
            ${includeBody ? 'set noteJson to noteJson & ", \\"body\\": \\"" & noteBody & "\\""' : ''}
            set noteJson to noteJson & ", \\"creationDate\\": \\"" & noteCreationDate & "\\""
            set noteJson to noteJson & ", \\"modificationDate\\": \\"" & noteModDate & "\\"}"
            
            set jsonResult to jsonResult & noteJson
            if i < resultCount then set jsonResult to jsonResult & ", "
          end repeat
          set jsonResult to jsonResult & "]"
          
          return jsonResult
        end tell
      `;
    }
  • Input schema defining parameters for the notes_search tool.
    schema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Text to search for in notes (title and body)"
        },
        folder: {
          type: "string",
          description: "Optional folder name to search in"
        },
        limit: {
          type: "number",
          description: "Maximum number of results to return (default: 5)"
        },
        includeBody: {
          type: "boolean",
          description: "Whether to include note body in results (default: true)"
        }
      },
      required: ["query"]
    }
  • Tool registration in listTools handler where 'notes_search' name is constructed as `${'notes'}_${'search'}`.
      tools: this.categories.flatMap((category) =>
        category.scripts.map((script) => ({
          name: `${category.name}_${script.name}`, // Changed from dot to underscore
          description: `[${category.description}] ${script.description}`,
          inputSchema: script.schema || {
            type: "object",
            properties: {},
          },
        })),
      ),
    }));
  • Dispatch logic in callTool handler that parses 'notes_search' by splitting on '_' to get category 'notes' and script 'search'.
    const [categoryName, ...scriptNameParts] =
      toolName.split("_");
    const scriptName = scriptNameParts.join("_"); // Rejoin in case script name has underscores
  • src/index.ts:35-35 (registration)
    Registration of the notes category containing the search script, which becomes notes_search tool.
    server.addCategory(notesCategory);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Search' implies a read-only operation, the description doesn't specify whether this requires authentication, what happens with empty results, whether there are rate limits, or what the return format looks like. For a search tool with zero annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just one sentence that directly states the tool's purpose. There's no wasted language or unnecessary elaboration, making it highly efficient and front-loaded with the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 4 parameters and no output schema, the description is inadequate. It doesn't explain what the search returns (just notes matching text), doesn't mention search scope (title and body as indicated in schema but not in description), and provides no context about the search behavior or limitations. With no annotations and no output schema, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all four parameters. The description mentions 'specific text' which aligns with the 'query' parameter, but adds no additional semantic context beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Search for notes containing specific text', which includes a specific verb ('Search') and resource ('notes'). It distinguishes from sibling tools like 'notes_list' by specifying search functionality, though it doesn't explicitly differentiate from 'notes_get' which retrieves specific notes by ID rather than searching by content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose this over 'notes_list' (which lists all notes) or 'notes_get' (which retrieves a specific note by ID), nor does it provide any context about prerequisites or exclusions for using this search functionality.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/joshrutkowski/applescript-mcp'

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