obsidian-mcp-server 3.6.0 → 3.7.0
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 +40 -27
- package/CLAUDE.md +40 -27
- package/Dockerfile +90 -47
- package/README.md +130 -151
- package/changelog/3.6.x/3.6.1.md +29 -0
- package/changelog/3.7.x/3.7.0.md +34 -0
- package/dist/config/server-config.d.ts +1 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +4 -0
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +30 -10
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +7 -5
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +12 -8
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +32 -10
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +30 -8
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +230 -294
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/index.js +9 -3
- package/dist/mcp-server/tools/definitions/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +1 -1
- 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 +108 -10
- 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 +254 -133
- 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 +1 -0
- 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 +62 -21
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js +1 -2
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +6 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +9 -12
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts +7 -5
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +14 -9
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.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 +1 -2
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +4 -1
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +15 -4
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.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 +2 -3
- 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.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +2 -5
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -1
- package/dist/services/obsidian/obsidian-service.d.ts +7 -0
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
- package/dist/services/obsidian/obsidian-service.js +72 -35
- package/dist/services/obsidian/obsidian-service.js.map +1 -1
- package/dist/services/obsidian/patch-instruction.d.ts +20 -1
- package/dist/services/obsidian/patch-instruction.d.ts.map +1 -1
- package/dist/services/obsidian/patch-instruction.js +30 -0
- package/dist/services/obsidian/patch-instruction.js.map +1 -1
- package/dist/services/obsidian/path-policy.d.ts +23 -1
- package/dist/services/obsidian/path-policy.d.ts.map +1 -1
- package/dist/services/obsidian/path-policy.js +45 -3
- package/dist/services/obsidian/path-policy.js.map +1 -1
- package/dist/services/obsidian/section-extractor.d.ts +24 -0
- package/dist/services/obsidian/section-extractor.d.ts.map +1 -1
- package/dist/services/obsidian/section-extractor.js +37 -0
- package/dist/services/obsidian/section-extractor.js.map +1 -1
- package/manifest.json +9 -1
- package/package.json +13 -10
- package/server.json +24 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA
|
|
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;;;;;;;;;;;;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;;;;;iBAOhC,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiD,CAAC"}
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* module free of eager config reads. `obsidian_search_notes` is exposed as a
|
|
8
8
|
* factory (`buildSearchNotesTool`) because its mode enum is conditional on
|
|
9
9
|
* Omnisearch reachability, which is only known after the startup probe runs.
|
|
10
|
+
* `obsidian_delete_note` is exposed as a factory (`buildDeleteNoteTool`)
|
|
11
|
+
* because its description and confirmation round follow
|
|
12
|
+
* `OBSIDIAN_DELETE_ELICITATION`, which the entry point reads.
|
|
10
13
|
* @module mcp-server/tools/definitions/index
|
|
11
14
|
*/
|
|
12
15
|
import { obsidianAppendToNote } from './obsidian-append-to-note.tool.js';
|
|
13
|
-
import { obsidianDeleteNote } from './obsidian-delete-note.tool.js';
|
|
14
16
|
import { obsidianExecuteCommand } from './obsidian-execute-command.tool.js';
|
|
15
17
|
import { obsidianGetNote } from './obsidian-get-note.tool.js';
|
|
16
18
|
import { obsidianListCommands } from './obsidian-list-commands.tool.js';
|
|
@@ -22,6 +24,7 @@ import { obsidianOpenInUi } from './obsidian-open-in-ui.tool.js';
|
|
|
22
24
|
import { obsidianPatchNote } from './obsidian-patch-note.tool.js';
|
|
23
25
|
import { obsidianReplaceInNote } from './obsidian-replace-in-note.tool.js';
|
|
24
26
|
import { obsidianWriteNote } from './obsidian-write-note.tool.js';
|
|
27
|
+
export { buildDeleteNoteTool } from './obsidian-delete-note.tool.js';
|
|
25
28
|
export { buildSearchNotesTool } from './obsidian-search-notes.tool.js';
|
|
26
29
|
/**
|
|
27
30
|
* Tools that don't depend on runtime probes — always registered, even with
|
|
@@ -42,7 +45,11 @@ export const readToolDefinitions = [
|
|
|
42
45
|
obsidianListTags,
|
|
43
46
|
obsidianOpenInUi,
|
|
44
47
|
];
|
|
45
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Write tools — wrapped with `disabledTool()` when `OBSIDIAN_READ_ONLY=true`.
|
|
50
|
+
* `obsidian_delete_note` joins this set in the entry point, built via
|
|
51
|
+
* `buildDeleteNoteTool`.
|
|
52
|
+
*/
|
|
46
53
|
export const writeToolDefinitions = [
|
|
47
54
|
obsidianWriteNote,
|
|
48
55
|
obsidianAppendToNote,
|
|
@@ -50,7 +57,6 @@ export const writeToolDefinitions = [
|
|
|
50
57
|
obsidianReplaceInNote,
|
|
51
58
|
obsidianManageFrontmatter,
|
|
52
59
|
obsidianManageTags,
|
|
53
|
-
obsidianDeleteNote,
|
|
54
60
|
];
|
|
55
61
|
/** Command-palette tools — opt-in via `OBSIDIAN_ENABLE_COMMANDS=true`; suppressed by `OBSIDIAN_READ_ONLY=true`. */
|
|
56
62
|
export const commandToolDefinitions = [obsidianListCommands, obsidianExecuteCommand];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,qBAAqB;IACrB,yBAAyB;IACzB,kBAAkB;CACnB,CAAC;AAEF,mHAAmH;AACnH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ 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
13
|
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).** 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.',
|
|
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
15
|
annotations: { destructiveHint: true },
|
|
16
16
|
input: z.object({
|
|
17
17
|
target: TargetSchema.describe('Where the note lives.'),
|
|
@@ -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;AAEtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,EAAE;IAClE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"obsidian-append-to-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian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O,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;QAC1D,MAAM,KAAK,GAAG,CAAC,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CACR,kJAAkJ,CACnJ,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,mBAAmB,MAAM,MAAM,CAAC,kBAAkB,QAAQ,CAAC,CAAC;QACzF,KAAK,CAAC,IAAI,CAAC,cAAc,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CACR,uBAAuB,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3G,CAAC;QACF,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview obsidian_delete_note — permanently delete a note.
|
|
2
|
+
* @fileoverview obsidian_delete_note — permanently delete a note. Built by a
|
|
3
|
+
* factory because the confirmation is an operator choice
|
|
4
|
+
* (`OBSIDIAN_DELETE_ELICITATION`, read in the entry point): off, the handler
|
|
5
|
+
* checks write scope, reads the note, and deletes. On, it suspends via
|
|
3
6
|
* `ctx.requestInput` to confirm with the user before the DELETE, and is
|
|
4
|
-
* re-entered with the answer on `ctx.inputs
|
|
7
|
+
* re-entered with the answer on `ctx.inputs`; the answer counts only on a
|
|
8
|
+
* round that redeems the consent record this handler stored when it asked.
|
|
5
9
|
* @module mcp-server/tools/definitions/obsidian-delete-note.tool
|
|
6
10
|
*/
|
|
7
11
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
12
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* `elicitation` mirrors `OBSIDIAN_DELETE_ELICITATION`. Off, the operator's
|
|
15
|
+
* `OBSIDIAN_WRITE_PATHS` / `OBSIDIAN_READ_ONLY` are what bound a delete — the
|
|
16
|
+
* same bound `obsidian_write_note` with `overwrite: true` already has.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildDeleteNoteTool({ elicitation }: {
|
|
19
|
+
elicitation: boolean;
|
|
20
|
+
}): import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
10
21
|
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
22
|
type: z.ZodLiteral<"path">;
|
|
12
23
|
path: z.ZodString;
|
|
@@ -34,18 +45,105 @@ export declare const obsidianDeleteNote: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
34
45
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
35
46
|
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
36
47
|
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
37
|
-
}, {
|
|
38
|
-
readonly reason:
|
|
48
|
+
}, ...{
|
|
49
|
+
readonly reason: 'cancelled';
|
|
39
50
|
readonly code: JsonRpcErrorCode.InvalidRequest;
|
|
40
|
-
readonly when:
|
|
41
|
-
readonly severity:
|
|
42
|
-
readonly recovery:
|
|
51
|
+
readonly when: 'User declined, cancelled, or answered false to the confirmation request.';
|
|
52
|
+
readonly severity: 'notice';
|
|
53
|
+
readonly recovery: 'Re-run the tool when the user is ready to confirm deletion.';
|
|
54
|
+
}[], {
|
|
55
|
+
readonly reason: "note_missing";
|
|
56
|
+
readonly thrownBy: "service";
|
|
57
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
58
|
+
readonly when: "No note has exactly this vault path, letter case included. Near matches in the same folder, such as a different-case spelling, are listed in `suggestions` and never deleted in its place.";
|
|
59
|
+
readonly recovery: "Verify the path with obsidian_list_notes or use obsidian_search_notes to locate the note. Deletes match the path exactly, letter case included; pass a path from `suggestions` as given.";
|
|
60
|
+
}, {
|
|
61
|
+
readonly reason: "no_active_file";
|
|
62
|
+
readonly thrownBy: "service";
|
|
63
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
64
|
+
readonly when: "Target was `active` but no file is currently open in Obsidian.";
|
|
65
|
+
readonly recovery: "Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead.";
|
|
66
|
+
}, {
|
|
67
|
+
readonly reason: "periodic_unsupported";
|
|
68
|
+
readonly thrownBy: "service";
|
|
69
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
70
|
+
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.";
|
|
71
|
+
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.";
|
|
72
|
+
}, {
|
|
73
|
+
readonly reason: "periodic_not_found";
|
|
74
|
+
readonly thrownBy: "service";
|
|
75
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
76
|
+
readonly when: "Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period.";
|
|
77
|
+
readonly recovery: "Pass an explicit path target — periodic notes must already exist.";
|
|
78
|
+
}, {
|
|
79
|
+
readonly reason: "periodic_disabled";
|
|
80
|
+
readonly thrownBy: "service";
|
|
81
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
82
|
+
readonly when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings.";
|
|
83
|
+
readonly recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin.";
|
|
84
|
+
}, {
|
|
85
|
+
readonly reason: "path_is_directory";
|
|
86
|
+
readonly thrownBy: "service";
|
|
87
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
88
|
+
readonly when: "The supplied path names a folder rather than a note file. Deleting a folder is not offered — the upstream removes it and everything inside it in one unrecoverable step.";
|
|
89
|
+
readonly recovery: "Call obsidian_list_notes with this path to list the folder, then delete files one at a time by their full paths.";
|
|
43
90
|
}, {
|
|
91
|
+
readonly reason: "path_traversal";
|
|
92
|
+
readonly thrownBy: "service";
|
|
93
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
94
|
+
readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape.";
|
|
95
|
+
readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault.";
|
|
96
|
+
}], undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Static specimen for the MCP definition linter (which duck-types tool
|
|
99
|
+
* exports out of each `.tool.ts` file) and for tests that import the tool
|
|
100
|
+
* directly. Built with the confirmation off — the default, and what an
|
|
101
|
+
* unconfigured install registers. The entry point (`src/index.ts`) builds the
|
|
102
|
+
* live tool via `buildDeleteNoteTool` from `OBSIDIAN_DELETE_ELICITATION`; this
|
|
103
|
+
* export is not the registered tool. The confirming variant is exercised by
|
|
104
|
+
* tests rather than the linter (two exports under the same tool name would
|
|
105
|
+
* collide on `name-unique`).
|
|
106
|
+
*/
|
|
107
|
+
export declare const obsidianDeleteNote: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
108
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"path">;
|
|
110
|
+
path: z.ZodString;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"active">;
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"periodic">;
|
|
115
|
+
period: z.ZodEnum<{
|
|
116
|
+
daily: "daily";
|
|
117
|
+
monthly: "monthly";
|
|
118
|
+
quarterly: "quarterly";
|
|
119
|
+
weekly: "weekly";
|
|
120
|
+
yearly: "yearly";
|
|
121
|
+
}>;
|
|
122
|
+
date: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strip>], "type">;
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
+
path: z.ZodString;
|
|
126
|
+
deleted: z.ZodBoolean;
|
|
127
|
+
previousSizeInBytes: z.ZodNumber;
|
|
128
|
+
currentSizeInBytes: z.ZodNumber;
|
|
129
|
+
}, z.core.$strip>, readonly [{
|
|
130
|
+
readonly reason: "path_forbidden";
|
|
131
|
+
readonly thrownBy: "service";
|
|
132
|
+
readonly code: JsonRpcErrorCode.Forbidden;
|
|
133
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
134
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
135
|
+
}, ...{
|
|
136
|
+
readonly reason: 'cancelled';
|
|
137
|
+
readonly code: JsonRpcErrorCode.InvalidRequest;
|
|
138
|
+
readonly when: 'User declined, cancelled, or answered false to the confirmation request.';
|
|
139
|
+
readonly severity: 'notice';
|
|
140
|
+
readonly recovery: 'Re-run the tool when the user is ready to confirm deletion.';
|
|
141
|
+
}[], {
|
|
44
142
|
readonly reason: "note_missing";
|
|
45
143
|
readonly thrownBy: "service";
|
|
46
144
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
47
|
-
readonly when: "
|
|
48
|
-
readonly recovery: "Verify the path with obsidian_list_notes or use obsidian_search_notes to locate the note.";
|
|
145
|
+
readonly when: "No note has exactly this vault path, letter case included. Near matches in the same folder, such as a different-case spelling, are listed in `suggestions` and never deleted in its place.";
|
|
146
|
+
readonly recovery: "Verify the path with obsidian_list_notes or use obsidian_search_notes to locate the note. Deletes match the path exactly, letter case included; pass a path from `suggestions` as given.";
|
|
49
147
|
}, {
|
|
50
148
|
readonly reason: "no_active_file";
|
|
51
149
|
readonly thrownBy: "service";
|
|
@@ -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
|
|
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;;;;;;;;;GASG;AAIH,OAAO,EAAqC,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAsB,MAAM,+BAA+B,CAAC;AA6DrF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCvD,WAAW;;mBAEb,0EAA0E;uBACtE,QAAQ;uBACR,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgKpF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAhLT,WAAW;;mBAEb,0EAA0E;uBACtE,QAAQ;uBACR,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4KR,CAAC"}
|