Skip to main content
Glama
ailenshen

Apple Notes MCP Server

search_notes

Find Apple Notes by searching titles and content snippets with keywords. Retrieve matching notes and their metadata for quick access.

Instructions

Search Apple Notes by keyword. Searches in title and snippet. Returns matching notes with metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keyword
limitNoMax number of results

Implementation Reference

  • src/db.ts:76-95 (handler)
    The core business logic that queries the SQLite database to find notes matching the query string in title or snippet.
    export function searchNotes(query: string, limit?: number): NoteRow[] {
      const db = getDb();
      const likePattern = `%${query}%`;
      let sql = LIST_QUERY.replace(
        "ORDER BY",
        `AND (n.ZTITLE1 LIKE ? OR n.ZSNIPPET LIKE ?) ORDER BY`
      );
      const params: unknown[] = [likePattern, likePattern];
    
      if (limit) {
        sql += ` LIMIT ?`;
        params.push(limit);
      }
    
      const rows = db.prepare(sql).all(...params) as NoteRow[];
      return rows.map((r) => ({
        ...r,
        is_pinned: Boolean(r.is_pinned),
      }));
    }
  • src/index.ts:42-60 (registration)
    The MCP tool registration and handler wrapper for 'search_notes', which calls the database function defined in db.ts.
    // --- search_notes ---
    server.tool(
      "search_notes",
      "Search Apple Notes by keyword. Searches in title and snippet. Returns matching notes with metadata.",
      {
        query: z.string().describe("Search keyword"),
        limit: z.number().optional().describe("Max number of results"),
      },
      async ({ query, limit }) => {
        try {
          const notes = searchNotes(query, limit);
          return {
            content: [{ type: "text", text: JSON.stringify(notes, null, 2) }],
          };
        } catch (e: unknown) {
          return {
            content: [{ type: "text", text: `Error: ${(e as Error).message}` }],
            isError: true,
          };

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/ailenshen/apple-notes-mcp'

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