obsidian-mcp-server 3.1.6 → 3.1.7
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/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/changelog/3.1.x/3.1.7.md +41 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +38 -0
- 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 +52 -18
- 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.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +18 -6
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +4 -0
- 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 +23 -3
- 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 +4 -0
- 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 +19 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +21 -4
- 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 +2 -0
- 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 +18 -1
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +2 -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 +35 -10
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -1
- package/dist/services/obsidian/obsidian-service.d.ts +18 -10
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
- package/dist/services/obsidian/obsidian-service.js +52 -14
- package/dist/services/obsidian/obsidian-service.js.map +1 -1
- package/package.json +2 -2
- package/server.json +3 -3
package/CLAUDE.md
CHANGED
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](https://www.npmjs.com/package/obsidian-mcp-server) [](https://www.npmjs.com/package/obsidian-mcp-server) [](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
11
11
|
|
|
12
12
|
[](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
13
13
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Every mutating tool now reports `previousSizeInBytes` + `currentSizeInBytes`; `obsidian_append_to_note` gains the `created` upsert flag. Resolves [#48](https://github.com/cyanheads/obsidian-mcp-server/issues/48)."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 3.1.7 — 2026-05-10
|
|
8
|
+
|
|
9
|
+
`obsidian_append_to_note` is silently an upsert primitive — POST against a non-existent path creates the file and writes the body as its full content. This release rolls the response-transparency pattern from `obsidian_write_note` onto every mutating tool: each one now reports byte-size before and after the operation, and the upsert tools flag whether the write created the file. Agents get unambiguous evidence to spot typo paths, accidental whole-file clobbers, and concurrent-writer drift from the response alone.
|
|
10
|
+
|
|
11
|
+
## Added
|
|
12
|
+
|
|
13
|
+
- **`obsidian_append_to_note`** — `created: boolean` on the output. `true` flags the upsert branch where the agent's content became the entire file at a possibly unintended path; `format()` renders the same hint as `obsidian_write_note` when set. Always `false` for section appends (PATCH requires the file to exist).
|
|
14
|
+
- **Every mutating tool** — `previousSizeInBytes` + `currentSizeInBytes` on the output. Server reports raw before/after; agent computes deltas and decides what discrepancies mean (auto-newline injection, concurrent writers, accidental shrinkage). No server-side integrity verdict.
|
|
15
|
+
- **`ObsidianService.tryGetSize(ctx, target)`** — HEAD `/vault/{path}`, parses `Content-Length`, returns `null` on 404. Path-policy gated, retry-bypassed.
|
|
16
|
+
- **`ObsidianService.getSize(ctx, target)`** — same as `tryGetSize` but throws `note_missing` on 404. Used for post-write verification reads.
|
|
17
|
+
|
|
18
|
+
## Changed
|
|
19
|
+
|
|
20
|
+
- **`obsidian_delete_note`** — elicitation prompt now includes the byte size of the file being deleted (`Permanently delete '<path>' (<N> bytes)?`).
|
|
21
|
+
- **`obsidian_write_note`** overwrite check migrated from `noteExists` to `tryGetSize !== null`. Net wash on round trips, gain the `previousSizeInBytes` data for free on the same HEAD.
|
|
22
|
+
- **`obsidian_append_to_note` description** — front-loads the create-if-missing behavior of the no-section branch (matches the wording pattern `obsidian_write_note` uses for `overwrite`).
|
|
23
|
+
- **Source-of-truth rule for note byte sizes** documented on `tryGetSize`: prefer HEAD `Content-Length` or `Buffer.byteLength(deliveredContent)`, never `note.stat.size` from the JSON envelope (shares the upstream `getAbstractFileByPath` cache path with the rest of the envelope, so it can't act as an independent cross-check — see [coddingtonbear/obsidian-local-rest-api#237](https://github.com/coddingtonbear/obsidian-local-rest-api/issues/237)).
|
|
24
|
+
- **`@biomejs/biome` `^2.4.14` → `^2.4.15`** (devDependency).
|
|
25
|
+
|
|
26
|
+
## Removed
|
|
27
|
+
|
|
28
|
+
- **`ObsidianService.noteExists`** — sole caller (`obsidian_write_note` overwrite guard) migrated to `tryGetSize`.
|
|
29
|
+
|
|
30
|
+
## Per-tool source for `currentSizeInBytes`
|
|
31
|
+
|
|
32
|
+
| Tool | Source | Extra round trips |
|
|
33
|
+
|:---|:---|:---|
|
|
34
|
+
| `obsidian_write_note` | Post-write HEAD (whole-file) / pre+post HEAD (section) | +1 / +2 |
|
|
35
|
+
| `obsidian_append_to_note` | Post-write HEAD (whole-file) / pre+post HEAD (section) | +1 / +2 |
|
|
36
|
+
| `obsidian_patch_note` | Pre+post HEAD | +2 |
|
|
37
|
+
| `obsidian_delete_note` | Always 0 (file gone); pre-DELETE HEAD also feeds the elicit prompt | +1 |
|
|
38
|
+
| `obsidian_replace_in_note` | `Buffer.byteLength` from existing GET; post-write HEAD only when matches found | 0 / +1 |
|
|
39
|
+
| `obsidian_manage_frontmatter` (`set`) | `Buffer.byteLength(noteAfter.content)` from existing post-PATCH GET | +1 (pre-PATCH HEAD) |
|
|
40
|
+
| `obsidian_manage_frontmatter` (`delete`) | `Buffer.byteLength` from existing GET; post-write HEAD only when content changed | 0 / +1 |
|
|
41
|
+
| `obsidian_manage_tags` (`add` / `remove`) | `Buffer.byteLength` from existing pre/post GETs | 0 |
|
|
@@ -284,6 +284,9 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
284
284
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
285
285
|
path: import("zod").ZodString;
|
|
286
286
|
sectionTargeted: import("zod").ZodBoolean;
|
|
287
|
+
created: import("zod").ZodBoolean;
|
|
288
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
289
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
287
290
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
288
291
|
readonly reason: "path_forbidden";
|
|
289
292
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -334,6 +337,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
334
337
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
335
338
|
path: import("zod").ZodString;
|
|
336
339
|
deleted: import("zod").ZodBoolean;
|
|
340
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
341
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
337
342
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
338
343
|
readonly reason: "path_forbidden";
|
|
339
344
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -400,11 +405,15 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
400
405
|
path: import("zod").ZodString;
|
|
401
406
|
key: import("zod").ZodString;
|
|
402
407
|
frontmatter: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
408
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
409
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
403
410
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
404
411
|
operation: import("zod").ZodLiteral<"delete">;
|
|
405
412
|
path: import("zod").ZodString;
|
|
406
413
|
key: import("zod").ZodString;
|
|
407
414
|
frontmatter: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
415
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
416
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
408
417
|
}, import("zod/v4/core").$strip>], "operation">;
|
|
409
418
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
410
419
|
readonly reason: "path_forbidden";
|
|
@@ -479,12 +488,16 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
479
488
|
applied: import("zod").ZodArray<import("zod").ZodString>;
|
|
480
489
|
skipped: import("zod").ZodArray<import("zod").ZodString>;
|
|
481
490
|
tags: import("zod").ZodArray<import("zod").ZodString>;
|
|
491
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
492
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
482
493
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
483
494
|
operation: import("zod").ZodLiteral<"remove">;
|
|
484
495
|
path: import("zod").ZodString;
|
|
485
496
|
applied: import("zod").ZodArray<import("zod").ZodString>;
|
|
486
497
|
skipped: import("zod").ZodArray<import("zod").ZodString>;
|
|
487
498
|
tags: import("zod").ZodArray<import("zod").ZodString>;
|
|
499
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
500
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
488
501
|
}, import("zod/v4/core").$strip>], "operation">;
|
|
489
502
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
490
503
|
readonly reason: "path_forbidden";
|
|
@@ -571,6 +584,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
571
584
|
append: "append";
|
|
572
585
|
prepend: "prepend";
|
|
573
586
|
}>;
|
|
587
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
588
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
574
589
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
575
590
|
readonly reason: "path_forbidden";
|
|
576
591
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -634,6 +649,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
634
649
|
search: import("zod").ZodString;
|
|
635
650
|
count: import("zod").ZodNumber;
|
|
636
651
|
}, import("zod/v4/core").$strip>>;
|
|
652
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
653
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
637
654
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
638
655
|
readonly reason: "path_forbidden";
|
|
639
656
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -699,6 +716,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
699
716
|
path: import("zod").ZodString;
|
|
700
717
|
sectionTargeted: import("zod").ZodBoolean;
|
|
701
718
|
created: import("zod").ZodBoolean;
|
|
719
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
720
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
702
721
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
703
722
|
readonly reason: "file_exists";
|
|
704
723
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
@@ -770,6 +789,9 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
770
789
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
771
790
|
path: import("zod").ZodString;
|
|
772
791
|
sectionTargeted: import("zod").ZodBoolean;
|
|
792
|
+
created: import("zod").ZodBoolean;
|
|
793
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
794
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
773
795
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
774
796
|
readonly reason: "path_forbidden";
|
|
775
797
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -820,6 +842,8 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
820
842
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
821
843
|
path: import("zod").ZodString;
|
|
822
844
|
deleted: import("zod").ZodBoolean;
|
|
845
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
846
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
823
847
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
824
848
|
readonly reason: "path_forbidden";
|
|
825
849
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -1041,11 +1065,15 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
1041
1065
|
path: import("zod").ZodString;
|
|
1042
1066
|
key: import("zod").ZodString;
|
|
1043
1067
|
frontmatter: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
1068
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1069
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1044
1070
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1045
1071
|
operation: import("zod").ZodLiteral<"delete">;
|
|
1046
1072
|
path: import("zod").ZodString;
|
|
1047
1073
|
key: import("zod").ZodString;
|
|
1048
1074
|
frontmatter: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
1075
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1076
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1049
1077
|
}, import("zod/v4/core").$strip>], "operation">;
|
|
1050
1078
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
1051
1079
|
readonly reason: "path_forbidden";
|
|
@@ -1120,12 +1148,16 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
1120
1148
|
applied: import("zod").ZodArray<import("zod").ZodString>;
|
|
1121
1149
|
skipped: import("zod").ZodArray<import("zod").ZodString>;
|
|
1122
1150
|
tags: import("zod").ZodArray<import("zod").ZodString>;
|
|
1151
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1152
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1123
1153
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1124
1154
|
operation: import("zod").ZodLiteral<"remove">;
|
|
1125
1155
|
path: import("zod").ZodString;
|
|
1126
1156
|
applied: import("zod").ZodArray<import("zod").ZodString>;
|
|
1127
1157
|
skipped: import("zod").ZodArray<import("zod").ZodString>;
|
|
1128
1158
|
tags: import("zod").ZodArray<import("zod").ZodString>;
|
|
1159
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1160
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1129
1161
|
}, import("zod/v4/core").$strip>], "operation">;
|
|
1130
1162
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
1131
1163
|
readonly reason: "path_forbidden";
|
|
@@ -1230,6 +1262,8 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
1230
1262
|
append: "append";
|
|
1231
1263
|
prepend: "prepend";
|
|
1232
1264
|
}>;
|
|
1265
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1266
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1233
1267
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
1234
1268
|
readonly reason: "path_forbidden";
|
|
1235
1269
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -1293,6 +1327,8 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
1293
1327
|
search: import("zod").ZodString;
|
|
1294
1328
|
count: import("zod").ZodNumber;
|
|
1295
1329
|
}, import("zod/v4/core").$strip>>;
|
|
1330
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1331
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1296
1332
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
1297
1333
|
readonly reason: "path_forbidden";
|
|
1298
1334
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
@@ -1425,6 +1461,8 @@ export declare const baseToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
1425
1461
|
path: import("zod").ZodString;
|
|
1426
1462
|
sectionTargeted: import("zod").ZodBoolean;
|
|
1427
1463
|
created: import("zod").ZodBoolean;
|
|
1464
|
+
previousSizeInBytes: import("zod").ZodNumber;
|
|
1465
|
+
currentSizeInBytes: import("zod").ZodNumber;
|
|
1428
1466
|
}, import("zod/v4/core").$strip>, readonly [{
|
|
1429
1467
|
readonly reason: "file_exists";
|
|
1430
1468
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Conflict;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,gFAAgF;AAChF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAM/B,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,gFAAgF;AAChF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAoD,CAAC;AAErF,mHAAmH;AACnH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;+CAAiD,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview obsidian_append_to_note — append content to the end of a note,
|
|
3
3
|
* or to the end of a heading/block/frontmatter section via PATCH-with-append.
|
|
4
|
+
* Whole-file appends are silently upserts (POST creates the file when the path
|
|
5
|
+
* does not exist), so the response surface flags `created` and `previousSize`
|
|
6
|
+
* for agent self-correction.
|
|
4
7
|
* @module mcp-server/tools/definitions/obsidian-append-to-note.tool
|
|
5
8
|
*/
|
|
6
9
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -39,6 +42,9 @@ export declare const obsidianAppendToNote: import("@cyanheads/mcp-ts-core").Tool
|
|
|
39
42
|
}, z.core.$strip>, z.ZodObject<{
|
|
40
43
|
path: z.ZodString;
|
|
41
44
|
sectionTargeted: z.ZodBoolean;
|
|
45
|
+
created: z.ZodBoolean;
|
|
46
|
+
previousSizeInBytes: z.ZodNumber;
|
|
47
|
+
currentSizeInBytes: z.ZodNumber;
|
|
42
48
|
}, z.core.$strip>, readonly [{
|
|
43
49
|
readonly reason: "path_forbidden";
|
|
44
50
|
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
|
|
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;AAIjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4I/B,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview obsidian_append_to_note — append content to the end of a note,
|
|
3
3
|
* or to the end of a heading/block/frontmatter section via PATCH-with-append.
|
|
4
|
+
* Whole-file appends are silently upserts (POST creates the file when the path
|
|
5
|
+
* does not exist), so the response surface flags `created` and `previousSize`
|
|
6
|
+
* for agent self-correction.
|
|
4
7
|
* @module mcp-server/tools/definitions/obsidian-append-to-note.tool
|
|
5
8
|
*/
|
|
6
9
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
@@ -8,7 +11,7 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
|
8
11
|
import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
|
|
9
12
|
import { ContentTypeSchema, SectionSchema, TargetSchema } from './_shared/schemas.js';
|
|
10
13
|
export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
11
|
-
description: 'Append content to a note. Without `section
|
|
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).** With `section`: appends to the end of that heading/block/frontmatter; nested headings need `Parent::Child` syntax — use `obsidian_get_note` with `format: "document-map"` to discover available targets. 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.',
|
|
12
15
|
annotations: { destructiveHint: true },
|
|
13
16
|
input: z.object({
|
|
14
17
|
target: TargetSchema.describe('Where the note lives.'),
|
|
@@ -24,7 +27,16 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
24
27
|
path: z.string().describe('Resolved vault-relative path of the note.'),
|
|
25
28
|
sectionTargeted: z
|
|
26
29
|
.boolean()
|
|
27
|
-
.describe('True when the append went to a section; false for whole-file appends.'),
|
|
30
|
+
.describe('True when the append went to a heading/block/frontmatter section (PATCH); false for whole-file appends (POST).'),
|
|
31
|
+
created: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.describe('True when the whole-file append created a new file. Always false for section appends — PATCH requires the file to exist. Best-effort under concurrent writers, racy between the existence check and the write.'),
|
|
34
|
+
previousSizeInBytes: z
|
|
35
|
+
.number()
|
|
36
|
+
.describe('Byte size of the note before the append. Zero when `created` is true.'),
|
|
37
|
+
currentSizeInBytes: z
|
|
38
|
+
.number()
|
|
39
|
+
.describe('Byte size of the note after the append, read from the upstream after the operation completed. Compare against `previousSizeInBytes` and your own content length to detect unexpected upstream behavior (e.g. auto-newline injection, concurrent writers).'),
|
|
28
40
|
}),
|
|
29
41
|
auth: ['tool:obsidian_append_to_note:write'],
|
|
30
42
|
errors: [
|
|
@@ -67,9 +79,16 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
67
79
|
],
|
|
68
80
|
async handler(input, ctx) {
|
|
69
81
|
const svc = getObsidianService();
|
|
70
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Resolve once and pin the rest of the flow to a path target so the
|
|
84
|
+
* presence probe and the write itself act on the same concrete file —
|
|
85
|
+
* avoids re-resolving `active` / `periodic` targets across calls.
|
|
86
|
+
*/
|
|
87
|
+
const path = await svc.resolvePath(ctx, input.target);
|
|
88
|
+
const pathTarget = { type: 'path', path };
|
|
71
89
|
if (input.section) {
|
|
72
|
-
await svc.
|
|
90
|
+
const previousSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
91
|
+
await svc.patchNote(ctx, pathTarget, input.content, {
|
|
73
92
|
operation: 'append',
|
|
74
93
|
targetType: input.section.type,
|
|
75
94
|
target: input.section.target,
|
|
@@ -77,21 +96,36 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
77
96
|
createTargetIfMissing: input.createTargetIfMissing,
|
|
78
97
|
contentType: input.contentType,
|
|
79
98
|
});
|
|
80
|
-
const
|
|
81
|
-
return {
|
|
99
|
+
const currentSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
100
|
+
return {
|
|
101
|
+
path,
|
|
102
|
+
sectionTargeted: true,
|
|
103
|
+
created: false,
|
|
104
|
+
previousSizeInBytes,
|
|
105
|
+
currentSizeInBytes,
|
|
106
|
+
};
|
|
82
107
|
}
|
|
83
|
-
await svc.
|
|
84
|
-
|
|
85
|
-
|
|
108
|
+
const previousSizeInBytes = await svc.tryGetSize(ctx, pathTarget);
|
|
109
|
+
await svc.appendToNote(ctx, pathTarget, input.content, input.contentType);
|
|
110
|
+
const currentSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
111
|
+
return {
|
|
112
|
+
path,
|
|
113
|
+
sectionTargeted: false,
|
|
114
|
+
created: previousSizeInBytes === null,
|
|
115
|
+
previousSizeInBytes: previousSizeInBytes ?? 0,
|
|
116
|
+
currentSizeInBytes,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
format: (result) => {
|
|
120
|
+
const action = result.created ? 'Created' : 'Appended to';
|
|
121
|
+
const lines = [`**${action} ${result.path}**`];
|
|
122
|
+
if (result.created) {
|
|
123
|
+
lines.push('*Note:* this file did not exist before — your content is now the entire file. If you expected to add to existing content, double-check the path.');
|
|
124
|
+
}
|
|
125
|
+
lines.push(`*Size:* ${result.previousSizeInBytes} → ${result.currentSizeInBytes} bytes`);
|
|
126
|
+
lines.push(`*Created:* ${result.created}`);
|
|
127
|
+
lines.push(`*Section targeted:* ${result.sectionTargeted}`);
|
|
128
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
86
129
|
},
|
|
87
|
-
format: (result) => [
|
|
88
|
-
{
|
|
89
|
-
type: 'text',
|
|
90
|
-
text: [
|
|
91
|
-
`**Appended to ${result.path}**`,
|
|
92
|
-
`*Section targeted:* ${result.sectionTargeted}`,
|
|
93
|
-
].join('\n'),
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
130
|
});
|
|
97
131
|
//# sourceMappingURL=obsidian-append-to-note.tool.js.map
|
|
@@ -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
|
|
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;AAEtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,EAAE;IAClE,WAAW,EACT,qoBAAqoB;IACvoB,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,C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,CAAC,CAAC"}
|
|
@@ -26,6 +26,8 @@ export declare const obsidianDeleteNote: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
26
26
|
}, z.core.$strip>, z.ZodObject<{
|
|
27
27
|
path: z.ZodString;
|
|
28
28
|
deleted: z.ZodBoolean;
|
|
29
|
+
previousSizeInBytes: z.ZodNumber;
|
|
30
|
+
currentSizeInBytes: z.ZodNumber;
|
|
29
31
|
}, z.core.$strip>, readonly [{
|
|
30
32
|
readonly reason: "path_forbidden";
|
|
31
33
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-delete-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"obsidian-delete-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqG7B,CAAC"}
|
|
@@ -17,6 +17,12 @@ export const obsidianDeleteNote = tool('obsidian_delete_note', {
|
|
|
17
17
|
output: z.object({
|
|
18
18
|
path: z.string().describe('Resolved vault-relative path of the deleted note.'),
|
|
19
19
|
deleted: z.boolean().describe('True when the file was removed.'),
|
|
20
|
+
previousSizeInBytes: z
|
|
21
|
+
.number()
|
|
22
|
+
.describe('Byte size of the note immediately before deletion. The destructive blast radius — useful for confirming the agent destroyed what it expected.'),
|
|
23
|
+
currentSizeInBytes: z
|
|
24
|
+
.number()
|
|
25
|
+
.describe('Always 0 after a successful delete — the file no longer exists.'),
|
|
20
26
|
}),
|
|
21
27
|
auth: ['tool:obsidian_delete_note:write'],
|
|
22
28
|
errors: [
|
|
@@ -59,10 +65,16 @@ export const obsidianDeleteNote = tool('obsidian_delete_note', {
|
|
|
59
65
|
],
|
|
60
66
|
async handler(input, ctx) {
|
|
61
67
|
const svc = getObsidianService();
|
|
62
|
-
const
|
|
63
|
-
const
|
|
68
|
+
const path = await svc.resolvePath(ctx, input.target);
|
|
69
|
+
const pathTarget = { type: 'path', path };
|
|
70
|
+
/**
|
|
71
|
+
* Probe size before showing the elicitation prompt so the user sees how
|
|
72
|
+
* much they're about to destroy. Throws `note_missing` if the file is
|
|
73
|
+
* already gone — preempts a confusing post-elicit DELETE 404.
|
|
74
|
+
*/
|
|
75
|
+
const previousSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
64
76
|
if (ctx.elicit) {
|
|
65
|
-
const confirmed = await ctx.elicit(`Permanently delete '${path}'? This cannot be undone via the API; recovery would require Obsidian's local trash.`, z.object({
|
|
77
|
+
const confirmed = await ctx.elicit(`Permanently delete '${path}' (${previousSizeInBytes} bytes)? This cannot be undone via the API; recovery would require Obsidian's local trash.`, z.object({
|
|
66
78
|
confirm: z.boolean().describe('Set to true to delete the note. Any other value cancels.'),
|
|
67
79
|
}));
|
|
68
80
|
if (confirmed.action !== 'accept' || confirmed.content?.confirm !== true) {
|
|
@@ -72,13 +84,13 @@ export const obsidianDeleteNote = tool('obsidian_delete_note', {
|
|
|
72
84
|
});
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
|
-
await svc.deleteNote(ctx,
|
|
76
|
-
return { path, deleted: true };
|
|
87
|
+
await svc.deleteNote(ctx, pathTarget);
|
|
88
|
+
return { path, deleted: true, previousSizeInBytes, currentSizeInBytes: 0 };
|
|
77
89
|
},
|
|
78
90
|
format: (result) => [
|
|
79
91
|
{
|
|
80
92
|
type: 'text',
|
|
81
|
-
text: `**Deleted ${result.path}** (
|
|
93
|
+
text: `**Deleted ${result.path}** (size: ${result.previousSizeInBytes} → ${result.currentSizeInBytes} bytes)`,
|
|
82
94
|
},
|
|
83
95
|
],
|
|
84
96
|
});
|
|
@@ -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;;;;;GAKG;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,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IAC7D,WAAW,EACT,iNAAiN;IACnN,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KACvD,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9E,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-delete-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO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C,CAAC;YACL,CAAC;QACH,CAAC;QAED,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;IAC7E,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,aAAa,MAAM,CAAC,IAAI,aAAa,MAAM,CAAC,mBAAmB,MAAM,MAAM,CAAC,kBAAkB,SAAS;SAC9G;KACF;CACF,CAAC,CAAC"}
|
|
@@ -42,11 +42,15 @@ export declare const obsidianManageFrontmatter: import("@cyanheads/mcp-ts-core")
|
|
|
42
42
|
path: z.ZodString;
|
|
43
43
|
key: z.ZodString;
|
|
44
44
|
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
45
|
+
previousSizeInBytes: z.ZodNumber;
|
|
46
|
+
currentSizeInBytes: z.ZodNumber;
|
|
45
47
|
}, z.core.$strip>, z.ZodObject<{
|
|
46
48
|
operation: z.ZodLiteral<"delete">;
|
|
47
49
|
path: z.ZodString;
|
|
48
50
|
key: z.ZodString;
|
|
49
51
|
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
52
|
+
previousSizeInBytes: z.ZodNumber;
|
|
53
|
+
currentSizeInBytes: z.ZodNumber;
|
|
50
54
|
}, z.core.$strip>], "operation">;
|
|
51
55
|
}, z.core.$strip>, readonly [{
|
|
52
56
|
readonly reason: "path_forbidden";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-manage-frontmatter.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"obsidian-manage-frontmatter.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkNpC,CAAC"}
|
|
@@ -43,6 +43,8 @@ export const obsidianManageFrontmatter = tool('obsidian_manage_frontmatter', {
|
|
|
43
43
|
frontmatter: z
|
|
44
44
|
.record(z.string(), z.unknown())
|
|
45
45
|
.describe('Full frontmatter after the change.'),
|
|
46
|
+
previousSizeInBytes: z.number().describe('Byte size of the note before the set.'),
|
|
47
|
+
currentSizeInBytes: z.number().describe('Byte size of the note after the set.'),
|
|
46
48
|
})
|
|
47
49
|
.describe('Result for `set`.'),
|
|
48
50
|
z
|
|
@@ -53,6 +55,10 @@ export const obsidianManageFrontmatter = tool('obsidian_manage_frontmatter', {
|
|
|
53
55
|
frontmatter: z
|
|
54
56
|
.record(z.string(), z.unknown())
|
|
55
57
|
.describe('Full frontmatter after the change.'),
|
|
58
|
+
previousSizeInBytes: z.number().describe('Byte size of the note before the delete.'),
|
|
59
|
+
currentSizeInBytes: z
|
|
60
|
+
.number()
|
|
61
|
+
.describe('Byte size of the note after the delete. Equals `previousSizeInBytes` when the key was already absent and no write was issued.'),
|
|
56
62
|
})
|
|
57
63
|
.describe('Result for `delete`.'),
|
|
58
64
|
])
|
|
@@ -120,27 +126,38 @@ export const obsidianManageFrontmatter = tool('obsidian_manage_frontmatter', {
|
|
|
120
126
|
...ctx.recoveryFor('value_required'),
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
|
-
await svc.
|
|
129
|
+
const path = await svc.resolvePath(ctx, target);
|
|
130
|
+
const pathTarget = { type: 'path', path };
|
|
131
|
+
const previousSizeInBytes = await svc.getSize(ctx, pathTarget);
|
|
132
|
+
await svc.patchNote(ctx, pathTarget, JSON.stringify(input.value), {
|
|
124
133
|
operation: 'replace',
|
|
125
134
|
targetType: 'frontmatter',
|
|
126
135
|
target: input.key,
|
|
127
136
|
contentType: 'json',
|
|
128
137
|
createTargetIfMissing: true,
|
|
129
138
|
});
|
|
130
|
-
const note = await svc.getNoteJson(ctx,
|
|
139
|
+
const note = await svc.getNoteJson(ctx, pathTarget);
|
|
140
|
+
// Delivered bytes — not note.stat.size (see ObsidianService.tryGetSize).
|
|
141
|
+
const currentSizeInBytes = Buffer.byteLength(note.content, 'utf8');
|
|
131
142
|
return {
|
|
132
143
|
result: {
|
|
133
144
|
operation: 'set',
|
|
134
|
-
path
|
|
145
|
+
path,
|
|
135
146
|
key: input.key,
|
|
136
147
|
frontmatter: note.frontmatter,
|
|
148
|
+
previousSizeInBytes,
|
|
149
|
+
currentSizeInBytes,
|
|
137
150
|
},
|
|
138
151
|
};
|
|
139
152
|
}
|
|
140
153
|
const note = await svc.getNoteJson(ctx, target);
|
|
154
|
+
// Delivered bytes — not note.stat.size (see ObsidianService.tryGetSize).
|
|
155
|
+
const previousSizeInBytes = Buffer.byteLength(note.content, 'utf8');
|
|
141
156
|
const newContent = deleteFrontmatterKey(note.content, input.key);
|
|
157
|
+
let currentSizeInBytes = previousSizeInBytes;
|
|
142
158
|
if (newContent !== note.content) {
|
|
143
159
|
await svc.writeNote(ctx, target, newContent, 'markdown');
|
|
160
|
+
currentSizeInBytes = await svc.getSize(ctx, { type: 'path', path: note.path });
|
|
144
161
|
}
|
|
145
162
|
const projected = { ...note.frontmatter };
|
|
146
163
|
delete projected[input.key];
|
|
@@ -150,6 +167,8 @@ export const obsidianManageFrontmatter = tool('obsidian_manage_frontmatter', {
|
|
|
150
167
|
path: note.path,
|
|
151
168
|
key: input.key,
|
|
152
169
|
frontmatter: projected,
|
|
170
|
+
previousSizeInBytes,
|
|
171
|
+
currentSizeInBytes,
|
|
153
172
|
},
|
|
154
173
|
};
|
|
155
174
|
},
|
|
@@ -171,6 +190,7 @@ export const obsidianManageFrontmatter = tool('obsidian_manage_frontmatter', {
|
|
|
171
190
|
const fmKeys = Object.keys(result.frontmatter);
|
|
172
191
|
const lines = [
|
|
173
192
|
`**Frontmatter ${result.operation} \`${result.key}\` in ${result.path}**`,
|
|
193
|
+
`*Size:* ${result.previousSizeInBytes} → ${result.currentSizeInBytes} bytes`,
|
|
174
194
|
'',
|
|
175
195
|
`**Frontmatter (${fmKeys.length} keys after change)**`,
|
|
176
196
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-manage-frontmatter.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,6BAA6B,EAAE;IAC3E,WAAW,EACT,sJAAsJ;IACxJ,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC9B,QAAQ,CACP,+JAA+J,CACh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AC,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-manage-frontmatter.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,6BAA6B,EAAE;IAC3E,WAAW,EACT,sJAAsJ;IACxJ,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC9B,QAAQ,CACP,+JAA+J,CAChK;QACH,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACtD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAC1D,KAAK,EAAE,CAAC;aACL,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CACP,iIAAiI,CAClI;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC;aACN,kBAAkB,CAAC,WAAW,EAAE;YAC/B,CAAC;iBACE,MAAM,CAAC;gBACN,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBACzD,IA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EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,CAAU;IAC7B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACnD,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACpC,CAAC"}
|
|
@@ -50,12 +50,16 @@ export declare const obsidianManageTags: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
50
50
|
applied: z.ZodArray<z.ZodString>;
|
|
51
51
|
skipped: z.ZodArray<z.ZodString>;
|
|
52
52
|
tags: z.ZodArray<z.ZodString>;
|
|
53
|
+
previousSizeInBytes: z.ZodNumber;
|
|
54
|
+
currentSizeInBytes: z.ZodNumber;
|
|
53
55
|
}, z.core.$strip>, z.ZodObject<{
|
|
54
56
|
operation: z.ZodLiteral<"remove">;
|
|
55
57
|
path: z.ZodString;
|
|
56
58
|
applied: z.ZodArray<z.ZodString>;
|
|
57
59
|
skipped: z.ZodArray<z.ZodString>;
|
|
58
60
|
tags: z.ZodArray<z.ZodString>;
|
|
61
|
+
previousSizeInBytes: z.ZodNumber;
|
|
62
|
+
currentSizeInBytes: z.ZodNumber;
|
|
59
63
|
}, z.core.$strip>], "operation">;
|
|
60
64
|
}, z.core.$strip>, readonly [{
|
|
61
65
|
readonly reason: "path_forbidden";
|