obsidian-mcp-server 2.0.7 → 3.0.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.
Files changed (253) hide show
  1. package/CLAUDE.md +364 -0
  2. package/Dockerfile +99 -0
  3. package/LICENSE +4 -6
  4. package/README.md +246 -206
  5. package/changelog/3.0.x/3.0.0.md +102 -0
  6. package/changelog/template.md +51 -0
  7. package/dist/config/server-config.d.ts +19 -0
  8. package/dist/config/server-config.d.ts.map +1 -0
  9. package/dist/config/server-config.js +55 -0
  10. package/dist/config/server-config.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -295
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp-server/prompts/definitions/index.d.ts +8 -0
  16. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  17. package/dist/mcp-server/prompts/definitions/index.js +8 -0
  18. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  19. package/dist/mcp-server/resources/definitions/index.d.ts +36 -0
  20. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  21. package/dist/mcp-server/resources/definitions/index.js +9 -0
  22. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  23. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts +23 -0
  24. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts.map +1 -0
  25. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js +47 -0
  26. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js.map +1 -0
  27. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +13 -0
  28. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -0
  29. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +30 -0
  30. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -0
  31. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts +21 -0
  32. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts.map +1 -0
  33. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +38 -0
  34. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -0
  35. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts +45 -0
  36. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts.map +1 -0
  37. package/dist/mcp-server/tools/definitions/_shared/schemas.js +66 -0
  38. package/dist/mcp-server/tools/definitions/_shared/schemas.js.map +1 -0
  39. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +51 -0
  40. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -0
  41. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +120 -0
  42. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -0
  43. package/dist/mcp-server/tools/definitions/index.d.ts +531 -0
  44. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  45. package/dist/mcp-server/tools/definitions/index.js +38 -0
  46. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  47. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +42 -0
  48. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -0
  49. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +58 -0
  50. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -0
  51. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts +46 -0
  52. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -0
  53. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +66 -0
  54. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -0
  55. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts +19 -0
  56. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts.map +1 -0
  57. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js +43 -0
  58. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js.map +1 -0
  59. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts +92 -0
  60. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -0
  61. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +245 -0
  62. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -0
  63. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts +13 -0
  64. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts.map +1 -0
  65. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js +38 -0
  66. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js.map +1 -0
  67. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +59 -0
  68. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -0
  69. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +273 -0
  70. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -0
  71. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts +13 -0
  72. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts.map +1 -0
  73. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +38 -0
  74. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js.map +1 -0
  75. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +68 -0
  76. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -0
  77. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +178 -0
  78. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -0
  79. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts +77 -0
  80. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -0
  81. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +172 -0
  82. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -0
  83. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +22 -0
  84. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -0
  85. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +88 -0
  86. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -0
  87. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +81 -0
  88. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -0
  89. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +83 -0
  90. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -0
  91. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts +59 -0
  92. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -0
  93. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +167 -0
  94. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -0
  95. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +76 -0
  96. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -0
  97. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +244 -0
  98. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -0
  99. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +41 -0
  100. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -0
  101. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +76 -0
  102. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -0
  103. package/dist/services/obsidian/frontmatter-ops.d.ts +34 -0
  104. package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -0
  105. package/dist/services/obsidian/frontmatter-ops.js +230 -0
  106. package/dist/services/obsidian/frontmatter-ops.js.map +1 -0
  107. package/dist/services/obsidian/obsidian-service.d.ts +73 -0
  108. package/dist/services/obsidian/obsidian-service.d.ts.map +1 -0
  109. package/dist/services/obsidian/obsidian-service.js +399 -0
  110. package/dist/services/obsidian/obsidian-service.js.map +1 -0
  111. package/dist/services/obsidian/section-extractor.d.ts +13 -0
  112. package/dist/services/obsidian/section-extractor.d.ts.map +1 -0
  113. package/dist/services/obsidian/section-extractor.js +124 -0
  114. package/dist/services/obsidian/section-extractor.js.map +1 -0
  115. package/dist/services/obsidian/types.d.ts +91 -0
  116. package/dist/services/obsidian/types.d.ts.map +1 -0
  117. package/dist/services/obsidian/types.js +7 -0
  118. package/dist/services/obsidian/types.js.map +1 -0
  119. package/package.json +63 -69
  120. package/server.json +167 -0
  121. package/CHANGELOG.md +0 -124
  122. package/dist/config/index.d.ts +0 -41
  123. package/dist/config/index.js +0 -191
  124. package/dist/mcp-server/server.d.ts +0 -33
  125. package/dist/mcp-server/server.js +0 -211
  126. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.d.ts +0 -12
  127. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.js +0 -12
  128. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.d.ts +0 -51
  129. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.js +0 -168
  130. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.d.ts +0 -19
  131. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.js +0 -91
  132. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +0 -12
  133. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +0 -12
  134. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +0 -77
  135. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +0 -341
  136. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +0 -18
  137. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +0 -69
  138. package/dist/mcp-server/tools/obsidianListNotesTool/index.d.ts +0 -12
  139. package/dist/mcp-server/tools/obsidianListNotesTool/index.js +0 -12
  140. package/dist/mcp-server/tools/obsidianListNotesTool/logic.d.ts +0 -68
  141. package/dist/mcp-server/tools/obsidianListNotesTool/logic.js +0 -215
  142. package/dist/mcp-server/tools/obsidianListNotesTool/registration.d.ts +0 -23
  143. package/dist/mcp-server/tools/obsidianListNotesTool/registration.js +0 -98
  144. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +0 -3
  145. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +0 -2
  146. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +0 -42
  147. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +0 -152
  148. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +0 -3
  149. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +0 -52
  150. package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +0 -3
  151. package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +0 -2
  152. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +0 -28
  153. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +0 -161
  154. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +0 -3
  155. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +0 -52
  156. package/dist/mcp-server/tools/obsidianReadNoteTool/index.d.ts +0 -12
  157. package/dist/mcp-server/tools/obsidianReadNoteTool/index.js +0 -12
  158. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.d.ts +0 -87
  159. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.js +0 -216
  160. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.d.ts +0 -20
  161. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.js +0 -101
  162. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +0 -12
  163. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +0 -12
  164. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +0 -255
  165. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +0 -583
  166. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +0 -22
  167. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +0 -111
  168. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.d.ts +0 -12
  169. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.js +0 -12
  170. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.d.ts +0 -183
  171. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.js +0 -490
  172. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.d.ts +0 -21
  173. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.js +0 -108
  174. package/dist/mcp-server/transports/auth/core/authContext.d.ts +0 -33
  175. package/dist/mcp-server/transports/auth/core/authContext.js +0 -24
  176. package/dist/mcp-server/transports/auth/core/authTypes.d.ts +0 -17
  177. package/dist/mcp-server/transports/auth/core/authTypes.js +0 -5
  178. package/dist/mcp-server/transports/auth/core/authUtils.d.ts +0 -18
  179. package/dist/mcp-server/transports/auth/core/authUtils.js +0 -45
  180. package/dist/mcp-server/transports/auth/index.d.ts +0 -10
  181. package/dist/mcp-server/transports/auth/index.js +0 -9
  182. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.d.ts +0 -27
  183. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.js +0 -149
  184. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.d.ts +0 -20
  185. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.js +0 -124
  186. package/dist/mcp-server/transports/httpErrorHandler.d.ts +0 -26
  187. package/dist/mcp-server/transports/httpErrorHandler.js +0 -73
  188. package/dist/mcp-server/transports/httpTransport.d.ts +0 -21
  189. package/dist/mcp-server/transports/httpTransport.js +0 -208
  190. package/dist/mcp-server/transports/stdioTransport.d.ts +0 -42
  191. package/dist/mcp-server/transports/stdioTransport.js +0 -63
  192. package/dist/services/obsidianRestAPI/index.d.ts +0 -15
  193. package/dist/services/obsidianRestAPI/index.js +0 -17
  194. package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +0 -38
  195. package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +0 -62
  196. package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +0 -22
  197. package/dist/services/obsidianRestAPI/methods/commandMethods.js +0 -31
  198. package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +0 -16
  199. package/dist/services/obsidianRestAPI/methods/openMethods.js +0 -21
  200. package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +0 -37
  201. package/dist/services/obsidianRestAPI/methods/patchMethods.js +0 -94
  202. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +0 -42
  203. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +0 -66
  204. package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +0 -25
  205. package/dist/services/obsidianRestAPI/methods/searchMethods.js +0 -36
  206. package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +0 -58
  207. package/dist/services/obsidianRestAPI/methods/vaultMethods.js +0 -144
  208. package/dist/services/obsidianRestAPI/service.d.ts +0 -195
  209. package/dist/services/obsidianRestAPI/service.js +0 -379
  210. package/dist/services/obsidianRestAPI/types.d.ts +0 -127
  211. package/dist/services/obsidianRestAPI/types.js +0 -7
  212. package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +0 -4
  213. package/dist/services/obsidianRestAPI/vaultCache/index.js +0 -4
  214. package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +0 -88
  215. package/dist/services/obsidianRestAPI/vaultCache/service.js +0 -299
  216. package/dist/types-global/errors.d.ts +0 -73
  217. package/dist/types-global/errors.js +0 -71
  218. package/dist/utils/index.d.ts +0 -5
  219. package/dist/utils/index.js +0 -13
  220. package/dist/utils/internal/asyncUtils.d.ts +0 -54
  221. package/dist/utils/internal/asyncUtils.js +0 -101
  222. package/dist/utils/internal/errorHandler.d.ts +0 -176
  223. package/dist/utils/internal/errorHandler.js +0 -351
  224. package/dist/utils/internal/index.d.ts +0 -4
  225. package/dist/utils/internal/index.js +0 -4
  226. package/dist/utils/internal/logger.d.ts +0 -141
  227. package/dist/utils/internal/logger.js +0 -406
  228. package/dist/utils/internal/requestContext.d.ts +0 -83
  229. package/dist/utils/internal/requestContext.js +0 -72
  230. package/dist/utils/metrics/index.d.ts +0 -1
  231. package/dist/utils/metrics/index.js +0 -1
  232. package/dist/utils/metrics/tokenCounter.d.ts +0 -27
  233. package/dist/utils/metrics/tokenCounter.js +0 -128
  234. package/dist/utils/obsidian/index.d.ts +0 -5
  235. package/dist/utils/obsidian/index.js +0 -5
  236. package/dist/utils/obsidian/obsidianApiUtils.d.ts +0 -14
  237. package/dist/utils/obsidian/obsidianApiUtils.js +0 -29
  238. package/dist/utils/obsidian/obsidianStatUtils.d.ts +0 -68
  239. package/dist/utils/obsidian/obsidianStatUtils.js +0 -143
  240. package/dist/utils/parsing/dateParser.d.ts +0 -56
  241. package/dist/utils/parsing/dateParser.js +0 -104
  242. package/dist/utils/parsing/index.d.ts +0 -2
  243. package/dist/utils/parsing/index.js +0 -3
  244. package/dist/utils/parsing/jsonParser.d.ts +0 -80
  245. package/dist/utils/parsing/jsonParser.js +0 -133
  246. package/dist/utils/security/idGenerator.d.ts +0 -140
  247. package/dist/utils/security/idGenerator.js +0 -194
  248. package/dist/utils/security/index.d.ts +0 -3
  249. package/dist/utils/security/index.js +0 -3
  250. package/dist/utils/security/rateLimiter.d.ts +0 -156
  251. package/dist/utils/security/rateLimiter.js +0 -235
  252. package/dist/utils/security/sanitization.d.ts +0 -244
  253. package/dist/utils/security/sanitization.js +0 -599
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview obsidian_append_to_note — append content to the end of a note,
3
+ * or to the end of a heading/block/frontmatter section via PATCH-with-append.
4
+ * @module mcp-server/tools/definitions/obsidian-append-to-note.tool
5
+ */
6
+ import { tool, z } from '@cyanheads/mcp-ts-core';
7
+ import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
8
+ import { ContentTypeSchema, SectionSchema, TargetSchema } from './_shared/schemas.js';
9
+ export const obsidianAppendToNote = tool('obsidian_append_to_note', {
10
+ description: 'Append content to a note. Without `section`, the body is appended to the end of the file. With `section`, the content is appended to the end of that heading/block/frontmatter. For block-reference targets, the upstream concatenates `content` 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.',
11
+ annotations: { destructiveHint: true },
12
+ input: z.object({
13
+ target: TargetSchema.describe('Where the note lives.'),
14
+ content: z.string().describe('Body to append. Markdown unless `contentType` is `json`.'),
15
+ section: SectionSchema.optional().describe('Optional sub-document target. When set, content is appended to that section instead of the file.'),
16
+ contentType: ContentTypeSchema,
17
+ createTargetIfMissing: z
18
+ .boolean()
19
+ .default(false)
20
+ .describe('When `section` is provided, create the section if it does not already exist (otherwise the call fails when the section is missing).'),
21
+ }),
22
+ output: z.object({
23
+ path: z.string().describe('Resolved vault-relative path of the note.'),
24
+ sectionTargeted: z
25
+ .boolean()
26
+ .describe('True when the append went to a section; false for whole-file appends.'),
27
+ }),
28
+ auth: ['tool:obsidian_append_to_note:write'],
29
+ async handler(input, ctx) {
30
+ const svc = getObsidianService();
31
+ const { target } = input;
32
+ if (input.section) {
33
+ await svc.patchNote(ctx, target, input.content, {
34
+ operation: 'append',
35
+ targetType: input.section.type,
36
+ target: input.section.target,
37
+ targetDelimiter: input.section.type === 'heading' ? '::' : undefined,
38
+ createTargetIfMissing: input.createTargetIfMissing,
39
+ contentType: input.contentType,
40
+ });
41
+ const path = await svc.resolvePath(ctx, target);
42
+ return { path, sectionTargeted: true };
43
+ }
44
+ await svc.appendToNote(ctx, target, input.content, input.contentType);
45
+ const path = await svc.resolvePath(ctx, target);
46
+ return { path, sectionTargeted: false };
47
+ },
48
+ format: (result) => [
49
+ {
50
+ type: 'text',
51
+ text: [
52
+ `**Appended to ${result.path}**`,
53
+ `*Section targeted:* ${result.sectionTargeted}`,
54
+ ].join('\n'),
55
+ },
56
+ ],
57
+ });
58
+ //# sourceMappingURL=obsidian-append-to-note.tool.js.map
@@ -0,0 +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;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,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,wdAAwd;IAC1d,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,CAA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AC1C,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;gBACJ,iBAAiB,MAAM,CAAC,IAAI,IAAI;gBAChC,uBAAuB,MAAM,CAAC,eAAe,EAAE;aAChD,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @fileoverview obsidian_delete_note — permanently delete a note. Calls
3
+ * `ctx.elicit` to confirm with the user when the client supports it; falls
4
+ * back to the destructive-hint annotation otherwise.
5
+ * @module mcp-server/tools/definitions/obsidian-delete-note.tool
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ export declare const obsidianDeleteNote: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
10
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ type: z.ZodLiteral<"path">;
12
+ path: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ type: z.ZodLiteral<"active">;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ type: z.ZodLiteral<"periodic">;
17
+ period: z.ZodEnum<{
18
+ daily: "daily";
19
+ weekly: "weekly";
20
+ monthly: "monthly";
21
+ quarterly: "quarterly";
22
+ yearly: "yearly";
23
+ }>;
24
+ date: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>], "type">;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ path: z.ZodString;
28
+ deleted: z.ZodBoolean;
29
+ }, z.core.$strip>, readonly [{
30
+ readonly reason: "cancelled";
31
+ readonly code: JsonRpcErrorCode.InvalidRequest;
32
+ readonly when: "User declined the deletion via interactive elicitation.";
33
+ }, {
34
+ readonly reason: "note_missing";
35
+ readonly code: JsonRpcErrorCode.NotFound;
36
+ readonly when: "The vault path does not resolve to an existing note.";
37
+ }, {
38
+ readonly reason: "no_active_file";
39
+ readonly code: JsonRpcErrorCode.NotFound;
40
+ readonly when: "Target was `active` but no file is currently open in Obsidian.";
41
+ }, {
42
+ readonly reason: "periodic_not_found";
43
+ readonly code: JsonRpcErrorCode.NotFound;
44
+ readonly when: "Target was `periodic` but no matching periodic note exists.";
45
+ }]>;
46
+ //# sourceMappingURL=obsidian-delete-note.tool.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+D7B,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview obsidian_delete_note — permanently delete a note. Calls
3
+ * `ctx.elicit` to confirm with the user when the client supports it; falls
4
+ * back to the destructive-hint annotation otherwise.
5
+ * @module mcp-server/tools/definitions/obsidian-delete-note.tool
6
+ */
7
+ import { tool, z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
10
+ import { TargetSchema } from './_shared/schemas.js';
11
+ export const obsidianDeleteNote = tool('obsidian_delete_note', {
12
+ description: 'Permanently delete a note from the vault. Confirms with the user before deleting when the client supports interactive confirmation. Recovery requires the local trash in Obsidian — there is no API-level undo.',
13
+ annotations: { destructiveHint: true },
14
+ input: z.object({
15
+ target: TargetSchema.describe('Which note to delete.'),
16
+ }),
17
+ output: z.object({
18
+ path: z.string().describe('Resolved vault-relative path of the deleted note.'),
19
+ deleted: z.boolean().describe('True when the file was removed.'),
20
+ }),
21
+ auth: ['tool:obsidian_delete_note:write'],
22
+ errors: [
23
+ {
24
+ reason: 'cancelled',
25
+ code: JsonRpcErrorCode.InvalidRequest,
26
+ when: 'User declined the deletion via interactive elicitation.',
27
+ },
28
+ {
29
+ reason: 'note_missing',
30
+ code: JsonRpcErrorCode.NotFound,
31
+ when: 'The vault path does not resolve to an existing note.',
32
+ },
33
+ {
34
+ reason: 'no_active_file',
35
+ code: JsonRpcErrorCode.NotFound,
36
+ when: 'Target was `active` but no file is currently open in Obsidian.',
37
+ },
38
+ {
39
+ reason: 'periodic_not_found',
40
+ code: JsonRpcErrorCode.NotFound,
41
+ when: 'Target was `periodic` but no matching periodic note exists.',
42
+ },
43
+ ],
44
+ async handler(input, ctx) {
45
+ const svc = getObsidianService();
46
+ const { target } = input;
47
+ const path = await svc.resolvePath(ctx, target);
48
+ if (ctx.elicit) {
49
+ const confirmed = await ctx.elicit(`Permanently delete '${path}'? This cannot be undone via the API; recovery would require Obsidian's local trash.`, z.object({
50
+ confirm: z.boolean().describe('Set to true to delete the note. Any other value cancels.'),
51
+ }));
52
+ if (confirmed.action !== 'accept' || confirmed.content?.confirm !== true) {
53
+ throw ctx.fail('cancelled', 'Deletion cancelled by user.', { path });
54
+ }
55
+ }
56
+ await svc.deleteNote(ctx, target);
57
+ return { path, deleted: true };
58
+ },
59
+ format: (result) => [
60
+ {
61
+ type: 'text',
62
+ text: `**Deleted ${result.path}** (deleted: ${result.deleted})`,
63
+ },
64
+ ],
65
+ });
66
+ //# sourceMappingURL=obsidian-delete-note.tool.js.map
@@ -0,0 +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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AAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,CAChC,uBAAuB,IAAI,sFAAsF,EACjH,CAAC,CAAC,MAAM,CAAC;gBACP,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;aAC1F,CAAC,CACH,CAAC;YACF,IAAI,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;gBACzE,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,6BAA6B,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QAED,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,aAAa,MAAM,CAAC,IAAI,gBAAgB,MAAM,CAAC,OAAO,GAAG;SAChE;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @fileoverview obsidian_execute_command — execute an Obsidian command-palette
3
+ * command by ID. Gated by `OBSIDIAN_ENABLE_COMMANDS=true` because command
4
+ * behaviour is opaque (some commands are destructive) and consumers must opt in.
5
+ * @module mcp-server/tools/definitions/obsidian-execute-command.tool
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ export declare const obsidianExecuteCommand: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
10
+ commandId: z.ZodString;
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ commandId: z.ZodString;
13
+ executed: z.ZodBoolean;
14
+ }, z.core.$strip>, readonly [{
15
+ readonly reason: "command_unknown";
16
+ readonly code: JsonRpcErrorCode.NotFound;
17
+ readonly when: "The supplied `commandId` is not registered in Obsidian. Use `obsidian_list_commands` to discover valid IDs.";
18
+ }]>;
19
+ //# sourceMappingURL=obsidian-execute-command.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obsidian-execute-command.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-execute-command.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,sBAAsB;;;;;;;;;GAmCjC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @fileoverview obsidian_execute_command — execute an Obsidian command-palette
3
+ * command by ID. Gated by `OBSIDIAN_ENABLE_COMMANDS=true` because command
4
+ * behaviour is opaque (some commands are destructive) and consumers must opt in.
5
+ * @module mcp-server/tools/definitions/obsidian-execute-command.tool
6
+ */
7
+ import { tool, z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
10
+ export const obsidianExecuteCommand = tool('obsidian_execute_command', {
11
+ description: 'Execute an Obsidian command by ID (from `obsidian_list_commands`). Behaviour depends on the command — some are destructive (delete file, close vault), some open UI. Opt-in via `OBSIDIAN_ENABLE_COMMANDS=true`; the tool is registered only when the operator has explicitly enabled it.',
12
+ annotations: { openWorldHint: true, destructiveHint: true },
13
+ input: z.object({
14
+ commandId: z
15
+ .string()
16
+ .min(1)
17
+ .describe('Command ID, e.g. "editor:save-file". Use obsidian_list_commands to discover.'),
18
+ }),
19
+ output: z.object({
20
+ commandId: z.string().describe('Echoed command ID.'),
21
+ executed: z.boolean().describe('True when the upstream POST returned successfully.'),
22
+ }),
23
+ auth: ['tool:obsidian_execute_command:admin'],
24
+ errors: [
25
+ {
26
+ reason: 'command_unknown',
27
+ code: JsonRpcErrorCode.NotFound,
28
+ when: 'The supplied `commandId` is not registered in Obsidian. Use `obsidian_list_commands` to discover valid IDs.',
29
+ },
30
+ ],
31
+ async handler(input, ctx) {
32
+ const svc = getObsidianService();
33
+ await svc.executeCommand(ctx, input.commandId);
34
+ return { commandId: input.commandId, executed: true };
35
+ },
36
+ format: (result) => [
37
+ {
38
+ type: 'text',
39
+ text: `**Executed \`${result.commandId}\`** (executed: ${result.executed})`,
40
+ },
41
+ ],
42
+ });
43
+ //# sourceMappingURL=obsidian-execute-command.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obsidian-execute-command.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-execute-command.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;AAE7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,0BAA0B,EAAE;IACrE,WAAW,EACT,2RAA2R;IAC7R,WAAW,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,8EAA8E,CAAC;KAC5F,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACpD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;KACrF,CAAC;IACF,IAAI,EAAE,CAAC,qCAAqC,CAAC;IAC7C,MAAM,EAAE;QACN;YACE,MAAM,EAAE,iBAAiB;YACzB,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,6GAA6G;SACpH;KACF;IAED,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;QACtB,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;QACjC,MAAM,GAAG,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gBAAgB,MAAM,CAAC,SAAS,mBAAmB,MAAM,CAAC,QAAQ,GAAG;SAC5E;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @fileoverview obsidian_get_note — read a note's content, full NoteJson,
3
+ * structural document map, or a single section.
4
+ * @module mcp-server/tools/definitions/obsidian-get-note.tool
5
+ */
6
+ import { z } from '@cyanheads/mcp-ts-core';
7
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
8
+ export declare const obsidianGetNote: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
9
+ format: z.ZodEnum<{
10
+ content: "content";
11
+ section: "section";
12
+ full: "full";
13
+ "document-map": "document-map";
14
+ }>;
15
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ type: z.ZodLiteral<"path">;
17
+ path: z.ZodString;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ type: z.ZodLiteral<"active">;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ type: z.ZodLiteral<"periodic">;
22
+ period: z.ZodEnum<{
23
+ daily: "daily";
24
+ weekly: "weekly";
25
+ monthly: "monthly";
26
+ quarterly: "quarterly";
27
+ yearly: "yearly";
28
+ }>;
29
+ date: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>], "type">;
31
+ section: z.ZodOptional<z.ZodObject<{
32
+ type: z.ZodEnum<{
33
+ heading: "heading";
34
+ block: "block";
35
+ frontmatter: "frontmatter";
36
+ }>;
37
+ target: z.ZodString;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
41
+ format: z.ZodLiteral<"content">;
42
+ path: z.ZodString;
43
+ content: z.ZodString;
44
+ }, z.core.$strip>, z.ZodObject<{
45
+ format: z.ZodLiteral<"full">;
46
+ path: z.ZodString;
47
+ content: z.ZodString;
48
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
49
+ tags: z.ZodArray<z.ZodString>;
50
+ stat: z.ZodObject<{
51
+ ctime: z.ZodNumber;
52
+ mtime: z.ZodNumber;
53
+ size: z.ZodNumber;
54
+ }, z.core.$strip>;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ format: z.ZodLiteral<"document-map">;
57
+ path: z.ZodString;
58
+ headings: z.ZodArray<z.ZodString>;
59
+ blocks: z.ZodArray<z.ZodString>;
60
+ frontmatterFields: z.ZodArray<z.ZodString>;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ format: z.ZodLiteral<"section">;
63
+ path: z.ZodString;
64
+ section: z.ZodObject<{
65
+ type: z.ZodEnum<{
66
+ heading: "heading";
67
+ block: "block";
68
+ frontmatter: "frontmatter";
69
+ }>;
70
+ target: z.ZodString;
71
+ }, z.core.$strip>;
72
+ valueText: z.ZodOptional<z.ZodString>;
73
+ valueJson: z.ZodOptional<z.ZodUnknown>;
74
+ }, z.core.$strip>], "format">;
75
+ }, z.core.$strip>, readonly [{
76
+ readonly reason: "section_required";
77
+ readonly code: JsonRpcErrorCode.ValidationError;
78
+ readonly when: "`format` is \"section\" but no `section` locator was provided.";
79
+ }, {
80
+ readonly reason: "note_missing";
81
+ readonly code: JsonRpcErrorCode.NotFound;
82
+ readonly when: "The vault path does not resolve to an existing note.";
83
+ }, {
84
+ readonly reason: "no_active_file";
85
+ readonly code: JsonRpcErrorCode.NotFound;
86
+ readonly when: "Target was `active` but no file is currently open in Obsidian.";
87
+ }, {
88
+ readonly reason: "periodic_not_found";
89
+ readonly code: JsonRpcErrorCode.NotFound;
90
+ readonly when: "Target was `periodic` but no matching periodic note exists.";
91
+ }]>;
92
+ //# sourceMappingURL=obsidian-get-note.tool.d.ts.map
@@ -0,0 +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,EAAE,MAAM,+BAA+B,CAAC;AAYjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsO1B,CAAC"}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * @fileoverview obsidian_get_note — read a note's content, full NoteJson,
3
+ * structural document map, or a single section.
4
+ * @module mcp-server/tools/definitions/obsidian-get-note.tool
5
+ */
6
+ import { tool, z } from '@cyanheads/mcp-ts-core';
7
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
8
+ import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
9
+ import { extractSection } from '../../../services/obsidian/section-extractor.js';
10
+ import { SectionSchema, TargetSchema } from './_shared/schemas.js';
11
+ import { withCaseFallback } from './_shared/suggest-paths.js';
12
+ const StatSchema = z.object({
13
+ ctime: z.number().describe('Created time, ms since epoch.'),
14
+ mtime: z.number().describe('Modified time, ms since epoch.'),
15
+ size: z.number().describe('File size in bytes.'),
16
+ });
17
+ export const obsidianGetNote = tool('obsidian_get_note', {
18
+ description: 'Read a note from the vault. `format: "content"` returns just the raw markdown body. `format: "full"` returns a structured object with content, frontmatter, tags, and file metadata. `format: "document-map"` returns the catalog of headings, block references, and frontmatter fields. `format: "section"` returns a single heading/block/frontmatter section (requires `section`); heading sections include the full subtree under that heading, including nested headings. Works against any vault path, the active file, or a periodic note.',
19
+ annotations: { readOnlyHint: true, idempotentHint: true },
20
+ input: z.object({
21
+ format: z
22
+ .enum(['content', 'full', 'document-map', 'section'])
23
+ .describe('Which projection of the note to return.'),
24
+ target: TargetSchema.describe('Where the note lives.'),
25
+ section: SectionSchema.optional().describe('Required when `format` is `"section"`. Identifies the heading/block/frontmatter to extract.'),
26
+ }),
27
+ output: z.object({
28
+ result: z
29
+ .discriminatedUnion('format', [
30
+ z
31
+ .object({
32
+ format: z.literal('content').describe('Echoed format discriminator.'),
33
+ path: z.string().describe('Resolved vault-relative path of the note.'),
34
+ content: z.string().describe('Raw markdown body.'),
35
+ })
36
+ .describe('Content-only projection.'),
37
+ z
38
+ .object({
39
+ format: z.literal('full').describe('Echoed format discriminator.'),
40
+ path: z.string().describe('Resolved vault-relative path of the note.'),
41
+ content: z.string().describe('Raw markdown body.'),
42
+ frontmatter: z
43
+ .record(z.string(), z.unknown())
44
+ .describe('Parsed YAML frontmatter as an object.'),
45
+ tags: z.array(z.string()).describe('Tags from frontmatter and inline #tag syntax.'),
46
+ stat: StatSchema.describe('File metadata.'),
47
+ })
48
+ .describe('Full projection — content plus parsed metadata.'),
49
+ z
50
+ .object({
51
+ format: z.literal('document-map').describe('Echoed format discriminator.'),
52
+ path: z.string().describe('Resolved vault-relative path of the note.'),
53
+ headings: z.array(z.string()).describe('All headings in document order.'),
54
+ blocks: z.array(z.string()).describe('All block reference IDs.'),
55
+ frontmatterFields: z.array(z.string()).describe('All frontmatter field keys.'),
56
+ })
57
+ .describe('Document-map projection — catalog of patch targets.'),
58
+ z
59
+ .object({
60
+ format: z.literal('section').describe('Echoed format discriminator.'),
61
+ path: z.string().describe('Resolved vault-relative path of the note.'),
62
+ section: SectionSchema.describe('Echoed section locator.'),
63
+ valueText: z
64
+ .string()
65
+ .optional()
66
+ .describe('Section value as raw markdown (heading/block sections).'),
67
+ valueJson: z
68
+ .unknown()
69
+ .optional()
70
+ .describe('Section value as the JSON-typed frontmatter value (frontmatter sections only).'),
71
+ })
72
+ .describe('Single-section projection.'),
73
+ ])
74
+ .describe('Mode-discriminated projection of the requested note.'),
75
+ }),
76
+ auth: ['tool:obsidian_get_note:read'],
77
+ errors: [
78
+ {
79
+ reason: 'section_required',
80
+ code: JsonRpcErrorCode.ValidationError,
81
+ when: '`format` is "section" but no `section` locator was provided.',
82
+ },
83
+ {
84
+ reason: 'note_missing',
85
+ code: JsonRpcErrorCode.NotFound,
86
+ when: 'The vault path does not resolve to an existing note.',
87
+ },
88
+ {
89
+ reason: 'no_active_file',
90
+ code: JsonRpcErrorCode.NotFound,
91
+ when: 'Target was `active` but no file is currently open in Obsidian.',
92
+ },
93
+ {
94
+ reason: 'periodic_not_found',
95
+ code: JsonRpcErrorCode.NotFound,
96
+ when: 'Target was `periodic` but no matching periodic note exists.',
97
+ },
98
+ ],
99
+ async handler(input, ctx) {
100
+ const svc = getObsidianService();
101
+ const { target } = input;
102
+ if (input.format === 'content') {
103
+ if (target.type === 'path') {
104
+ const { result: content, resolvedPath } = await withCaseFallback(ctx, svc, target, (t) => svc.getNoteContent(ctx, t));
105
+ return {
106
+ result: { format: 'content', path: resolvedPath ?? target.path, content },
107
+ };
108
+ }
109
+ const note = await svc.getNoteJson(ctx, target);
110
+ return { result: { format: 'content', path: note.path, content: note.content } };
111
+ }
112
+ if (input.format === 'full') {
113
+ const { result: note } = await withCaseFallback(ctx, svc, target, (t) => svc.getNoteJson(ctx, t));
114
+ return {
115
+ result: {
116
+ format: 'full',
117
+ path: note.path,
118
+ content: note.content,
119
+ frontmatter: note.frontmatter,
120
+ tags: note.tags,
121
+ stat: note.stat,
122
+ },
123
+ };
124
+ }
125
+ if (input.format === 'document-map') {
126
+ if (target.type === 'path') {
127
+ const { result: map, resolvedPath } = await withCaseFallback(ctx, svc, target, (t) => svc.getDocumentMap(ctx, t));
128
+ return {
129
+ result: {
130
+ format: 'document-map',
131
+ path: resolvedPath ?? target.path,
132
+ headings: map.headings,
133
+ blocks: map.blocks,
134
+ frontmatterFields: map.frontmatterFields,
135
+ },
136
+ };
137
+ }
138
+ const [map, path] = await Promise.all([
139
+ svc.getDocumentMap(ctx, target),
140
+ svc.resolvePath(ctx, target),
141
+ ]);
142
+ return {
143
+ result: {
144
+ format: 'document-map',
145
+ path,
146
+ headings: map.headings,
147
+ blocks: map.blocks,
148
+ frontmatterFields: map.frontmatterFields,
149
+ },
150
+ };
151
+ }
152
+ if (!input.section) {
153
+ throw ctx.fail('section_required', '`section` is required when `format` is "section".', {
154
+ format: input.format,
155
+ });
156
+ }
157
+ const { result: note } = await withCaseFallback(ctx, svc, target, (t) => svc.getNoteJson(ctx, t));
158
+ const value = extractSection(note, input.section);
159
+ return {
160
+ result: {
161
+ format: 'section',
162
+ path: note.path,
163
+ section: input.section,
164
+ ...(input.section.type === 'frontmatter'
165
+ ? { valueJson: value }
166
+ : { valueText: typeof value === 'string' ? value : String(value) }),
167
+ },
168
+ };
169
+ },
170
+ format: ({ result }) => {
171
+ if (result.format === 'content') {
172
+ return [
173
+ {
174
+ type: 'text',
175
+ text: `**${result.path}** (format: ${result.format})\n\n${result.content}`,
176
+ },
177
+ ];
178
+ }
179
+ if (result.format === 'full') {
180
+ const lines = [
181
+ `**${result.path}** (format: ${result.format})`,
182
+ `*Tags:* ${result.tags.length > 0 ? result.tags.join(', ') : '(none)'}`,
183
+ `*Stat:* created=${formatIsoTime(result.stat.ctime)} modified=${formatIsoTime(result.stat.mtime)} size=${result.stat.size}`,
184
+ ];
185
+ const fmKeys = Object.keys(result.frontmatter);
186
+ if (fmKeys.length > 0) {
187
+ lines.push('', '**Frontmatter**');
188
+ for (const k of fmKeys) {
189
+ lines.push(`- \`${k}\`: ${stringifyValue(result.frontmatter[k])}`);
190
+ }
191
+ }
192
+ lines.push('', '**Content**', result.content);
193
+ return [{ type: 'text', text: lines.join('\n') }];
194
+ }
195
+ if (result.format === 'document-map') {
196
+ const lines = [
197
+ `**${result.path}** (format: ${result.format})`,
198
+ '',
199
+ `**Headings (${result.headings.length})**`,
200
+ ...result.headings.map((h) => `- ${h}`),
201
+ '',
202
+ `**Blocks (${result.blocks.length})**`,
203
+ ...result.blocks.map((b) => `- ^${b}`),
204
+ '',
205
+ `**Frontmatter fields (${result.frontmatterFields.length})**`,
206
+ ...result.frontmatterFields.map((f) => `- ${f}`),
207
+ ];
208
+ return [{ type: 'text', text: lines.join('\n') }];
209
+ }
210
+ const valueRender = result.valueText !== undefined
211
+ ? result.valueText
212
+ : result.valueJson !== undefined
213
+ ? stringifyValue(result.valueJson)
214
+ : '_(empty)_';
215
+ return [
216
+ {
217
+ type: 'text',
218
+ text: [
219
+ `**${result.path}** (format: ${result.format})`,
220
+ `*Section:* ${result.section.type} → ${result.section.target}`,
221
+ '',
222
+ valueRender,
223
+ ].join('\n'),
224
+ },
225
+ ];
226
+ },
227
+ });
228
+ function stringifyValue(v) {
229
+ if (v === null || v === undefined)
230
+ return '(empty)';
231
+ if (typeof v === 'string')
232
+ return v;
233
+ return JSON.stringify(v, null, 2);
234
+ }
235
+ function formatIsoTime(ms) {
236
+ if (!Number.isFinite(ms) || ms <= 0)
237
+ return '(unknown)';
238
+ try {
239
+ return new Date(ms).toISOString();
240
+ }
241
+ catch {
242
+ return String(ms);
243
+ }
244
+ }
245
+ //# sourceMappingURL=obsidian-get-note.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obsidian-get-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-get-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,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AAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,EAAU;IAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,WAAW,CAAC;IACxD,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview obsidian_list_commands — list Obsidian command-palette commands.
3
+ * Always available; surfaces the command surface even when execution is gated.
4
+ * @module mcp-server/tools/definitions/obsidian-list-commands.tool
5
+ */
6
+ import { z } from '@cyanheads/mcp-ts-core';
7
+ export declare const obsidianListCommands: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
8
+ commands: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>, undefined>;
13
+ //# sourceMappingURL=obsidian-list-commands.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obsidian-list-commands.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-list-commands.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,oBAAoB;;;;;6BAiC/B,CAAC"}