obsidian-mcp-server 3.7.0 → 3.7.1
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/AGENTS.md +15 -7
- package/CLAUDE.md +15 -7
- package/Dockerfile +3 -3
- package/README.md +9 -6
- package/changelog/3.7.x/3.7.1.md +40 -0
- package/dist/config/server-config.js +1 -1
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +13 -32
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +20 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +40 -0
- package/dist/instructions.js.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +39 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +60 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +127 -116
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +6 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +12 -4
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +3 -3
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +20 -16
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +6 -4
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +4 -2
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +4 -2
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +26 -2
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +46 -14
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +21 -4
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -1
- package/dist/services/obsidian/frontmatter-ops.d.ts +15 -1
- package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -1
- package/dist/services/obsidian/frontmatter-ops.js +55 -10
- package/dist/services/obsidian/frontmatter-ops.js.map +1 -1
- package/dist/services/obsidian/jsonlogic-evaluator.d.ts +83 -0
- package/dist/services/obsidian/jsonlogic-evaluator.d.ts.map +1 -0
- package/dist/services/obsidian/jsonlogic-evaluator.js +192 -0
- package/dist/services/obsidian/jsonlogic-evaluator.js.map +1 -0
- package/dist/services/obsidian/jsonlogic-worker.d.ts +53 -0
- package/dist/services/obsidian/jsonlogic-worker.d.ts.map +1 -0
- package/dist/services/obsidian/jsonlogic-worker.js +237 -0
- package/dist/services/obsidian/jsonlogic-worker.js.map +1 -0
- package/dist/services/obsidian/obsidian-service.d.ts +56 -8
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
- package/dist/services/obsidian/obsidian-service.js +254 -48
- package/dist/services/obsidian/obsidian-service.js.map +1 -1
- package/dist/services/obsidian/path-policy.d.ts +33 -5
- package/dist/services/obsidian/path-policy.d.ts.map +1 -1
- package/dist/services/obsidian/path-policy.js +99 -17
- package/dist/services/obsidian/path-policy.js.map +1 -1
- package/dist/services/obsidian/types.d.ts +12 -3
- package/dist/services/obsidian/types.d.ts.map +1 -1
- package/manifest.json +2 -2
- package/package.json +18 -14
- package/server.json +5 -5
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
* NotFound enriched with the candidates in the message and
|
|
17
17
|
* `error.data.suggestions[]`.
|
|
18
18
|
*
|
|
19
|
+
* 3. **Case-variant naming on writes.** A whole-file write never substitutes
|
|
20
|
+
* a path, but on a case-insensitive filesystem a write to a case variant of
|
|
21
|
+
* an existing note is refused (`case_variant_exists`); the same listing
|
|
22
|
+
* names the note it collided with as `existingPath`.
|
|
23
|
+
*
|
|
19
24
|
* `obsidian_get_note` and `obsidian_open_in_ui` wrap their service calls with
|
|
20
25
|
* `withCaseFallback`; writes and deletes match the exact path.
|
|
21
26
|
* @module mcp-server/tools/definitions/_shared/suggest-paths
|
|
@@ -102,6 +107,57 @@ export async function findSimilarPaths(ctx, svc, path) {
|
|
|
102
107
|
const probe = await probeParentDir(ctx, svc, path);
|
|
103
108
|
return [...probe.caseMatches, ...probe.extInsensitive].slice(0, MAX_SUGGESTIONS);
|
|
104
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Read the parent folder listing for files that differ from `path` only in
|
|
112
|
+
* letter case. A listing that fails, or that the read scope withholds, reads
|
|
113
|
+
* as empty, so no path outside the read scope is ever named; the caller's
|
|
114
|
+
* cancellation propagates as itself.
|
|
115
|
+
*/
|
|
116
|
+
export async function findCaseVariants(ctx, svc, path) {
|
|
117
|
+
const { caseMatches } = await probeParentDir(ctx, svc, path);
|
|
118
|
+
const normalized = path.replace(/^\/+|\/+$/g, '');
|
|
119
|
+
return {
|
|
120
|
+
exact: caseMatches.includes(normalized),
|
|
121
|
+
variants: caseMatches.filter((match) => match !== normalized),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Message and error data for a `case_variant_exists` refusal. `existingPath`
|
|
126
|
+
* is set only when exactly one variant is listed — never picked from several,
|
|
127
|
+
* and never inferred when none is: a file Obsidian does not index (a dot-file)
|
|
128
|
+
* refuses a write the same way and never appears in a listing.
|
|
129
|
+
*/
|
|
130
|
+
export function caseVariantError(path, variants) {
|
|
131
|
+
const existingPath = variants.length === 1 ? variants[0] : undefined;
|
|
132
|
+
if (existingPath === undefined) {
|
|
133
|
+
return {
|
|
134
|
+
message: `'${path}' collides with a file already on disk: one whose name differs only in letter case, or one Obsidian does not index.`,
|
|
135
|
+
data: { path },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
message: `Note '${existingPath}' already exists, and this vault's filesystem treats '${path}' as the same file.`,
|
|
140
|
+
data: { path, existingPath },
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Run a whole-file write to `path`, and when the service refuses it as
|
|
145
|
+
* `case_variant_exists`, rethrow it naming the existing note from the parent
|
|
146
|
+
* listing. The listing is read only on that failure, so a write that succeeds
|
|
147
|
+
* costs no extra request.
|
|
148
|
+
*/
|
|
149
|
+
export async function withCaseVariantNamed(ctx, svc, path, write) {
|
|
150
|
+
try {
|
|
151
|
+
return await write();
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
if (!(err instanceof McpError) || err.data?.reason !== 'case_variant_exists')
|
|
155
|
+
throw err;
|
|
156
|
+
const { variants } = await findCaseVariants(ctx, svc, path);
|
|
157
|
+
const { message, data } = caseVariantError(path, variants);
|
|
158
|
+
throw conflict(message, { ...data, reason: 'case_variant_exists' }, { cause: err });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
105
161
|
async function probeParentDir(ctx, svc, path) {
|
|
106
162
|
const empty = { caseMatches: [], extInsensitive: [] };
|
|
107
163
|
const normalized = path.replace(/^\/+|\/+$/g, '');
|
|
@@ -117,7 +173,10 @@ async function probeParentDir(ctx, svc, path) {
|
|
|
117
173
|
const listing = await svc.listFiles(ctx, dir);
|
|
118
174
|
entries = listing.files;
|
|
119
175
|
}
|
|
120
|
-
catch {
|
|
176
|
+
catch (err) {
|
|
177
|
+
// The caller's cancellation is not a listing that came back empty.
|
|
178
|
+
if (ctx.signal?.aborted)
|
|
179
|
+
throw err;
|
|
121
180
|
return empty;
|
|
122
181
|
}
|
|
123
182
|
const baseLower = base.toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-paths.js","sourceRoot":"","sources":["../../../../../src/mcp-server/tools/definitions/_shared/suggest-paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"suggest-paths.js","sourceRoot":"","sources":["../../../../../src/mcp-server/tools/definitions/_shared/suggest-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAI/F,MAAM,eAAe,GAAG,CAAC,CAAC;AAc1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAY,EACZ,GAAoB,EACpB,MAAkB,EAClB,EAAsC;IAEtC,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;IAC/D,C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AAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW,EAAE,IAAY;IACxC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC"}
|
|
@@ -307,122 +307,6 @@ export declare const readToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
307
307
|
* `buildDeleteNoteTool`.
|
|
308
308
|
*/
|
|
309
309
|
export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
|
|
310
|
-
target: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
311
|
-
type: import("zod").ZodLiteral<"path">;
|
|
312
|
-
path: import("zod").ZodString;
|
|
313
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
314
|
-
type: import("zod").ZodLiteral<"active">;
|
|
315
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
316
|
-
type: import("zod").ZodLiteral<"periodic">;
|
|
317
|
-
period: import("zod").ZodEnum<{
|
|
318
|
-
daily: "daily";
|
|
319
|
-
monthly: "monthly";
|
|
320
|
-
quarterly: "quarterly";
|
|
321
|
-
weekly: "weekly";
|
|
322
|
-
yearly: "yearly";
|
|
323
|
-
}>;
|
|
324
|
-
date: import("zod").ZodOptional<import("zod").ZodString>;
|
|
325
|
-
}, import("zod/v4/core").$strip>], "type">;
|
|
326
|
-
content: import("zod").ZodString;
|
|
327
|
-
section: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
328
|
-
type: import("zod").ZodEnum<{
|
|
329
|
-
block: "block";
|
|
330
|
-
frontmatter: "frontmatter";
|
|
331
|
-
heading: "heading";
|
|
332
|
-
}>;
|
|
333
|
-
target: import("zod").ZodString;
|
|
334
|
-
}, import("zod/v4/core").$strip>>;
|
|
335
|
-
contentType: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
336
|
-
json: "json";
|
|
337
|
-
markdown: "markdown";
|
|
338
|
-
}>>;
|
|
339
|
-
createTargetIfMissing: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
340
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
341
|
-
path: import("zod").ZodString;
|
|
342
|
-
sectionTargeted: import("zod").ZodBoolean;
|
|
343
|
-
sectionTarget: import("zod").ZodOptional<import("zod").ZodString>;
|
|
344
|
-
created: import("zod").ZodBoolean;
|
|
345
|
-
previousSizeInBytes: import("zod").ZodNumber;
|
|
346
|
-
currentSizeInBytes: import("zod").ZodNumber;
|
|
347
|
-
}, import("zod/v4/core").$strip>, readonly [{
|
|
348
|
-
readonly reason: "path_forbidden";
|
|
349
|
-
readonly thrownBy: "service";
|
|
350
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
351
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
352
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
353
|
-
}, {
|
|
354
|
-
readonly reason: "note_missing";
|
|
355
|
-
readonly thrownBy: "service";
|
|
356
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
357
|
-
readonly when: "Section append targets a path that does not resolve to an existing note (PATCH requires the file to exist).";
|
|
358
|
-
readonly recovery: "Verify the path with obsidian_list_notes, or omit `section` to fall back to whole-file append (which creates the note if missing).";
|
|
359
|
-
}, {
|
|
360
|
-
readonly reason: "no_active_file";
|
|
361
|
-
readonly thrownBy: "service";
|
|
362
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
363
|
-
readonly when: "Target was `active` but no file is currently open in Obsidian.";
|
|
364
|
-
readonly recovery: "Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead.";
|
|
365
|
-
}, {
|
|
366
|
-
readonly reason: "periodic_unsupported";
|
|
367
|
-
readonly thrownBy: "service";
|
|
368
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
369
|
-
readonly when: "Target was `periodic` and this vault runs Local REST API v5.0.2 or later without the companion periodic-notes extension, so the `/periodic/` routes are not served at all.";
|
|
370
|
-
readonly recovery: "Install the periodic-notes extension from https://github.com/coddingtonbear/obsidian-local-rest-api-periodic-notes, or address the note by an explicit vault path.";
|
|
371
|
-
}, {
|
|
372
|
-
readonly reason: "periodic_not_found";
|
|
373
|
-
readonly thrownBy: "service";
|
|
374
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
375
|
-
readonly when: "Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period.";
|
|
376
|
-
readonly recovery: "Create the periodic note first or pass an explicit path target.";
|
|
377
|
-
}, {
|
|
378
|
-
readonly reason: "periodic_disabled";
|
|
379
|
-
readonly thrownBy: "service";
|
|
380
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
381
|
-
readonly when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings.";
|
|
382
|
-
readonly recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin.";
|
|
383
|
-
}, {
|
|
384
|
-
readonly reason: "section_target_missing";
|
|
385
|
-
readonly thrownBy: "service";
|
|
386
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
387
|
-
readonly when: "`section` was provided but the named heading/block/frontmatter field does not exist in the note.";
|
|
388
|
-
readonly recovery: "Call obsidian_get_note with format document-map to discover available targets, or pass createTargetIfMissing: true to bring it into existence.";
|
|
389
|
-
}, {
|
|
390
|
-
readonly reason: "ambiguous_section";
|
|
391
|
-
readonly thrownBy: "service";
|
|
392
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
393
|
-
readonly when: "A bare heading leaf name matches more than one heading in the note, or the resolved full heading path occurs more than once, so the append target is undetermined.";
|
|
394
|
-
readonly recovery: "Retry with a distinct full Parent::Child heading path from `candidates` on the error data; when every candidate is the same path, rename the repeated headings first.";
|
|
395
|
-
}, {
|
|
396
|
-
readonly reason: "content_preexists";
|
|
397
|
-
readonly thrownBy: "service";
|
|
398
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
399
|
-
readonly when: "Section append where the supplied content already appears at the target — rejected to keep retries idempotent (the default for the section path).";
|
|
400
|
-
readonly recovery: "Change the content to something not already present at the target, or use obsidian_patch_note with `patchOptions.applyIfContentPreexists: true` if a duplicate is intended.";
|
|
401
|
-
}, {
|
|
402
|
-
readonly reason: "heading_outside_section";
|
|
403
|
-
readonly thrownBy: "service";
|
|
404
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
405
|
-
readonly when: "On Local REST API v5.0 and later, content appended to a heading carries a heading at or above that section’s own level, which would have to sit outside the section.";
|
|
406
|
-
readonly recovery: "Append the heading at the parent section or at the end of the note (no `section`), or write it one level below the target section or deeper.";
|
|
407
|
-
}, {
|
|
408
|
-
readonly reason: "patch_rejected";
|
|
409
|
-
readonly thrownBy: "service";
|
|
410
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
411
|
-
readonly when: "The section exists but the plugin refused the content for it — table rows for a block that is not a table, a row with the wrong cell count, a frontmatter value that cannot merge, or content of the wrong shape.";
|
|
412
|
-
readonly recovery: "Read the target with obsidian_get_note format section, then send content that fits it — rows matching the table columns, or a value of the field’s own type.";
|
|
413
|
-
}, {
|
|
414
|
-
readonly reason: "path_is_directory";
|
|
415
|
-
readonly thrownBy: "service";
|
|
416
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
417
|
-
readonly when: "The supplied path names a folder rather than a note file.";
|
|
418
|
-
readonly recovery: "Call obsidian_list_notes with this path to list the folder, then retry with the full path of one of the files it returns.";
|
|
419
|
-
}, {
|
|
420
|
-
readonly reason: "path_traversal";
|
|
421
|
-
readonly thrownBy: "service";
|
|
422
|
-
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
423
|
-
readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape.";
|
|
424
|
-
readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault.";
|
|
425
|
-
}], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
|
|
426
310
|
operation: import("zod").ZodEnum<{
|
|
427
311
|
delete: "delete";
|
|
428
312
|
get: "get";
|
|
@@ -674,6 +558,11 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
674
558
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
675
559
|
readonly when: "Whole-file write was attempted against an existing note and `overwrite` was not set to `true`.";
|
|
676
560
|
readonly recovery: "Retry with overwrite true or use obsidian_patch_note for in-place edits.";
|
|
561
|
+
}, {
|
|
562
|
+
readonly reason: "case_variant_exists";
|
|
563
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
564
|
+
readonly when: "Whole-file write to a path that differs from an existing note only in letter case, on a case-insensitive filesystem (macOS, Windows) where both name one file. `existingPath` names that note when the parent folder listing shows exactly one case match; it is omitted when several match, and when a file Obsidian does not index, such as a dot-file, already sits at the path.";
|
|
565
|
+
readonly recovery: "Retry with the path in `existingPath` on the error data, which names the same file. Without `existingPath`, list the folder with obsidian_list_notes and use the spelling it shows, or choose another path.";
|
|
677
566
|
}, {
|
|
678
567
|
readonly reason: "path_forbidden";
|
|
679
568
|
readonly thrownBy: "service";
|
|
@@ -746,6 +635,128 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
746
635
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
747
636
|
readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape.";
|
|
748
637
|
readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault.";
|
|
638
|
+
}], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
|
|
639
|
+
target: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
640
|
+
type: import("zod").ZodLiteral<"path">;
|
|
641
|
+
path: import("zod").ZodString;
|
|
642
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
643
|
+
type: import("zod").ZodLiteral<"active">;
|
|
644
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
645
|
+
type: import("zod").ZodLiteral<"periodic">;
|
|
646
|
+
period: import("zod").ZodEnum<{
|
|
647
|
+
daily: "daily";
|
|
648
|
+
monthly: "monthly";
|
|
649
|
+
quarterly: "quarterly";
|
|
650
|
+
weekly: "weekly";
|
|
651
|
+
yearly: "yearly";
|
|
652
|
+
}>;
|
|
653
|
+
date: import("zod").ZodOptional<import("zod").ZodString>;
|
|
654
|
+
}, import("zod/v4/core").$strip>], "type">;
|
|
655
|
+
content: import("zod").ZodString;
|
|
656
|
+
section: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
657
|
+
type: import("zod").ZodEnum<{
|
|
658
|
+
block: "block";
|
|
659
|
+
frontmatter: "frontmatter";
|
|
660
|
+
heading: "heading";
|
|
661
|
+
}>;
|
|
662
|
+
target: import("zod").ZodString;
|
|
663
|
+
}, import("zod/v4/core").$strip>>;
|
|
664
|
+
contentType: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
665
|
+
json: "json";
|
|
666
|
+
markdown: "markdown";
|
|
667
|
+
}>>;
|
|
668
|
+
createTargetIfMissing: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
669
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
670
|
+
path: import("zod").ZodString;
|
|
671
|
+
sectionTargeted: import("zod").ZodBoolean;
|
|
672
|
+
sectionTarget: import("zod").ZodOptional<import("zod").ZodString>;
|
|
673
|
+
created: import("zod").ZodBoolean;
|
|
674
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
675
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
676
|
+
}, import("zod/v4/core").$strip>, readonly [{
|
|
677
|
+
readonly reason: "case_variant_exists";
|
|
678
|
+
readonly thrownBy: "service";
|
|
679
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
680
|
+
readonly when: "Whole-file append to a path that differs from an existing note only in letter case, on a case-insensitive filesystem (macOS, Windows) where both name one file. `existingPath` names that note when the parent folder listing shows exactly one case match; it is omitted when several match, and when a file Obsidian does not index, such as a dot-file, already sits at the path.";
|
|
681
|
+
readonly recovery: "Retry with the path in `existingPath` on the error data, which names the same file. Without `existingPath`, list the folder with obsidian_list_notes and use the spelling it shows, or choose another path.";
|
|
682
|
+
}, {
|
|
683
|
+
readonly reason: "path_forbidden";
|
|
684
|
+
readonly thrownBy: "service";
|
|
685
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
686
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
687
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
688
|
+
}, {
|
|
689
|
+
readonly reason: "note_missing";
|
|
690
|
+
readonly thrownBy: "service";
|
|
691
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
692
|
+
readonly when: "Section append targets a path that does not resolve to an existing note (PATCH requires the file to exist).";
|
|
693
|
+
readonly recovery: "Verify the path with obsidian_list_notes, or omit `section` to fall back to whole-file append (which creates the note if missing).";
|
|
694
|
+
}, {
|
|
695
|
+
readonly reason: "no_active_file";
|
|
696
|
+
readonly thrownBy: "service";
|
|
697
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
698
|
+
readonly when: "Target was `active` but no file is currently open in Obsidian.";
|
|
699
|
+
readonly recovery: "Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead.";
|
|
700
|
+
}, {
|
|
701
|
+
readonly reason: "periodic_unsupported";
|
|
702
|
+
readonly thrownBy: "service";
|
|
703
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
704
|
+
readonly when: "Target was `periodic` and this vault runs Local REST API v5.0.2 or later without the companion periodic-notes extension, so the `/periodic/` routes are not served at all.";
|
|
705
|
+
readonly recovery: "Install the periodic-notes extension from https://github.com/coddingtonbear/obsidian-local-rest-api-periodic-notes, or address the note by an explicit vault path.";
|
|
706
|
+
}, {
|
|
707
|
+
readonly reason: "periodic_not_found";
|
|
708
|
+
readonly thrownBy: "service";
|
|
709
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
710
|
+
readonly when: "Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period.";
|
|
711
|
+
readonly recovery: "Create the periodic note first or pass an explicit path target.";
|
|
712
|
+
}, {
|
|
713
|
+
readonly reason: "periodic_disabled";
|
|
714
|
+
readonly thrownBy: "service";
|
|
715
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
716
|
+
readonly when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings.";
|
|
717
|
+
readonly recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin.";
|
|
718
|
+
}, {
|
|
719
|
+
readonly reason: "section_target_missing";
|
|
720
|
+
readonly thrownBy: "service";
|
|
721
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
722
|
+
readonly when: "`section` was provided but the named heading/block/frontmatter field does not exist in the note.";
|
|
723
|
+
readonly recovery: "Call obsidian_get_note with format document-map to discover available targets, or pass createTargetIfMissing: true to bring it into existence.";
|
|
724
|
+
}, {
|
|
725
|
+
readonly reason: "ambiguous_section";
|
|
726
|
+
readonly thrownBy: "service";
|
|
727
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
728
|
+
readonly when: "A bare heading leaf name matches more than one heading in the note, or the resolved full heading path occurs more than once, so the append target is undetermined.";
|
|
729
|
+
readonly recovery: "Retry with a distinct full Parent::Child heading path from `candidates` on the error data; when every candidate is the same path, rename the repeated headings first.";
|
|
730
|
+
}, {
|
|
731
|
+
readonly reason: "content_preexists";
|
|
732
|
+
readonly thrownBy: "service";
|
|
733
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
734
|
+
readonly when: "Section append where the supplied content already appears at the target — rejected to keep retries idempotent (the default for the section path).";
|
|
735
|
+
readonly recovery: "Change the content to something not already present at the target, or use obsidian_patch_note with `patchOptions.applyIfContentPreexists: true` if a duplicate is intended.";
|
|
736
|
+
}, {
|
|
737
|
+
readonly reason: "heading_outside_section";
|
|
738
|
+
readonly thrownBy: "service";
|
|
739
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
740
|
+
readonly when: "On Local REST API v5.0 and later, content appended to a heading carries a heading at or above that section’s own level, which would have to sit outside the section.";
|
|
741
|
+
readonly recovery: "Append the heading at the parent section or at the end of the note (no `section`), or write it one level below the target section or deeper.";
|
|
742
|
+
}, {
|
|
743
|
+
readonly reason: "patch_rejected";
|
|
744
|
+
readonly thrownBy: "service";
|
|
745
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
746
|
+
readonly when: "The section exists but the plugin refused the content for it — table rows for a block that is not a table, a row with the wrong cell count, a frontmatter value that cannot merge, or content of the wrong shape.";
|
|
747
|
+
readonly recovery: "Read the target with obsidian_get_note format section, then send content that fits it — rows matching the table columns, or a value of the field’s own type.";
|
|
748
|
+
}, {
|
|
749
|
+
readonly reason: "path_is_directory";
|
|
750
|
+
readonly thrownBy: "service";
|
|
751
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
752
|
+
readonly when: "The supplied path names a folder rather than a note file.";
|
|
753
|
+
readonly recovery: "Call obsidian_list_notes with this path to list the folder, then retry with the full path of one of the files it returns.";
|
|
754
|
+
}, {
|
|
755
|
+
readonly reason: "path_traversal";
|
|
756
|
+
readonly thrownBy: "service";
|
|
757
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
758
|
+
readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape.";
|
|
759
|
+
readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault.";
|
|
749
760
|
}], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
|
|
750
761
|
target: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
751
762
|
type: import("zod").ZodLiteral<"path">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOhC,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiD,CAAC"}
|
|
@@ -47,6 +47,12 @@ export declare const obsidianAppendToNote: import("@cyanheads/mcp-ts-core").Tool
|
|
|
47
47
|
previousSizeInBytes: z.ZodNumber;
|
|
48
48
|
currentSizeInBytes: z.ZodNumber;
|
|
49
49
|
}, z.core.$strip>, readonly [{
|
|
50
|
+
readonly reason: "case_variant_exists";
|
|
51
|
+
readonly thrownBy: "service";
|
|
52
|
+
readonly code: JsonRpcErrorCode.Conflict;
|
|
53
|
+
readonly when: "Whole-file append to a path that differs from an existing note only in letter case, on a case-insensitive filesystem (macOS, Windows) where both name one file. `existingPath` names that note when the parent folder listing shows exactly one case match; it is omitted when several match, and when a file Obsidian does not index, such as a dot-file, already sits at the path.";
|
|
54
|
+
readonly recovery: "Retry with the path in `existingPath` on the error data, which names the same file. Without `existingPath`, list the folder with obsidian_list_notes and use the spelling it shows, or choose another path.";
|
|
55
|
+
}, {
|
|
50
56
|
readonly reason: "path_forbidden";
|
|
51
57
|
readonly thrownBy: "service";
|
|
52
58
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-append-to-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-append-to-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-append-to-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-append-to-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4N/B,CAAC"}
|
|
@@ -10,8 +10,9 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
|
10
10
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
11
11
|
import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
|
|
12
12
|
import { ContentTypeSchema, SectionSchema, TargetSchema } from './_shared/schemas.js';
|
|
13
|
+
import { withCaseVariantNamed } from './_shared/suggest-paths.js';
|
|
13
14
|
export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
14
|
-
description: 'Append content to a note. **Without `section`: appends to the end of the file, or creates the file if it does not exist (your content becomes the full file).** When an existing file does not end in a line break, one is inserted before your content. With `section`: appends to the end of that heading/block/frontmatter (on Local REST API v5.0 and later, content appended to a heading is separated from the section’s existing content by a blank line, except a list item appended to a section that ends in a list and has no sub-headings, which continues that list) — use `obsidian_get_note` with `format: "document-map"` to discover available targets. Name a heading by its full `Parent::Child` path as the document map lists it, or by a bare leaf name matched at any depth. A leaf shared by several headings is rejected with `ambiguous_section`, unless one of them has no parent heading, in which case the write targets that one; a full path that occurs more than once in the note is rejected with `ambiguous_section` too. For block-reference targets, content is concatenated adjacent to the block line without inserting a separator — include a leading newline in `content` if you want one. Set `createTargetIfMissing` to bring the target section into existence rather than failing when it does not exist.',
|
|
15
|
+
description: 'Append content to a note. **Without `section`: appends to the end of the file, or creates the file if it does not exist (your content becomes the full file).** When an existing file does not end in a line break, one is inserted before your content. On a case-insensitive filesystem, a path that differs from an existing note only in letter case fails with `case_variant_exists` (`existingPath` names the note when the folder listing shows exactly one case match). With `section`: appends to the end of that heading/block/frontmatter (on Local REST API v5.0 and later, content appended to a heading is separated from the section’s existing content by a blank line, except a list item appended to a section that ends in a list and has no sub-headings, which continues that list) — use `obsidian_get_note` with `format: "document-map"` to discover available targets. Name a heading by its full `Parent::Child` path as the document map lists it, or by a bare leaf name matched at any depth. A leaf shared by several headings is rejected with `ambiguous_section`, unless one of them has no parent heading, in which case the write targets that one; a full path that occurs more than once in the note is rejected with `ambiguous_section` too. For block-reference targets, content is concatenated adjacent to the block line without inserting a separator — include a leading newline in `content` if you want one. Set `createTargetIfMissing` to bring the target section into existence rather than failing when it does not exist.',
|
|
15
16
|
annotations: { destructiveHint: true },
|
|
16
17
|
input: z.object({
|
|
17
18
|
target: TargetSchema.describe('Where the note lives.'),
|
|
@@ -44,6 +45,13 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
44
45
|
}),
|
|
45
46
|
auth: ['tool:obsidian_append_to_note:write'],
|
|
46
47
|
errors: [
|
|
48
|
+
{
|
|
49
|
+
reason: 'case_variant_exists',
|
|
50
|
+
thrownBy: 'service',
|
|
51
|
+
code: JsonRpcErrorCode.Conflict,
|
|
52
|
+
when: 'Whole-file append to a path that differs from an existing note only in letter case, on a case-insensitive filesystem (macOS, Windows) where both name one file. `existingPath` names that note when the parent folder listing shows exactly one case match; it is omitted when several match, and when a file Obsidian does not index, such as a dot-file, already sits at the path.',
|
|
53
|
+
recovery: 'Retry with the path in `existingPath` on the error data, which names the same file. Without `existingPath`, list the folder with obsidian_list_notes and use the spelling it shows, or choose another path.',
|
|
54
|
+
},
|
|
47
55
|
{
|
|
48
56
|
reason: 'path_forbidden',
|
|
49
57
|
thrownBy: 'service',
|
|
@@ -143,8 +151,8 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
143
151
|
* presence probe and the write itself act on the same concrete file —
|
|
144
152
|
* avoids re-resolving `active` / `periodic` targets across calls.
|
|
145
153
|
*/
|
|
146
|
-
const
|
|
147
|
-
const
|
|
154
|
+
const pathTarget = await svc.resolveTarget(ctx, input.target);
|
|
155
|
+
const { path } = pathTarget;
|
|
148
156
|
if (input.section) {
|
|
149
157
|
const previousSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
150
158
|
const sectionTarget = await svc.patchNote(ctx, pathTarget, input.content, {
|
|
@@ -165,7 +173,7 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
165
173
|
};
|
|
166
174
|
}
|
|
167
175
|
const previousSizeInBytes = await svc.tryGetSize(ctx, pathTarget);
|
|
168
|
-
await svc.appendToNote(ctx, pathTarget, input.content, input.contentType);
|
|
176
|
+
await withCaseVariantNamed(ctx, svc, path, () => svc.appendToNote(ctx, pathTarget, input.content, input.contentType));
|
|
169
177
|
const currentSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
170
178
|
return {
|
|
171
179
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-append-to-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-append-to-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-append-to-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-append-to-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,EAAE;IAClE,WAAW,EACT,g/CAAg/C;IACl/C,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACtD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;QACxF,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACxC,kGAAkG,CACnG;QACD,WAAW,EAAE,iBAAiB;QAC9B,qBAAqB,EAAE,CAAC;aACrB,OAAO,EAAE;aACT,OAAO,CAAC,KAAK,CAAC;aACd,QAAQ,CACP,qIAAqI,CACtI;KACJ,CAAC;IACF,MAAM,EAAE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AAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -191,9 +191,9 @@ export function buildDeleteNoteTool({ elicitation }) {
|
|
|
191
191
|
* a prompt or a stored record.
|
|
192
192
|
*/
|
|
193
193
|
const svc = getObsidianService();
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
const pathTarget = await svc.resolveTarget(ctx, input.target);
|
|
195
|
+
const { path } = pathTarget;
|
|
196
|
+
svc.policy.assertWritable(path, pathTarget.resolvedFrom);
|
|
197
197
|
/**
|
|
198
198
|
* The read runs in both modes: it throws `path_is_directory` for a folder,
|
|
199
199
|
* which the DELETE would remove with everything inside it, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-delete-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAgB,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAwB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,SAAS,GAAG,sBAAsB,CAAC;AACzC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,IAAI,GAAG,gEAAgE,CAAC;AAE9E,kFAAkF;AAClF,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CA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EAAE,0KAA0K;gBAChL,QAAQ,EACN,kHAAkH;aACrH;YACD;gBACE,MAAM,EAAE,gBAAgB;gBACxB,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,gBAAgB,CAAC,eAAe;gBACtC,IAAI,EAAE,qFAAqF;gBAC3F,QAAQ,EACN,kIAAkI;aACrI;SACF;QAED,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;YACtB;;;;;;;;;;;;;;;;;;eAkBG;YACH,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACxD,MAAM,MAAM,GACV,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACnF,IAAI,MAAM;gBAAE,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAEpD;;;;eAIG;YACH,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;YACjC,MAAM,
|
|
1
|
+
{"version":3,"file":"obsidian-delete-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAgB,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAwB,MAAM,yCAAyC,CAAC;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GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBAChF,OAAO,GAAG,CAAC,YAAY,CAAC;wBACtB,aAAa,EAAE;4BACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC;gCAC5B,OAAO,EAAE,uBAAuB,IAAI,MAAM,mBAAmB,4FAA4F;gCACzJ,eAAe,EAAE,kBAAkB;6BACpC,CAAC;yBACH;wBACD,YAAY,EAAE,KAAK;qBACpB,CAAC,CAAC;gBACL,CAAC;gBAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;oBACpB,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,6BAA6B,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC;YAED,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YACtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;QAC7E,CAAC;QAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;YAClB;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,MAAM,CAAC,IAAI,aAAa,MAAM,CAAC,mBAAmB,MAAM,MAAM,CAAC,kBAAkB,SAAS;aAC9G;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-get-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-get-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-get-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-get-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAiB3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgY1B,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
7
7
|
import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
|
|
8
|
+
import { wikilinkCloser } from '../../../services/obsidian/frontmatter-ops.js';
|
|
8
9
|
import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
|
|
9
10
|
import { computeFenceMask, extractSection, } from '../../../services/obsidian/section-extractor.js';
|
|
10
11
|
import { SectionSchema, TargetSchema } from './_shared/schemas.js';
|
|
@@ -233,14 +234,13 @@ export const obsidianGetNote = tool('obsidian_get_note', {
|
|
|
233
234
|
},
|
|
234
235
|
};
|
|
235
236
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
]);
|
|
237
|
+
// Resolve once and read the map from that note, so `path` and the map always agree.
|
|
238
|
+
const pinned = await svc.resolveTarget(ctx, target);
|
|
239
|
+
const map = await svc.getDocumentMap(ctx, pinned);
|
|
240
240
|
return {
|
|
241
241
|
result: {
|
|
242
242
|
format: 'document-map',
|
|
243
|
-
path,
|
|
243
|
+
path: pinned.path,
|
|
244
244
|
headings: map.headings,
|
|
245
245
|
blocks: map.blocks,
|
|
246
246
|
frontmatterFields: map.frontmatterFields,
|
|
@@ -359,15 +359,6 @@ function stringifyValue(v) {
|
|
|
359
359
|
return v;
|
|
360
360
|
return JSON.stringify(v, null, 2);
|
|
361
361
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Wikilink: `[[body]]` or `![[body]]`, matched as Obsidian's metadata cache
|
|
364
|
-
* reads it — from `[[` to the first `]]` on the same line. Single `[` and `]`
|
|
365
|
-
* belong to the body (`[[Note|see [1]]]` links `Note`), but a second `[[`
|
|
366
|
-
* starts the link over, so every match attempt stops at the next `[[`, `]]`,
|
|
367
|
-
* or newline and the scan stays linear in note length. {@link wikilinkTarget}
|
|
368
|
-
* takes the target out of the body.
|
|
369
|
-
*/
|
|
370
|
-
const WIKILINK = /!?\[\[((?:(?!\[\[|\]\])[^\n])*)\]\]/g;
|
|
371
362
|
/**
|
|
372
363
|
* The target of a wikilink body: the text before the first `|` (alias) or `#`
|
|
373
364
|
* (section). A backslash right before the alias pipe escapes it — Obsidian
|
|
@@ -397,16 +388,29 @@ const MARKDOWN_LINK = /\[[^[\]]*\]\((<[^<>\n]+>|(?:[^()\s]|\([^()\s]*\))+)(?:\s+
|
|
|
397
388
|
* (any `scheme:` form) are filtered out — only vault-internal references
|
|
398
389
|
* remain. No existence checks; this is the link graph as written.
|
|
399
390
|
*
|
|
391
|
+
* A wikilink's extent is `wikilinkCloser`'s, the rule `obsidian_manage_tags`
|
|
392
|
+
* protects links by; the `!` of an embed sits before the `[[` and changes
|
|
393
|
+
* neither. An opener with no closer is passed over one character at a time,
|
|
394
|
+
* since its second `[` may open a link (`[[[[Note]]` links `[Note`).
|
|
395
|
+
* {@link wikilinkTarget} takes the target out of the body.
|
|
396
|
+
*
|
|
400
397
|
* Fenced code blocks and inline code are blanked before matching so notes
|
|
401
398
|
* documenting markdown syntax don't yield false-positive links.
|
|
402
399
|
*/
|
|
403
400
|
function parseOutgoingLinks(content) {
|
|
404
401
|
const cleaned = stripMarkdownCode(content);
|
|
405
402
|
const links = [];
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
const linkEnd = wikilinkCloser(cleaned);
|
|
404
|
+
for (let open = cleaned.indexOf('[['); open >= 0;) {
|
|
405
|
+
const end = linkEnd(open);
|
|
406
|
+
if (end === undefined) {
|
|
407
|
+
open = cleaned.indexOf('[[', open + 1);
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
const target = wikilinkTarget(cleaned.slice(open + 2, end - 2));
|
|
408
411
|
if (target)
|
|
409
412
|
links.push({ target, type: 'wikilink' });
|
|
413
|
+
open = cleaned.indexOf('[[', end);
|
|
410
414
|
}
|
|
411
415
|
for (const m of cleaned.matchAll(MARKDOWN_LINK)) {
|
|
412
416
|
let target = m[1]?.trim();
|