obsidian-mcp-server 3.7.2 → 3.8.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 +10 -7
- package/CLAUDE.md +10 -7
- package/README.md +22 -14
- package/changelog/3.8.x/3.8.0.md +38 -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 +24 -15
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +21 -7
- package/dist/instructions.js.map +1 -1
- package/dist/mcp-server/resources/definitions/index.d.ts +2 -2
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +3 -2
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +6 -5
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts +2 -2
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +2 -2
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +14 -5
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +18 -18
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +2 -2
- 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 +7 -6
- 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 +7 -7
- 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 +2 -2
- 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 +8 -5
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +6 -6
- 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 +8 -8
- 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 +4 -4
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +6 -6
- 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 +2 -2
- 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 +2 -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.d.ts +2 -2
- 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 +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 +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +2 -2
- 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 +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +2 -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 +46 -12
- 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 +77 -22
- 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 +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -1
- package/dist/services/obsidian/jsonlogic-evaluator.d.ts +33 -8
- package/dist/services/obsidian/jsonlogic-evaluator.d.ts.map +1 -1
- package/dist/services/obsidian/jsonlogic-evaluator.js +171 -32
- package/dist/services/obsidian/jsonlogic-evaluator.js.map +1 -1
- package/dist/services/obsidian/jsonlogic-worker.d.ts +6 -5
- package/dist/services/obsidian/jsonlogic-worker.d.ts.map +1 -1
- package/dist/services/obsidian/jsonlogic-worker.js +7 -5
- package/dist/services/obsidian/jsonlogic-worker.js.map +1 -1
- package/dist/services/obsidian/obsidian-service.d.ts +38 -22
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
- package/dist/services/obsidian/obsidian-service.js +293 -99
- package/dist/services/obsidian/obsidian-service.js.map +1 -1
- package/dist/services/obsidian/patch-instruction.d.ts +4 -1
- package/dist/services/obsidian/patch-instruction.d.ts.map +1 -1
- package/dist/services/obsidian/patch-instruction.js +5 -2
- package/dist/services/obsidian/patch-instruction.js.map +1 -1
- package/dist/services/obsidian/path-policy.d.ts +67 -23
- package/dist/services/obsidian/path-policy.d.ts.map +1 -1
- package/dist/services/obsidian/path-policy.js +183 -80
- package/dist/services/obsidian/path-policy.js.map +1 -1
- package/dist/services/obsidian/section-extractor.d.ts +6 -1
- package/dist/services/obsidian/section-extractor.d.ts.map +1 -1
- package/dist/services/obsidian/section-extractor.js +106 -11
- package/dist/services/obsidian/section-extractor.js.map +1 -1
- package/dist/services/obsidian/simple-search.d.ts +62 -0
- package/dist/services/obsidian/simple-search.d.ts.map +1 -0
- package/dist/services/obsidian/simple-search.js +264 -0
- package/dist/services/obsidian/simple-search.js.map +1 -0
- package/manifest.json +10 -2
- package/package.json +3 -3
- package/server.json +19 -7
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Not a mirror of `obsidian_list_tags`: this is a snapshot of
|
|
6
6
|
* `ObsidianService.listTags`, returned whole and unsorted — the upstream
|
|
7
|
-
* `/tags/` payload in upstream order, or under OBSIDIAN_READ_PATHS
|
|
8
|
-
* readable notes in order of first
|
|
7
|
+
* `/tags/` payload in upstream order, or under OBSIDIAN_READ_PATHS or
|
|
8
|
+
* OBSIDIAN_DENY_PATHS the tags of readable notes in order of first
|
|
9
|
+
* appearance. The tool shapes the same
|
|
9
10
|
* payload for an LLM caller — count-descending, capped, filterable — and that
|
|
10
11
|
* shaping deliberately lives in the tool handler rather than the shared
|
|
11
12
|
* service call both make.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-tags.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-tags.resource.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"obsidian-tags.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-tags.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGrD,eAAO,MAAM,YAAY;;;;;6BA+BvB,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Not a mirror of `obsidian_list_tags`: this is a snapshot of
|
|
6
6
|
* `ObsidianService.listTags`, returned whole and unsorted — the upstream
|
|
7
|
-
* `/tags/` payload in upstream order, or under OBSIDIAN_READ_PATHS
|
|
8
|
-
* readable notes in order of first
|
|
7
|
+
* `/tags/` payload in upstream order, or under OBSIDIAN_READ_PATHS or
|
|
8
|
+
* OBSIDIAN_DENY_PATHS the tags of readable notes in order of first
|
|
9
|
+
* appearance. The tool shapes the same
|
|
9
10
|
* payload for an LLM caller — count-descending, capped, filterable — and that
|
|
10
11
|
* shaping deliberately lives in the tool handler rather than the shared
|
|
11
12
|
* service call both make.
|
|
@@ -15,7 +16,7 @@ import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
|
15
16
|
import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
|
|
16
17
|
export const obsidianTags = resource('obsidian://tags', {
|
|
17
18
|
name: 'obsidian-tags',
|
|
18
|
-
description: 'All tags found in the Obsidian vault, with usage counts, unsorted and uncapped — a full snapshot. When OBSIDIAN_READ_PATHS is set, only tags carried by readable notes. Includes hierarchical parents (e.g. `work` for `work/tasks`). Use the `obsidian_list_tags` tool for a count-ranked, capped, filterable view.',
|
|
19
|
+
description: 'All tags found in the Obsidian vault, with usage counts, unsorted and uncapped — a full snapshot. When OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS is set, only tags carried by readable notes. Includes hierarchical parents (e.g. `work` for `work/tasks`). Use the `obsidian_list_tags` tool for a count-ranked, capped, filterable view.',
|
|
19
20
|
mimeType: 'application/json',
|
|
20
21
|
params: z.object({}),
|
|
21
22
|
output: z.object({
|
|
@@ -25,10 +26,10 @@ export const obsidianTags = resource('obsidian://tags', {
|
|
|
25
26
|
name: z.string().describe('Tag name without the leading `#`.'),
|
|
26
27
|
count: z
|
|
27
28
|
.number()
|
|
28
|
-
.describe('Times the tag, or a tag nested under it, occurs across the vault. When OBSIDIAN_READ_PATHS is set: the number of readable notes carrying the tag or a tag nested under it.'),
|
|
29
|
+
.describe('Times the tag, or a tag nested under it, occurs across the vault. When OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS is set: the number of readable notes carrying the tag or a tag nested under it.'),
|
|
29
30
|
})
|
|
30
31
|
.describe('A tag with its usage count.'))
|
|
31
|
-
.describe('Every tag in the vault, in the order the Local REST API reports them. When OBSIDIAN_READ_PATHS is set: every tag carried by a readable note, in order of first appearance.'),
|
|
32
|
+
.describe('Every tag in the vault, in the order the Local REST API reports them. When OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS is set: every tag carried by a readable note, in order of first appearance.'),
|
|
32
33
|
}),
|
|
33
34
|
auth: ['resource:obsidian-tags:read'],
|
|
34
35
|
async handler(_params, ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-tags.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-tags.resource.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"obsidian-tags.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-tags.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,iBAAiB,EAAE;IACtD,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,6UAA6U;IAC/U,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC;aACJ,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YAC9D,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CACP,mMAAmM,CACpM;SACJ,CAAC;aACD,QAAQ,CAAC,6BAA6B,CAAC,CAC3C;aACA,QAAQ,CACP,mMAAmM,CACpM;KACJ,CAAC;IACF,IAAI,EAAE,CAAC,6BAA6B,CAAC;IAErC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;QACxB,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;IACvE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -21,8 +21,8 @@ export declare const obsidianVaultNote: import("@cyanheads/mcp-ts-core").Resourc
|
|
|
21
21
|
}, z.core.$strip>, readonly [{
|
|
22
22
|
readonly reason: "path_forbidden";
|
|
23
23
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
24
|
-
readonly when: "The requested path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access).";
|
|
25
|
-
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope.";
|
|
24
|
+
readonly when: "The requested path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access), or inside OBSIDIAN_DENY_PATHS.";
|
|
25
|
+
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
26
26
|
}, {
|
|
27
27
|
readonly reason: "note_missing";
|
|
28
28
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
@@ -34,8 +34,8 @@ export const obsidianVaultNote = resource('obsidian://vault/{+path}', {
|
|
|
34
34
|
{
|
|
35
35
|
reason: 'path_forbidden',
|
|
36
36
|
code: JsonRpcErrorCode.Forbidden,
|
|
37
|
-
when: 'The requested path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access).',
|
|
38
|
-
recovery: 'Use a path inside the configured read scope. The error data echoes the active scope.',
|
|
37
|
+
when: 'The requested path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access), or inside OBSIDIAN_DENY_PATHS.',
|
|
38
|
+
recovery: 'Use a path inside the configured read scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.',
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
reason: 'note_missing',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-vault-note.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-vault-note.resource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,0BAA0B,EAAE;IACpE,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,yJAAyJ;IAC3J,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC;KAC1F,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC7D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAClD,WAAW,EAAE,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;aAC/B,QAAQ,CACP,4FAA4F,CAC7F;QACH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,+CAA+C,CAAC;QACnF,IAAI,EAAE,CAAC;aACJ,MAAM,CAAC;YACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;YAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;SACjD,CAAC;aACD,QAAQ,CAAC,gBAAgB,CAAC;KAC9B,CAAC;IACF,IAAI,EAAE,CAAC,mCAAmC,CAAC;IAC3C,MAAM,EAAE;QACN;YACE,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,gBAAgB,CAAC,SAAS;YAChC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"obsidian-vault-note.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/obsidian-vault-note.resource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,iBAAiB,GA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,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,sDAAsD;YAC5D,QAAQ,EACN,2FAA2F;SAC9F;QACD;YACE,MAAM,EAAE,mBAAmB;YAC3B,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,IAAI,EAAE,4DAA4D;YAClE,QAAQ,EACN,kHAAkH;SACrH;KACF;IAED,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,EAAE;QACvD,IAAI,CAAC;YACH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @module mcp-server/tools/definitions/_shared/suggest-paths
|
|
27
27
|
*/
|
|
28
28
|
import type { Context } from '@cyanheads/mcp-ts-core';
|
|
29
|
-
import type
|
|
29
|
+
import { type ObsidianService } from '../../../../services/obsidian/obsidian-service.js';
|
|
30
30
|
import type { NoteTarget } from '../../../../services/obsidian/types.js';
|
|
31
31
|
/** Outcome of {@link withCaseFallback}; `requestedPath` is present only when another path was read. */
|
|
32
32
|
export type CaseFallback<T> = {
|
|
@@ -58,6 +58,13 @@ export type CaseFallback<T> = {
|
|
|
58
58
|
* `requestedPath` is present only on the single-case-match branch.
|
|
59
59
|
*/
|
|
60
60
|
export declare function withCaseFallback<T>(ctx: Context, svc: ObsidianService, target: NoteTarget, fn: (target: NoteTarget) => Promise<T>): Promise<CaseFallback<T>>;
|
|
61
|
+
/**
|
|
62
|
+
* A not-found `message` with `suggestions` appended as a "did you mean"
|
|
63
|
+
* question. The message's trailing whitespace, and one `.`, `!`, or `?` before
|
|
64
|
+
* it, are dropped first: what `/[.!?]?\s*$/` drops, in time linear in the
|
|
65
|
+
* message, where the regex retries at every whitespace run inside it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function didYouMean(message: string, suggestions: readonly string[]): string;
|
|
61
68
|
/**
|
|
62
69
|
* Disclose a `withCaseFallback` substitution on the caller's enrichment: the
|
|
63
70
|
* `requestedPath` field plus a one-line notice naming both paths. `action` is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-paths.d.ts","sourceRoot":"","sources":["../../../../../src/mcp-server/tools/definitions/_shared/suggest-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"suggest-paths.d.ts","sourceRoot":"","sources":["../../../../../src/mcp-server/tools/definitions/_shared/suggest-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAY/D,uGAAuG;AACvG,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,MAAM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ACZ,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAYpE;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,CAAC,CASZ"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* @module mcp-server/tools/definitions/_shared/suggest-paths
|
|
27
27
|
*/
|
|
28
28
|
import { conflict, JsonRpcErrorCode, McpError, notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
29
|
+
import { trimSlashes } from '../../../../services/obsidian/obsidian-service.js';
|
|
29
30
|
import { inlineCode } from './markdown.js';
|
|
30
31
|
const MAX_SUGGESTIONS = 5;
|
|
31
32
|
/**
|
|
@@ -75,11 +76,19 @@ export async function withCaseFallback(ctx, svc, target, fn) {
|
|
|
75
76
|
if (probe.extInsensitive.length === 0)
|
|
76
77
|
throw err;
|
|
77
78
|
const suggestions = probe.extInsensitive.slice(0, MAX_SUGGESTIONS);
|
|
78
|
-
|
|
79
|
-
const prefix = err.message.replace(/[.!?]?\s*$/, '');
|
|
80
|
-
throw notFound(`${prefix}. Did you mean: ${list}?`, { ...(err.data ?? {}), suggestions }, { cause: err });
|
|
79
|
+
throw notFound(didYouMean(err.message, suggestions), { ...(err.data ?? {}), suggestions }, { cause: err });
|
|
81
80
|
}
|
|
82
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* A not-found `message` with `suggestions` appended as a "did you mean"
|
|
84
|
+
* question. The message's trailing whitespace, and one `.`, `!`, or `?` before
|
|
85
|
+
* it, are dropped first: what `/[.!?]?\s*$/` drops, in time linear in the
|
|
86
|
+
* message, where the regex retries at every whitespace run inside it.
|
|
87
|
+
*/
|
|
88
|
+
export function didYouMean(message, suggestions) {
|
|
89
|
+
const list = suggestions.map((s) => `"${s}"`).join(', ');
|
|
90
|
+
return `${message.trimEnd().replace(/[.!?]$/, '')}. Did you mean: ${list}?`;
|
|
91
|
+
}
|
|
83
92
|
/**
|
|
84
93
|
* Disclose a `withCaseFallback` substitution on the caller's enrichment: the
|
|
85
94
|
* `requestedPath` field plus a one-line notice naming both paths. `action` is
|
|
@@ -117,7 +126,7 @@ export async function findSimilarPaths(ctx, svc, path) {
|
|
|
117
126
|
*/
|
|
118
127
|
export async function findCaseVariants(ctx, svc, path) {
|
|
119
128
|
const { caseMatches } = await probeParentDir(ctx, svc, path);
|
|
120
|
-
const normalized = path
|
|
129
|
+
const normalized = trimSlashes(path);
|
|
121
130
|
return {
|
|
122
131
|
exact: caseMatches.includes(normalized),
|
|
123
132
|
variants: caseMatches.filter((match) => match !== normalized),
|
|
@@ -162,7 +171,7 @@ export async function withCaseVariantNamed(ctx, svc, path, write) {
|
|
|
162
171
|
}
|
|
163
172
|
async function probeParentDir(ctx, svc, path) {
|
|
164
173
|
const empty = { caseMatches: [], extInsensitive: [] };
|
|
165
|
-
const normalized = path
|
|
174
|
+
const normalized = trimSlashes(path);
|
|
166
175
|
if (!normalized)
|
|
167
176
|
return empty;
|
|
168
177
|
const slash = normalized.lastIndexOf('/');
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"suggest-paths.js","sourceRoot":"","sources":["../../../../../src/mcp-server/tools/definitions/_shared/sugg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,EAAE,CAAC;IAEpC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,SAAS;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,cAAc,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE,CAAC;YACpD,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,MAAM,GAAG,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,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"}
|
|
@@ -113,8 +113,8 @@ export declare const readToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
113
113
|
readonly reason: "path_forbidden";
|
|
114
114
|
readonly thrownBy: "service";
|
|
115
115
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
116
|
-
readonly when: "The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access).";
|
|
117
|
-
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope.";
|
|
116
|
+
readonly when: "The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access), or inside OBSIDIAN_DENY_PATHS.";
|
|
117
|
+
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
118
118
|
}, {
|
|
119
119
|
readonly reason: "note_missing";
|
|
120
120
|
readonly thrownBy: "service";
|
|
@@ -215,8 +215,8 @@ export declare const readToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
215
215
|
readonly reason: "path_forbidden";
|
|
216
216
|
readonly thrownBy: "service";
|
|
217
217
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
218
|
-
readonly when: "The supplied `path` is outside OBSIDIAN_READ_PATHS and is not a folder on the way to it. The vault root and the folders leading to a scoped path always list, showing only in-scope entries.";
|
|
219
|
-
readonly recovery: "List a directory inside the configured read scope, or omit `path` to list from the vault root. The error data echoes the active scope.";
|
|
218
|
+
readonly when: "The supplied `path` is outside OBSIDIAN_READ_PATHS and is not a folder on the way to it, or is inside OBSIDIAN_DENY_PATHS. The vault root and the folders leading to a scoped path always list, showing only in-scope entries.";
|
|
219
|
+
readonly recovery: "List a directory inside the configured read scope, or omit `path` to list from the vault root. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
220
220
|
}, {
|
|
221
221
|
readonly reason: "directory_missing";
|
|
222
222
|
readonly thrownBy: "service";
|
|
@@ -272,8 +272,8 @@ export declare const readToolDefinitions: (import("@cyanheads/mcp-ts-core").Tool
|
|
|
272
272
|
readonly reason: "path_forbidden";
|
|
273
273
|
readonly thrownBy: "service";
|
|
274
274
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
275
|
-
readonly when: "The path is outside OBSIDIAN_READ_PATHS, or — when the file does not exist and `failIfMissing: false` would have Obsidian create it — outside OBSIDIAN_WRITE_PATHS or blocked by OBSIDIAN_READ_ONLY=true.";
|
|
276
|
-
readonly recovery: "Open a path inside the configured scope
|
|
275
|
+
readonly when: "The path is outside OBSIDIAN_READ_PATHS or inside OBSIDIAN_DENY_PATHS, or — when the file does not exist and `failIfMissing: false` would have Obsidian create it — outside OBSIDIAN_WRITE_PATHS or blocked by OBSIDIAN_READ_ONLY=true.";
|
|
276
|
+
readonly recovery: "Open a path inside the configured scope; `op` on the error data names whether read or write access was the one denied. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
277
277
|
}, {
|
|
278
278
|
readonly reason: "note_missing";
|
|
279
279
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
@@ -356,8 +356,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
356
356
|
readonly reason: "path_forbidden";
|
|
357
357
|
readonly thrownBy: "service";
|
|
358
358
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
359
|
-
readonly when: "`get` requires the path to be readable; `set`/`delete` require it to be inside OBSIDIAN_WRITE_PATHS, with OBSIDIAN_READ_ONLY=false.";
|
|
360
|
-
readonly recovery: "Use a path inside the configured scope. The error data echoes the active scope.";
|
|
359
|
+
readonly when: "`get` requires the path to be readable; `set`/`delete` require it to be inside OBSIDIAN_WRITE_PATHS, with OBSIDIAN_READ_ONLY=false. A path inside OBSIDIAN_DENY_PATHS is neither.";
|
|
360
|
+
readonly recovery: "Use a path inside the configured scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
361
361
|
}, {
|
|
362
362
|
readonly reason: "value_required";
|
|
363
363
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
@@ -456,8 +456,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
456
456
|
readonly reason: "path_forbidden";
|
|
457
457
|
readonly thrownBy: "service";
|
|
458
458
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
459
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes. The pre-read also requires the path to be readable.";
|
|
460
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
459
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes. The pre-read also requires the path to be readable.";
|
|
460
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
461
461
|
}, {
|
|
462
462
|
readonly reason: "regex_invalid";
|
|
463
463
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
@@ -567,8 +567,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
567
567
|
readonly reason: "path_forbidden";
|
|
568
568
|
readonly thrownBy: "service";
|
|
569
569
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
570
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
571
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
570
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
571
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
572
572
|
}, {
|
|
573
573
|
readonly reason: "note_missing";
|
|
574
574
|
readonly thrownBy: "service";
|
|
@@ -683,8 +683,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
683
683
|
readonly reason: "path_forbidden";
|
|
684
684
|
readonly thrownBy: "service";
|
|
685
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.";
|
|
686
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_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; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
688
688
|
}, {
|
|
689
689
|
readonly reason: "note_missing";
|
|
690
690
|
readonly thrownBy: "service";
|
|
@@ -818,8 +818,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
818
818
|
readonly reason: "path_forbidden";
|
|
819
819
|
readonly thrownBy: "service";
|
|
820
820
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
821
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
822
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
821
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
822
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
823
823
|
}, {
|
|
824
824
|
readonly reason: "note_missing";
|
|
825
825
|
readonly thrownBy: "service";
|
|
@@ -950,8 +950,8 @@ export declare const writeToolDefinitions: (import("@cyanheads/mcp-ts-core").Too
|
|
|
950
950
|
readonly reason: "path_forbidden";
|
|
951
951
|
readonly thrownBy: "service";
|
|
952
952
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
953
|
-
readonly when: "`list` requires the path to be readable; `add`/`remove` require it to be inside OBSIDIAN_WRITE_PATHS, with OBSIDIAN_READ_ONLY=false.";
|
|
954
|
-
readonly recovery: "Use a path inside the configured scope. The error data echoes the active scope.";
|
|
953
|
+
readonly when: "`list` requires the path to be readable; `add`/`remove` require it to be inside OBSIDIAN_WRITE_PATHS, with OBSIDIAN_READ_ONLY=false. A path inside OBSIDIAN_DENY_PATHS is neither.";
|
|
954
|
+
readonly recovery: "Use a path inside the configured scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
955
955
|
}, {
|
|
956
956
|
readonly reason: "tags_required";
|
|
957
957
|
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
|
|
@@ -56,8 +56,8 @@ export declare const obsidianAppendToNote: import("@cyanheads/mcp-ts-core").Tool
|
|
|
56
56
|
readonly reason: "path_forbidden";
|
|
57
57
|
readonly thrownBy: "service";
|
|
58
58
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
59
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
60
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
59
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
60
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
61
61
|
}, {
|
|
62
62
|
readonly reason: "note_missing";
|
|
63
63
|
readonly thrownBy: "service";
|
|
@@ -57,8 +57,8 @@ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
|
|
|
57
57
|
reason: 'path_forbidden',
|
|
58
58
|
thrownBy: 'service',
|
|
59
59
|
code: JsonRpcErrorCode.Forbidden,
|
|
60
|
-
when: 'The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.',
|
|
61
|
-
recovery: 'Use a path inside the configured write scope. The error data echoes the active scope.',
|
|
60
|
+
when: 'The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.',
|
|
61
|
+
recovery: 'Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.',
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
reason: 'note_missing',
|
|
@@ -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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,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,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACtE,eAAe,EAAE,CAAC;aACf,OAAO,EAAE;aACT,QAAQ,CACP,gHAAgH,CACjH;QACH,aAAa,EAAE,CAAC;aACb,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,iMAAiM,CAClM;QACH,OAAO,EAAE,CAAC;aACP,OAAO,EAAE;aACT,QAAQ,CACP,gNAAgN,CACjN;QACH,mBAAmB,EAAE,CAAC;aACnB,MAAM,EAAE;aACR,QAAQ,CAAC,uEAAuE,CAAC;QACpF,kBAAkB,EAAE,CAAC;aAClB,MAAM,EAAE;aACR,QAAQ,CACP,2PAA2P,CAC5P;KACJ,CAAC;IACF,IAAI,EAAE,CAAC,oCAAoC,CAAC;IAC5C,MAAM,EAAE;QACN;YACE,MAAM,EAAE,qBAAqB;YAC7B,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,sXAAsX;YAC5X,QAAQ,EACN,6MAA6M;SAChN;QACD;YACE,MAAM,EAAE,gBAAgB;YACxB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,gBAAgB,CAAC,SAAS;YAChC,IAAI,EAAE,
|
|
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,EA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E,mBAAmB,KAAK,IAAI;YACrC,mBAAmB,EAAE,mBAAmB,IAAI,CAAC;YAC7C,kBAAkB;SACnB,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;QAC1D,MAAM,KAAK,GAAG,CAAC,KAAK,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrE,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,oBAAoB,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACjI,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"}
|
|
@@ -12,8 +12,9 @@ import { z } from '@cyanheads/mcp-ts-core';
|
|
|
12
12
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
13
13
|
/**
|
|
14
14
|
* `elicitation` mirrors `OBSIDIAN_DELETE_ELICITATION`. Off, the operator's
|
|
15
|
-
* `OBSIDIAN_WRITE_PATHS` / `OBSIDIAN_READ_ONLY` are
|
|
16
|
-
* same bound `obsidian_write_note` with
|
|
15
|
+
* `OBSIDIAN_WRITE_PATHS` / `OBSIDIAN_DENY_PATHS` / `OBSIDIAN_READ_ONLY` are
|
|
16
|
+
* what bound a delete — the same bound `obsidian_write_note` with
|
|
17
|
+
* `overwrite: true` already has.
|
|
17
18
|
*/
|
|
18
19
|
export declare function buildDeleteNoteTool({ elicitation }: {
|
|
19
20
|
elicitation: boolean;
|
|
@@ -43,8 +44,8 @@ export declare function buildDeleteNoteTool({ elicitation }: {
|
|
|
43
44
|
readonly reason: "path_forbidden";
|
|
44
45
|
readonly thrownBy: "service";
|
|
45
46
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
46
|
-
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
47
|
-
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
|
|
47
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
48
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
48
49
|
}, ...{
|
|
49
50
|
readonly reason: 'cancelled';
|
|
50
51
|
readonly code: JsonRpcErrorCode.InvalidRequest;
|
|
@@ -130,8 +131,8 @@ export declare const obsidianDeleteNote: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
130
131
|
readonly reason: "path_forbidden";
|
|
131
132
|
readonly thrownBy: "service";
|
|
132
133
|
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.";
|
|
134
|
+
readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
|
|
135
|
+
readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
135
136
|
}, ...{
|
|
136
137
|
readonly reason: 'cancelled';
|
|
137
138
|
readonly code: JsonRpcErrorCode.InvalidRequest;
|
|
@@ -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;;;;;;;;;GASG;AAIH,OAAO,EAAqC,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAsB,MAAM,+BAA+B,CAAC;
|
|
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;;;;;GAKG;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"}
|
|
@@ -15,7 +15,7 @@ import { JsonRpcErrorCode, McpError, notFound } from '@cyanheads/mcp-ts-core/err
|
|
|
15
15
|
import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
|
|
16
16
|
import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
|
|
17
17
|
import { TargetSchema } from './_shared/schemas.js';
|
|
18
|
-
import { findSimilarPaths } from './_shared/suggest-paths.js';
|
|
18
|
+
import { didYouMean, findSimilarPaths } from './_shared/suggest-paths.js';
|
|
19
19
|
const OPERATION = 'obsidian_delete_note';
|
|
20
20
|
const CONSENT_TTL_SECONDS = 600;
|
|
21
21
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
@@ -62,15 +62,15 @@ async function readExactNote(ctx, svc, path) {
|
|
|
62
62
|
const suggestions = await findSimilarPaths(ctx, svc, path);
|
|
63
63
|
if (suggestions.length === 0)
|
|
64
64
|
throw err;
|
|
65
|
-
|
|
66
|
-
throw notFound(`${err.message.replace(/[.!?]?\s*$/, '')}. Did you mean: ${list}?`, { ...(err.data ?? {}), suggestions }, { cause: err });
|
|
65
|
+
throw notFound(didYouMean(err.message, suggestions), { ...(err.data ?? {}), suggestions }, { cause: err });
|
|
67
66
|
}
|
|
68
67
|
return await svc.getNoteContent(ctx, target);
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* `elicitation` mirrors `OBSIDIAN_DELETE_ELICITATION`. Off, the operator's
|
|
72
|
-
* `OBSIDIAN_WRITE_PATHS` / `OBSIDIAN_READ_ONLY` are
|
|
73
|
-
* same bound `obsidian_write_note` with
|
|
71
|
+
* `OBSIDIAN_WRITE_PATHS` / `OBSIDIAN_DENY_PATHS` / `OBSIDIAN_READ_ONLY` are
|
|
72
|
+
* what bound a delete — the same bound `obsidian_write_note` with
|
|
73
|
+
* `overwrite: true` already has.
|
|
74
74
|
*/
|
|
75
75
|
export function buildDeleteNoteTool({ elicitation }) {
|
|
76
76
|
return tool('obsidian_delete_note', {
|
|
@@ -97,8 +97,8 @@ export function buildDeleteNoteTool({ elicitation }) {
|
|
|
97
97
|
reason: 'path_forbidden',
|
|
98
98
|
thrownBy: 'service',
|
|
99
99
|
code: JsonRpcErrorCode.Forbidden,
|
|
100
|
-
when: 'The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.',
|
|
101
|
-
recovery: 'Use a path inside the configured write scope. The error data echoes the active scope.',
|
|
100
|
+
when: 'The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.',
|
|
101
|
+
recovery: 'Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.',
|
|
102
102
|
},
|
|
103
103
|
/** Declared only where it can fire: the off build never asks, so never throws it. */
|
|
104
104
|
...(elicitation
|
|
@@ -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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAwB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"obsidian-delete-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-delete-note.tool.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,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC"}
|
|
@@ -91,8 +91,8 @@ export declare const obsidianGetNote: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
91
91
|
readonly reason: "path_forbidden";
|
|
92
92
|
readonly thrownBy: "service";
|
|
93
93
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
94
|
-
readonly when: "The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access).";
|
|
95
|
-
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope.";
|
|
94
|
+
readonly when: "The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access), or inside OBSIDIAN_DENY_PATHS.";
|
|
95
|
+
readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.";
|
|
96
96
|
}, {
|
|
97
97
|
readonly reason: "note_missing";
|
|
98
98
|
readonly thrownBy: "service";
|
|
@@ -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;AAmB3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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;AAmB3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6X1B,CAAC"}
|
|
@@ -121,8 +121,8 @@ export const obsidianGetNote = tool('obsidian_get_note', {
|
|
|
121
121
|
reason: 'path_forbidden',
|
|
122
122
|
thrownBy: 'service',
|
|
123
123
|
code: JsonRpcErrorCode.Forbidden,
|
|
124
|
-
when: 'The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access).',
|
|
125
|
-
recovery: 'Use a path inside the configured read scope. The error data echoes the active scope.',
|
|
124
|
+
when: 'The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access), or inside OBSIDIAN_DENY_PATHS.',
|
|
125
|
+
recovery: 'Use a path inside the configured read scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path.',
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
reason: 'note_missing',
|
|
@@ -312,7 +312,8 @@ export const obsidianGetNote = tool('obsidian_get_note', {
|
|
|
312
312
|
lines.push(`- [${l.type}] ${escapeMarkdownInline(l.target)}`);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
|
|
315
|
+
// The blank line keeps the raw body's first line out of the label's block.
|
|
316
|
+
lines.push('', '**Content**', '', result.content);
|
|
316
317
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
317
318
|
}
|
|
318
319
|
if (result.format === 'document-map') {
|
|
@@ -346,7 +347,7 @@ export const obsidianGetNote = tool('obsidian_get_note', {
|
|
|
346
347
|
if (result.candidates && result.candidates.length > 0) {
|
|
347
348
|
lines.push(`*Candidates:* ${result.candidates.map(escapeMarkdownInline).join(', ')}`);
|
|
348
349
|
}
|
|
349
|
-
lines.push('', '**Value:**', value);
|
|
350
|
+
lines.push('', '**Value:**', '', value);
|
|
350
351
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
351
352
|
},
|
|
352
353
|
});
|
|
@@ -356,7 +357,9 @@ function blockValue(v) {
|
|
|
356
357
|
return '(empty)';
|
|
357
358
|
if (typeof v === 'string')
|
|
358
359
|
return escapeMarkdownInline(v);
|
|
359
|
-
return markdown()
|
|
360
|
+
return markdown()
|
|
361
|
+
.codeBlock(JSON.stringify(v, null, 2), 'json')
|
|
362
|
+
.build();
|
|
360
363
|
}
|
|
361
364
|
/** A frontmatter value in a list item: a string as escaped text, anything else as its JSON in a code span. */
|
|
362
365
|
function inlineValue(v) {
|