apple-notes-mcp 2.6.7 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/index.js +30 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -211,7 +211,7 @@ Searches for notes by title or content.
|
|
|
211
211
|
| `account` | string | No | Account to search in (defaults to iCloud) |
|
|
212
212
|
| `folder` | string | No | Limit search to a specific folder (supports nested paths like `"Work/Clients"`) |
|
|
213
213
|
| `modifiedSince` | string | No | ISO 8601 date string to filter notes modified on or after this date (e.g., `"2025-01-01"`) |
|
|
214
|
-
| `limit` | number | No | Maximum number of results to return |
|
|
214
|
+
| `limit` | number | No | Maximum number of results to return. **Defaults to 50** — a broad query reads several properties per match via AppleScript (~200ms/note), so an unbounded search over hundreds of matches can exceed Notes' 30s timeout and return an error instead of results. Pass a higher value to see more; the applied limit (and whether it truncated the results) is disclosed in the response. |
|
|
215
215
|
|
|
216
216
|
**Example - Search titles:**
|
|
217
217
|
```json
|
package/build/index.js
CHANGED
|
@@ -39585,7 +39585,8 @@ var AppleNotesManager = class {
|
|
|
39585
39585
|
set modifiedParts to ""
|
|
39586
39586
|
end try
|
|
39587
39587
|
try
|
|
39588
|
-
set
|
|
39588
|
+
set noteContainer to container of n
|
|
39589
|
+
set noteFolder to name of noteContainer
|
|
39589
39590
|
on error
|
|
39590
39591
|
set noteFolder to "Notes"
|
|
39591
39592
|
end try
|
|
@@ -41848,6 +41849,22 @@ function resolveUpdateResponseTitle(currentTitle, newTitle, format, newContent)
|
|
|
41848
41849
|
return newTitle || currentTitle;
|
|
41849
41850
|
}
|
|
41850
41851
|
|
|
41852
|
+
// src/utils/searchLimit.ts
|
|
41853
|
+
var DEFAULT_SEARCH_LIMIT = 50;
|
|
41854
|
+
function resolveSearchLimit(limit) {
|
|
41855
|
+
if (limit !== void 0 && Number.isFinite(limit) && limit > 0) {
|
|
41856
|
+
return Math.floor(limit);
|
|
41857
|
+
}
|
|
41858
|
+
return DEFAULT_SEARCH_LIMIT;
|
|
41859
|
+
}
|
|
41860
|
+
function describeSearchLimit(effectiveLimit, wasDefault, resultCount) {
|
|
41861
|
+
const info = ` (limit: ${effectiveLimit}${wasDefault ? ", default" : ""})`;
|
|
41862
|
+
const truncationNote = resultCount >= effectiveLimit ? `
|
|
41863
|
+
|
|
41864
|
+
\u2139\uFE0F Showing the first ${effectiveLimit}${wasDefault ? " (default limit)" : ""}; there may be more. Narrow the query, filter with \`folder\`/\`modifiedSince\`, or pass a higher \`limit\` to see additional matches.` : "";
|
|
41865
|
+
return { info, truncationNote };
|
|
41866
|
+
}
|
|
41867
|
+
|
|
41851
41868
|
// src/tools/doctor.ts
|
|
41852
41869
|
import { spawnSync } from "child_process";
|
|
41853
41870
|
function runDoctor(manager) {
|
|
@@ -42129,7 +42146,9 @@ server.registerTool(
|
|
|
42129
42146
|
modifiedSince: external_exports.string().max(64).optional().describe(
|
|
42130
42147
|
"ISO 8601 date string to filter notes modified on or after this date (e.g., '2025-01-01'). Useful for searching only recent notes in large collections."
|
|
42131
42148
|
),
|
|
42132
|
-
limit: external_exports.number().int().positive().optional().describe(
|
|
42149
|
+
limit: external_exports.number().int().positive().optional().describe(
|
|
42150
|
+
"Maximum number of results to return. Defaults to 50 \u2014 a broad query reads several properties per match via AppleScript, so an unbounded search can time out. Pass a higher value to see more; the applied limit is disclosed in the response."
|
|
42151
|
+
)
|
|
42133
42152
|
},
|
|
42134
42153
|
outputSchema: {
|
|
42135
42154
|
notes: external_exports.array(external_exports.object({}).passthrough()).optional(),
|
|
@@ -42137,18 +42156,24 @@ server.registerTool(
|
|
|
42137
42156
|
}
|
|
42138
42157
|
},
|
|
42139
42158
|
withErrorHandling(({ query, searchContent = false, account, folder, modifiedSince, limit }) => {
|
|
42159
|
+
const effectiveLimit = resolveSearchLimit(limit);
|
|
42160
|
+
const limitWasDefault = limit === void 0;
|
|
42140
42161
|
const {
|
|
42141
42162
|
result: notes,
|
|
42142
42163
|
syncBefore,
|
|
42143
42164
|
syncInterference
|
|
42144
42165
|
} = withSyncAwarenessSync(
|
|
42145
42166
|
"search-notes",
|
|
42146
|
-
() => notesManager.searchNotes(query, searchContent, account, folder, modifiedSince,
|
|
42167
|
+
() => notesManager.searchNotes(query, searchContent, account, folder, modifiedSince, effectiveLimit)
|
|
42147
42168
|
);
|
|
42148
42169
|
const searchType = searchContent ? "content" : "titles";
|
|
42149
42170
|
const folderInfo = folder ? ` in folder "${folder}"` : "";
|
|
42150
42171
|
const dateInfo = modifiedSince ? ` modified since ${modifiedSince}` : "";
|
|
42151
|
-
const
|
|
42172
|
+
const { info: limitInfo, truncationNote } = describeSearchLimit(
|
|
42173
|
+
effectiveLimit,
|
|
42174
|
+
limitWasDefault,
|
|
42175
|
+
notes.length
|
|
42176
|
+
);
|
|
42152
42177
|
const syncWarnings = [];
|
|
42153
42178
|
if (syncBefore.syncDetected) {
|
|
42154
42179
|
syncWarnings.push(`\u26A0\uFE0F iCloud sync was active during search.`);
|
|
@@ -42176,7 +42201,7 @@ ${syncWarnings.join(" ")}` : "";
|
|
|
42176
42201
|
}).join("\n");
|
|
42177
42202
|
return successResponse(
|
|
42178
42203
|
`Found ${notes.length} notes (searched ${searchType}${folderInfo}${dateInfo}${limitInfo}):
|
|
42179
|
-
${noteList}${syncNote}`,
|
|
42204
|
+
${noteList}${truncationNote}${syncNote}`,
|
|
42180
42205
|
{ notes, count: notes.length }
|
|
42181
42206
|
);
|
|
42182
42207
|
}, "Error searching notes")
|
package/package.json
CHANGED