obsidian-mcp-server 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -7
  3. package/dist/mcp-server/server.js +6 -6
  4. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/index.d.ts +4 -4
  5. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/index.js +4 -4
  6. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/logic.d.ts +9 -9
  7. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/logic.js +6 -6
  8. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/registration.d.ts +2 -2
  9. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/registration.js +12 -12
  10. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/index.d.ts +4 -4
  11. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/index.js +4 -4
  12. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/logic.d.ts +10 -10
  13. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/logic.js +9 -9
  14. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/registration.d.ts +4 -4
  15. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/registration.js +14 -14
  16. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/index.d.ts +4 -4
  17. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/index.js +4 -4
  18. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/logic.d.ts +9 -9
  19. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/logic.js +8 -8
  20. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/registration.d.ts +2 -2
  21. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/registration.js +12 -12
  22. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.7] - 2025-06-20
9
+
10
+ ### Changed
11
+
12
+ - **Package Update**: Fixed README & incremented version to 2.0.7 to ensure the latest changes are reflected in the npm package.
13
+
14
+ ## [2.0.6] - 2025-06-20
15
+
16
+ ### Changed
17
+
18
+ - **Tool Renaming**: Renamed `obsidian_read_file`, `obsidian_delete_file`, and `obsidian_list_files` to `obsidian_read_note`, `obsidian_delete_note`, and `obsidian_list_notes` respectively. This change improves semantic clarity and aligns the tool names more closely with Obsidian's terminology, reducing ambiguity for AI agents.
19
+ - **Dependency Updates**: Updated all dependencies to their latest versions.
20
+ - **Documentation Improvements**: Updated `.clinerules` to reflect the new tool names and ensure all documentation is current.
21
+
8
22
  ## [2.0.5] - 2025-06-20
9
23
 
10
24
  ### Changed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![TypeScript](https://img.shields.io/badge/TypeScript-^5.8.3-blue.svg)](https://www.typescriptlang.org/)
4
4
  [![Model Context Protocol](https://img.shields.io/badge/MCP%20SDK-^1.13.0-green.svg)](https://modelcontextprotocol.io/)
5
- [![Version](https://img.shields.io/badge/Version-2.0.5-blue.svg)](./CHANGELOG.md)
5
+ [![Version](https://img.shields.io/badge/Version-2.0.7-blue.svg)](./CHANGELOG.md)
6
6
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
7
  [![Status](https://img.shields.io/badge/Status-Production-brightgreen.svg)](https://github.com/cyanheads/obsidian-mcp-server/issues)
8
8
  [![GitHub](https://img.shields.io/github/stars/cyanheads/obsidian-mcp-server?style=social)](https://github.com/cyanheads/obsidian-mcp-server)
@@ -19,14 +19,14 @@ This server equips your AI with specialized tools to interact with your Obsidian
19
19
 
20
20
  | Tool Name | Description | Key Features |
21
21
  | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
22
- | [`obsidian_read_file`](./src/mcp-server/tools/obsidianReadFileTool/) | Retrieves the content and metadata of a specified file. | - Read in `markdown` or `json` format.<br/>- Case-insensitive path fallback.<br/>- Includes file stats (creation/modification time). |
22
+ | [`obsidian_read_note`](./src/mcp-server/tools/obsidianReadNoteTool/) | Retrieves the content and metadata of a specified note. | - Read in `markdown` or `json` format.<br/>- Case-insensitive path fallback.<br/>- Includes file stats (creation/modification time). |
23
23
  | [`obsidian_update_note`](./src/mcp-server/tools/obsidianUpdateNoteTool/) | Modifies notes using whole-file operations. | - `append`, `prepend`, or `overwrite` content.<br/>- Can create files if they don't exist.<br/>- Targets files by path, active note, or periodic note. |
24
24
  | [`obsidian_search_replace`](./src/mcp-server/tools/obsidianSearchReplaceTool/) | Performs search-and-replace operations within a target note. | - Supports string or regex search.<br/>- Options for case sensitivity, whole word, and replacing all occurrences. |
25
25
  | [`obsidian_global_search`](./src/mcp-server/tools/obsidianGlobalSearchTool/) | Performs a search across the entire vault. | - Text or regex search.<br/>- Filter by path and modification date.<br/>- Paginated results. |
26
- | [`obsidian_list_files`](./src/mcp-server/tools/obsidianListFilesTool/) | Lists files and subdirectories within a specified vault folder. | - Filter by file extension or name regex.<br/>- Provides a formatted tree view of the directory. |
26
+ | [`obsidian_list_notes`](./src/mcp-server/tools/obsidianListNotesTool/) | Lists notes and subdirectories within a specified vault folder. | - Filter by file extension or name regex.<br/>- Provides a formatted tree view of the directory. |
27
27
  | [`obsidian_manage_frontmatter`](./src/mcp-server/tools/obsidianManageFrontmatterTool/) | Atomically manages a note's YAML frontmatter. | - `get`, `set`, or `delete` frontmatter keys.<br/>- Avoids rewriting the entire file for metadata changes. |
28
28
  | [`obsidian_manage_tags`](./src/mcp-server/tools/obsidianManageTagsTool/) | Adds, removes, or lists tags for a note. | - Manages tags in both YAML frontmatter and inline content. |
29
- | [`obsidian_delete_file`](./src/mcp-server/tools/obsidianDeleteFileTool/) | Permanently deletes a specified file from the vault. | - Case-insensitive path fallback for safety. |
29
+ | [`obsidian_delete_note`](./src/mcp-server/tools/obsidianDeleteNoteTool/) | Permanently deletes a specified note from the vault. | - Case-insensitive path fallback for safety. |
30
30
 
31
31
  ---
32
32
 
@@ -239,14 +239,14 @@ The Obsidian MCP Server provides a suite of tools for interacting with your vaul
239
239
 
240
240
  | Tool Name | Description | Key Arguments |
241
241
  | :---------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------ |
242
- | `obsidian_read_file` | Retrieves the content and metadata of a file. | `filePath`, `format?`, `includeStat?` |
242
+ | `obsidian_read_note` | Retrieves the content and metadata of a note. | `filePath`, `format?`, `includeStat?` |
243
243
  | `obsidian_update_note` | Modifies a file by appending, prepending, or overwriting. | `targetType`, `content`, `targetIdentifier?`, `wholeFileMode` |
244
244
  | `obsidian_search_replace` | Performs search-and-replace operations in a note. | `targetType`, `replacements`, `useRegex?`, `replaceAll?` |
245
245
  | `obsidian_global_search` | Searches the entire vault for content. | `query`, `searchInPath?`, `useRegex?`, `page?`, `pageSize?` |
246
- | `obsidian_list_files` | Lists files and subdirectories in a folder. | `dirPath`, `fileExtensionFilter?`, `nameRegexFilter?` |
246
+ | `obsidian_list_notes` | Lists notes and subdirectories in a folder. | `dirPath`, `fileExtensionFilter?`, `nameRegexFilter?` |
247
247
  | `obsidian_manage_frontmatter` | Gets, sets, or deletes keys in a note's frontmatter. | `filePath`, `operation`, `key`, `value?` |
248
248
  | `obsidian_manage_tags` | Adds, removes, or lists tags in a note. | `filePath`, `operation`, `tags` |
249
- | `obsidian_delete_file` | Permanently deletes a file from the vault. | `filePath` |
249
+ | `obsidian_delete_note` | Permanently deletes a note from the vault. | `filePath` |
250
250
 
251
251
  _Note: All tools support comprehensive error handling and return structured JSON responses._
252
252
 
@@ -19,10 +19,10 @@ import { config, environment } from "../config/index.js";
19
19
  // Import core utilities: ErrorHandler, logger, requestContextService.
20
20
  import { ErrorHandler, logger, requestContextService } from "../utils/index.js";
21
21
  // Import registration functions for specific resources and tools.
22
- import { registerObsidianDeleteFileTool } from "./tools/obsidianDeleteFileTool/index.js";
22
+ import { registerObsidianDeleteNoteTool } from "./tools/obsidianDeleteNoteTool/index.js";
23
23
  import { registerObsidianGlobalSearchTool } from "./tools/obsidianGlobalSearchTool/index.js";
24
- import { registerObsidianListFilesTool } from "./tools/obsidianListFilesTool/index.js";
25
- import { registerObsidianReadFileTool } from "./tools/obsidianReadFileTool/index.js";
24
+ import { registerObsidianListNotesTool } from "./tools/obsidianListNotesTool/index.js";
25
+ import { registerObsidianReadNoteTool } from "./tools/obsidianReadNoteTool/index.js";
26
26
  import { registerObsidianSearchReplaceTool } from "./tools/obsidianSearchReplaceTool/index.js";
27
27
  import { registerObsidianUpdateNoteTool } from "./tools/obsidianUpdateNoteTool/index.js";
28
28
  import { registerObsidianManageFrontmatterTool } from "./tools/obsidianManageFrontmatterTool/index.js";
@@ -83,9 +83,9 @@ async function createMcpServerInstance(obsidianService, vaultCacheService) {
83
83
  try {
84
84
  logger.debug("Registering resources and tools using shared services...", context);
85
85
  // Register all tools, passing the vaultCacheService which may be undefined
86
- await registerObsidianListFilesTool(server, obsidianService);
87
- await registerObsidianReadFileTool(server, obsidianService);
88
- await registerObsidianDeleteFileTool(server, obsidianService, vaultCacheService);
86
+ await registerObsidianListNotesTool(server, obsidianService);
87
+ await registerObsidianReadNoteTool(server, obsidianService);
88
+ await registerObsidianDeleteNoteTool(server, obsidianService, vaultCacheService);
89
89
  if (vaultCacheService) {
90
90
  await registerObsidianGlobalSearchTool(server, obsidianService, vaultCacheService);
91
91
  }
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_delete_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_delete_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_delete_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianDeleteFileTool`)
4
+ * This file serves as the public entry point for the obsidian_delete_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianDeleteNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianDeleteFileTool } from "./registration.js";
12
+ export { registerObsidianDeleteNoteTool } from "./registration.js";
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_delete_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_delete_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_delete_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianDeleteFileTool`)
4
+ * This file serves as the public entry point for the obsidian_delete_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianDeleteNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianDeleteFileTool } from "./registration.js";
12
+ export { registerObsidianDeleteNoteTool } from "./registration.js";
@@ -2,9 +2,9 @@ import { z } from "zod";
2
2
  import { ObsidianRestApiService, VaultCacheService } from "../../../services/obsidianRestAPI/index.js";
3
3
  import { RequestContext } from "../../../utils/index.js";
4
4
  /**
5
- * Zod schema for validating the input parameters of the 'obsidian_delete_file' tool.
5
+ * Zod schema for validating the input parameters of the 'obsidian_delete_note' tool.
6
6
  */
7
- export declare const ObsidianDeleteFileInputSchema: z.ZodObject<{
7
+ export declare const ObsidianDeleteNoteInputSchema: z.ZodObject<{
8
8
  /**
9
9
  * The vault-relative path to the file to be permanently deleted.
10
10
  * Must include the file extension (e.g., "Old Notes/Obsolete File.md").
@@ -18,15 +18,15 @@ export declare const ObsidianDeleteFileInputSchema: z.ZodObject<{
18
18
  filePath: string;
19
19
  }>;
20
20
  /**
21
- * TypeScript type inferred from the input schema (`ObsidianDeleteFileInputSchema`).
21
+ * TypeScript type inferred from the input schema (`ObsidianDeleteNoteInputSchema`).
22
22
  * Represents the validated input parameters used within the core processing logic.
23
23
  */
24
- export type ObsidianDeleteFileInput = z.infer<typeof ObsidianDeleteFileInputSchema>;
24
+ export type ObsidianDeleteNoteInput = z.infer<typeof ObsidianDeleteNoteInputSchema>;
25
25
  /**
26
- * Defines the structure of the successful response returned by the `processObsidianDeleteFile` function.
26
+ * Defines the structure of the successful response returned by the `processObsidianDeleteNote` function.
27
27
  * This object is typically serialized to JSON and sent back to the client.
28
28
  */
29
- export interface ObsidianDeleteFileResponse {
29
+ export interface ObsidianDeleteNoteResponse {
30
30
  /** Indicates whether the deletion operation was successful. */
31
31
  success: boolean;
32
32
  /** A human-readable message confirming the deletion and specifying the path used. */
@@ -40,12 +40,12 @@ export interface ObsidianDeleteFileResponse {
40
40
  * it lists the directory, finds a unique case-insensitive match for the filename,
41
41
  * and retries the deletion with the corrected path.
42
42
  *
43
- * @param {ObsidianDeleteFileInput} params - The validated input parameters.
43
+ * @param {ObsidianDeleteNoteInput} params - The validated input parameters.
44
44
  * @param {RequestContext} context - The request context for logging and correlation.
45
45
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
46
- * @returns {Promise<ObsidianDeleteFileResponse>} A promise resolving to the structured success response
46
+ * @returns {Promise<ObsidianDeleteNoteResponse>} A promise resolving to the structured success response
47
47
  * containing a confirmation message.
48
48
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
49
49
  * if there's an ambiguous fallback match, or if any other API interaction fails.
50
50
  */
51
- export declare const processObsidianDeleteFile: (params: ObsidianDeleteFileInput, context: RequestContext, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<ObsidianDeleteFileResponse>;
51
+ export declare const processObsidianDeleteNote: (params: ObsidianDeleteNoteInput, context: RequestContext, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<ObsidianDeleteNoteResponse>;
@@ -6,9 +6,9 @@ import { logger, retryWithDelay, } from "../../../utils/index.js";
6
6
  // Schema Definitions for Input Validation
7
7
  // ====================================================================================
8
8
  /**
9
- * Zod schema for validating the input parameters of the 'obsidian_delete_file' tool.
9
+ * Zod schema for validating the input parameters of the 'obsidian_delete_note' tool.
10
10
  */
11
- export const ObsidianDeleteFileInputSchema = z
11
+ export const ObsidianDeleteNoteInputSchema = z
12
12
  .object({
13
13
  /**
14
14
  * The vault-relative path to the file to be permanently deleted.
@@ -33,18 +33,18 @@ export const ObsidianDeleteFileInputSchema = z
33
33
  * it lists the directory, finds a unique case-insensitive match for the filename,
34
34
  * and retries the deletion with the corrected path.
35
35
  *
36
- * @param {ObsidianDeleteFileInput} params - The validated input parameters.
36
+ * @param {ObsidianDeleteNoteInput} params - The validated input parameters.
37
37
  * @param {RequestContext} context - The request context for logging and correlation.
38
38
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
39
- * @returns {Promise<ObsidianDeleteFileResponse>} A promise resolving to the structured success response
39
+ * @returns {Promise<ObsidianDeleteNoteResponse>} A promise resolving to the structured success response
40
40
  * containing a confirmation message.
41
41
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
42
42
  * if there's an ambiguous fallback match, or if any other API interaction fails.
43
43
  */
44
- export const processObsidianDeleteFile = async (params, context, obsidianService, vaultCacheService) => {
44
+ export const processObsidianDeleteNote = async (params, context, obsidianService, vaultCacheService) => {
45
45
  const { filePath: originalFilePath } = params;
46
46
  let effectiveFilePath = originalFilePath; // Track the path actually used for deletion
47
- logger.debug(`Processing obsidian_delete_file request for path: ${originalFilePath}`, context);
47
+ logger.debug(`Processing obsidian_delete_note request for path: ${originalFilePath}`, context);
48
48
  const shouldRetryNotFound = (err) => err instanceof McpError && err.code === BaseErrorCode.NOT_FOUND;
49
49
  try {
50
50
  // --- Attempt 1: Delete using the provided path (case-sensitive) ---
@@ -1,7 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { ObsidianRestApiService, VaultCacheService } from "../../../services/obsidianRestAPI/index.js";
3
3
  /**
4
- * Registers the 'obsidian_delete_file' tool with the MCP server.
4
+ * Registers the 'obsidian_delete_note' tool with the MCP server.
5
5
  *
6
6
  * This tool permanently deletes a specified file from the user's Obsidian vault.
7
7
  * It requires the vault-relative path, including the file extension. The tool
@@ -16,4 +16,4 @@ import { ObsidianRestApiService, VaultCacheService } from "../../../services/obs
16
16
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
17
17
  * @throws {McpError} Throws an McpError if registration fails critically.
18
18
  */
19
- export declare const registerObsidianDeleteFileTool: (server: McpServer, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<void>;
19
+ export declare const registerObsidianDeleteNoteTool: (server: McpServer, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import { BaseErrorCode, McpError } from "../../../types-global/errors.js";
2
2
  import { ErrorHandler, logger, requestContextService, } from "../../../utils/index.js";
3
- import { ObsidianDeleteFileInputSchema, processObsidianDeleteFile, } from "./logic.js";
3
+ import { ObsidianDeleteNoteInputSchema, processObsidianDeleteNote, } from "./logic.js";
4
4
  /**
5
- * Registers the 'obsidian_delete_file' tool with the MCP server.
5
+ * Registers the 'obsidian_delete_note' tool with the MCP server.
6
6
  *
7
7
  * This tool permanently deletes a specified file from the user's Obsidian vault.
8
8
  * It requires the vault-relative path, including the file extension. The tool
@@ -17,26 +17,26 @@ import { ObsidianDeleteFileInputSchema, processObsidianDeleteFile, } from "./log
17
17
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
18
18
  * @throws {McpError} Throws an McpError if registration fails critically.
19
19
  */
20
- export const registerObsidianDeleteFileTool = async (server, obsidianService, vaultCacheService) => {
21
- const toolName = "obsidian_delete_file";
20
+ export const registerObsidianDeleteNoteTool = async (server, obsidianService, vaultCacheService) => {
21
+ const toolName = "obsidian_delete_note";
22
22
  // Updated description to accurately reflect the response (no timestamp)
23
23
  const toolDescription = "Permanently deletes a specified file from the Obsidian vault. Tries the exact path first, then attempts a case-insensitive fallback if the file is not found. Requires the vault-relative path including the file extension. Returns a success message.";
24
24
  // Create a context specifically for the registration process.
25
25
  const registrationContext = requestContextService.createRequestContext({
26
- operation: "RegisterObsidianDeleteFileTool",
26
+ operation: "RegisterObsidianDeleteNoteTool",
27
27
  toolName: toolName,
28
- module: "ObsidianDeleteFileRegistration", // Identify the module
28
+ module: "ObsidianDeleteNoteRegistration", // Identify the module
29
29
  });
30
30
  logger.info(`Attempting to register tool: ${toolName}`, registrationContext);
31
31
  // Wrap the registration logic in a tryCatch block for robust error handling during server setup.
32
32
  await ErrorHandler.tryCatch(async () => {
33
33
  // Use the high-level SDK method `server.tool` for registration.
34
- server.tool(toolName, toolDescription, ObsidianDeleteFileInputSchema.shape, // Provide the Zod schema shape for input definition.
34
+ server.tool(toolName, toolDescription, ObsidianDeleteNoteInputSchema.shape, // Provide the Zod schema shape for input definition.
35
35
  /**
36
- * The handler function executed when the 'obsidian_delete_file' tool is called by the client.
36
+ * The handler function executed when the 'obsidian_delete_note' tool is called by the client.
37
37
  *
38
- * @param {ObsidianDeleteFileInput} params - The input parameters received from the client,
39
- * validated against the ObsidianDeleteFileInputSchema shape.
38
+ * @param {ObsidianDeleteNoteInput} params - The input parameters received from the client,
39
+ * validated against the ObsidianDeleteNoteInputSchema shape.
40
40
  * @returns {Promise<CallToolResult>} A promise resolving to the structured result for the MCP client,
41
41
  * containing either the successful response data (serialized JSON) or an error indication.
42
42
  */
@@ -45,7 +45,7 @@ export const registerObsidianDeleteFileTool = async (server, obsidianService, va
45
45
  // Create a specific context for this handler invocation.
46
46
  const handlerContext = requestContextService.createRequestContext({
47
47
  parentContext: registrationContext, // Link to registration context
48
- operation: "HandleObsidianDeleteFileRequest",
48
+ operation: "HandleObsidianDeleteNoteRequest",
49
49
  toolName: toolName,
50
50
  params: { filePath: params.filePath }, // Log the file path being targeted
51
51
  });
@@ -54,7 +54,7 @@ export const registerObsidianDeleteFileTool = async (server, obsidianService, va
54
54
  return await ErrorHandler.tryCatch(async () => {
55
55
  // Delegate the actual file deletion logic to the processing function.
56
56
  // Note: Input schema and shape are identical, no separate refinement parse needed here.
57
- const response = await processObsidianDeleteFile(params, handlerContext, obsidianService, vaultCacheService);
57
+ const response = await processObsidianDeleteNote(params, handlerContext, obsidianService, vaultCacheService);
58
58
  logger.debug(`'${toolName}' processed successfully`, handlerContext);
59
59
  // Format the successful response object from the logic function into the required MCP CallToolResult structure.
60
60
  // The response object (success, message) is serialized to JSON.
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_list_files' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_list_notes' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_list_files tool module.
5
- * It re-exports the primary registration function (`registerObsidianListFilesTool`)
4
+ * This file serves as the public entry point for the obsidian_list_notes tool module.
5
+ * It re-exports the primary registration function (`registerObsidianListNotesTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianListFilesTool } from "./registration.js";
12
+ export { registerObsidianListNotesTool } from "./registration.js";
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_list_files' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_list_notes' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_list_files tool module.
5
- * It re-exports the primary registration function (`registerObsidianListFilesTool`)
4
+ * This file serves as the public entry point for the obsidian_list_notes tool module.
5
+ * It re-exports the primary registration function (`registerObsidianListNotesTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianListFilesTool } from "./registration.js";
12
+ export { registerObsidianListNotesTool } from "./registration.js";
@@ -1,16 +1,16 @@
1
1
  /**
2
- * @fileoverview Core logic for the 'obsidian_list_files' tool.
2
+ * @fileoverview Core logic for the 'obsidian_list_notes' tool.
3
3
  * This module defines the input schema, response types, and processing logic for
4
4
  * recursively listing files and directories in an Obsidian vault with filtering.
5
- * @module src/mcp-server/tools/obsidianListFilesTool/logic
5
+ * @module src/mcp-server/tools/obsidianListNotesTool/logic
6
6
  */
7
7
  import { z } from "zod";
8
8
  import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.js";
9
9
  import { RequestContext } from "../../../utils/index.js";
10
10
  /**
11
- * Zod schema for validating the input parameters of the 'obsidian_list_files' tool.
11
+ * Zod schema for validating the input parameters of the 'obsidian_list_notes' tool.
12
12
  */
13
- export declare const ObsidianListFilesInputSchema: z.ZodObject<{
13
+ export declare const ObsidianListNotesInputSchema: z.ZodObject<{
14
14
  /**
15
15
  * The vault-relative path to the directory whose contents should be listed.
16
16
  * The path is treated as case-sensitive by the underlying Obsidian API.
@@ -45,13 +45,13 @@ export declare const ObsidianListFilesInputSchema: z.ZodObject<{
45
45
  recursionDepth?: number | undefined;
46
46
  }>;
47
47
  /**
48
- * TypeScript type inferred from the input schema (`ObsidianListFilesInputSchema`).
48
+ * TypeScript type inferred from the input schema (`ObsidianListNotesInputSchema`).
49
49
  */
50
- export type ObsidianListFilesInput = z.infer<typeof ObsidianListFilesInputSchema>;
50
+ export type ObsidianListNotesInput = z.infer<typeof ObsidianListNotesInputSchema>;
51
51
  /**
52
52
  * Defines the structure of the successful response returned by the core logic function.
53
53
  */
54
- export interface ObsidianListFilesResponse {
54
+ export interface ObsidianListNotesResponse {
55
55
  directoryPath: string;
56
56
  tree: string;
57
57
  totalEntries: number;
@@ -59,10 +59,10 @@ export interface ObsidianListFilesResponse {
59
59
  /**
60
60
  * Processes the core logic for listing files and directories recursively within the Obsidian vault.
61
61
  *
62
- * @param {ObsidianListFilesInput} params - The validated input parameters.
62
+ * @param {ObsidianListNotesInput} params - The validated input parameters.
63
63
  * @param {RequestContext} context - The request context for logging and correlation.
64
64
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
65
- * @returns {Promise<ObsidianListFilesResponse>} A promise resolving to the structured success response.
65
+ * @returns {Promise<ObsidianListNotesResponse>} A promise resolving to the structured success response.
66
66
  * @throws {McpError} Throws an McpError if the initial directory is not found or another error occurs.
67
67
  */
68
- export declare const processObsidianListFiles: (params: ObsidianListFilesInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianListFilesResponse>;
68
+ export declare const processObsidianListNotes: (params: ObsidianListNotesInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianListNotesResponse>;
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @fileoverview Core logic for the 'obsidian_list_files' tool.
2
+ * @fileoverview Core logic for the 'obsidian_list_notes' tool.
3
3
  * This module defines the input schema, response types, and processing logic for
4
4
  * recursively listing files and directories in an Obsidian vault with filtering.
5
- * @module src/mcp-server/tools/obsidianListFilesTool/logic
5
+ * @module src/mcp-server/tools/obsidianListNotesTool/logic
6
6
  */
7
7
  import path from "node:path";
8
8
  import { z } from "zod";
@@ -12,9 +12,9 @@ import { logger, retryWithDelay, } from "../../../utils/index.js";
12
12
  // Schema Definitions for Input Validation
13
13
  // ====================================================================================
14
14
  /**
15
- * Zod schema for validating the input parameters of the 'obsidian_list_files' tool.
15
+ * Zod schema for validating the input parameters of the 'obsidian_list_notes' tool.
16
16
  */
17
- export const ObsidianListFilesInputSchema = z
17
+ export const ObsidianListNotesInputSchema = z
18
18
  .object({
19
19
  /**
20
20
  * The vault-relative path to the directory whose contents should be listed.
@@ -84,7 +84,7 @@ function formatTree(nodes, indent = "") {
84
84
  *
85
85
  * @param {string} dirPath - The path of the directory to process.
86
86
  * @param {number} currentDepth - The current recursion depth.
87
- * @param {ObsidianListFilesInput} params - The original validated input parameters, including filters and max depth.
87
+ * @param {ObsidianListNotesInput} params - The original validated input parameters, including filters and max depth.
88
88
  * @param {RequestContext} context - The request context for logging.
89
89
  * @param {ObsidianRestApiService} obsidianService - The Obsidian API service instance.
90
90
  * @returns {Promise<FileTreeNode[]>} A promise that resolves to an array of file tree nodes.
@@ -151,16 +151,16 @@ async function buildFileTree(dirPath, currentDepth, params, context, obsidianSer
151
151
  /**
152
152
  * Processes the core logic for listing files and directories recursively within the Obsidian vault.
153
153
  *
154
- * @param {ObsidianListFilesInput} params - The validated input parameters.
154
+ * @param {ObsidianListNotesInput} params - The validated input parameters.
155
155
  * @param {RequestContext} context - The request context for logging and correlation.
156
156
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
157
- * @returns {Promise<ObsidianListFilesResponse>} A promise resolving to the structured success response.
157
+ * @returns {Promise<ObsidianListNotesResponse>} A promise resolving to the structured success response.
158
158
  * @throws {McpError} Throws an McpError if the initial directory is not found or another error occurs.
159
159
  */
160
- export const processObsidianListFiles = async (params, context, obsidianService) => {
160
+ export const processObsidianListNotes = async (params, context, obsidianService) => {
161
161
  const { dirPath } = params;
162
162
  const dirPathForLog = dirPath === "" || dirPath === "/" ? "/" : dirPath;
163
- logger.debug(`Processing obsidian_list_files request for path: ${dirPathForLog}`, { ...context, params });
163
+ logger.debug(`Processing obsidian_list_notes request for path: ${dirPathForLog}`, { ...context, params });
164
164
  try {
165
165
  const effectiveDirPath = dirPath === "" ? "/" : dirPath;
166
166
  // --- Step 1: Build the file tree recursively with retry for the initial call ---
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @fileoverview Registers the 'obsidian_list_files' tool with the MCP server.
2
+ * @fileoverview Registers the 'obsidian_list_notes' tool with the MCP server.
3
3
  * This file defines the tool's metadata and sets up the handler that links
4
4
  * the tool call to its core processing logic.
5
- * @module src/mcp-server/tools/obsidianListFilesTool/registration
5
+ * @module src/mcp-server/tools/obsidianListNotesTool/registration
6
6
  */
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
8
  import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.js";
9
9
  /**
10
- * Registers the 'obsidian_list_files' tool with the MCP server.
10
+ * Registers the 'obsidian_list_notes' tool with the MCP server.
11
11
  *
12
12
  * This tool lists the files and subdirectories within a specified directory
13
13
  * in the user's Obsidian vault. It supports optional filtering by file extension,
@@ -20,4 +20,4 @@ import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.
20
20
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
21
21
  * @throws {McpError} Throws an McpError if registration fails critically.
22
22
  */
23
- export declare const registerObsidianListFilesTool: (server: McpServer, obsidianService: ObsidianRestApiService) => Promise<void>;
23
+ export declare const registerObsidianListNotesTool: (server: McpServer, obsidianService: ObsidianRestApiService) => Promise<void>;
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @fileoverview Registers the 'obsidian_list_files' tool with the MCP server.
2
+ * @fileoverview Registers the 'obsidian_list_notes' tool with the MCP server.
3
3
  * This file defines the tool's metadata and sets up the handler that links
4
4
  * the tool call to its core processing logic.
5
- * @module src/mcp-server/tools/obsidianListFilesTool/registration
5
+ * @module src/mcp-server/tools/obsidianListNotesTool/registration
6
6
  */
7
7
  import { BaseErrorCode, McpError } from "../../../types-global/errors.js";
8
8
  import { ErrorHandler, logger, requestContextService, } from "../../../utils/index.js";
9
- import { ObsidianListFilesInputSchema, processObsidianListFiles, } from "./logic.js";
9
+ import { ObsidianListNotesInputSchema, processObsidianListNotes, } from "./logic.js";
10
10
  /**
11
- * Registers the 'obsidian_list_files' tool with the MCP server.
11
+ * Registers the 'obsidian_list_notes' tool with the MCP server.
12
12
  *
13
13
  * This tool lists the files and subdirectories within a specified directory
14
14
  * in the user's Obsidian vault. It supports optional filtering by file extension,
@@ -21,25 +21,25 @@ import { ObsidianListFilesInputSchema, processObsidianListFiles, } from "./logic
21
21
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
22
22
  * @throws {McpError} Throws an McpError if registration fails critically.
23
23
  */
24
- export const registerObsidianListFilesTool = async (server, obsidianService) => {
25
- const toolName = "obsidian_list_files";
24
+ export const registerObsidianListNotesTool = async (server, obsidianService) => {
25
+ const toolName = "obsidian_list_notes";
26
26
  const toolDescription = "Lists files and subdirectories within a specified Obsidian vault folder. Supports optional filtering by extension or name regex, and recursive listing to a specified depth (-1 for infinite). Returns an object containing the listed directory path, a formatted tree string of its contents, and the total entry count. Use an empty string or '/' for dirPath to list the vault root.";
27
27
  // Create a context specifically for the registration process.
28
28
  const registrationContext = requestContextService.createRequestContext({
29
- operation: "RegisterObsidianListFilesTool",
29
+ operation: "RegisterObsidianListNotesTool",
30
30
  toolName: toolName,
31
- module: "ObsidianListFilesRegistration", // Identify the module
31
+ module: "ObsidianListNotesRegistration", // Identify the module
32
32
  });
33
33
  logger.info(`Attempting to register tool: ${toolName}`, registrationContext);
34
34
  // Wrap the registration logic in a tryCatch block for robust error handling during server setup.
35
35
  await ErrorHandler.tryCatch(async () => {
36
36
  // Use the high-level SDK method `server.tool` for registration.
37
- server.tool(toolName, toolDescription, ObsidianListFilesInputSchema.shape, // Provide the Zod schema shape for input definition.
37
+ server.tool(toolName, toolDescription, ObsidianListNotesInputSchema.shape, // Provide the Zod schema shape for input definition.
38
38
  /**
39
- * The handler function executed when the 'obsidian_list_files' tool is called by the client.
39
+ * The handler function executed when the 'obsidian_list_notes' tool is called by the client.
40
40
  *
41
- * @param {ObsidianListFilesInput} params - The input parameters received from the client,
42
- * validated against the ObsidianListFilesInputSchema shape.
41
+ * @param {ObsidianListNotesInput} params - The input parameters received from the client,
42
+ * validated against the ObsidianListNotesInputSchema shape.
43
43
  * @returns {Promise<CallToolResult>} A promise resolving to the structured result for the MCP client,
44
44
  * containing either the successful response data (serialized JSON) or an error indication.
45
45
  */
@@ -48,7 +48,7 @@ export const registerObsidianListFilesTool = async (server, obsidianService) =>
48
48
  // Create a specific context for this handler invocation.
49
49
  const handlerContext = requestContextService.createRequestContext({
50
50
  parentContext: registrationContext, // Link to registration context
51
- operation: "HandleObsidianListFilesRequest",
51
+ operation: "HandleObsidianListNotesRequest",
52
52
  toolName: toolName,
53
53
  params: {
54
54
  // Log all relevant parameters for debugging
@@ -62,7 +62,7 @@ export const registerObsidianListFilesTool = async (server, obsidianService) =>
62
62
  // Wrap the core logic execution in a tryCatch block.
63
63
  return await ErrorHandler.tryCatch(async () => {
64
64
  // Delegate the actual file listing and filtering logic to the processing function.
65
- const response = await processObsidianListFiles(params, handlerContext, obsidianService);
65
+ const response = await processObsidianListNotes(params, handlerContext, obsidianService);
66
66
  logger.debug(`'${toolName}' processed successfully`, handlerContext);
67
67
  // Format the successful response object from the logic function into the required MCP CallToolResult structure.
68
68
  return {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_read_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_read_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_read_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianReadFileTool`)
4
+ * This file serves as the public entry point for the obsidian_read_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianReadNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianReadFileTool } from "./registration.js";
12
+ export { registerObsidianReadNoteTool } from "./registration.js";
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_read_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_read_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_read_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianReadFileTool`)
4
+ * This file serves as the public entry point for the obsidian_read_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianReadNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianReadFileTool } from "./registration.js";
12
+ export { registerObsidianReadNoteTool } from "./registration.js";
@@ -2,9 +2,9 @@ import { z } from "zod";
2
2
  import { NoteJson, ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.js";
3
3
  import { RequestContext } from "../../../utils/index.js";
4
4
  /**
5
- * Zod schema for validating the input parameters of the 'obsidian_read_file' tool.
5
+ * Zod schema for validating the input parameters of the 'obsidian_read_note' tool.
6
6
  */
7
- export declare const ObsidianReadFileInputSchema: z.ZodObject<{
7
+ export declare const ObsidianReadNoteInputSchema: z.ZodObject<{
8
8
  /**
9
9
  * The vault-relative path to the target file (e.g., "Folder/My Note.md").
10
10
  * Must include the file extension. The tool first attempts a case-sensitive match.
@@ -34,10 +34,10 @@ export declare const ObsidianReadFileInputSchema: z.ZodObject<{
34
34
  includeStat?: boolean | undefined;
35
35
  }>;
36
36
  /**
37
- * TypeScript type inferred from the input schema (`ObsidianReadFileInputSchema`).
37
+ * TypeScript type inferred from the input schema (`ObsidianReadNoteInputSchema`).
38
38
  * Represents the validated input parameters used within the core processing logic.
39
39
  */
40
- export type ObsidianReadFileInput = z.infer<typeof ObsidianReadFileInputSchema>;
40
+ export type ObsidianReadNoteInput = z.infer<typeof ObsidianReadNoteInputSchema>;
41
41
  /**
42
42
  * Represents the structure of file statistics after formatting, including
43
43
  * human-readable timestamps and an estimated token count.
@@ -51,10 +51,10 @@ type FormattedStat = {
51
51
  tokenCountEstimate: number;
52
52
  };
53
53
  /**
54
- * Defines the structure of the successful response returned by the `processObsidianReadFile` function.
54
+ * Defines the structure of the successful response returned by the `processObsidianReadNote` function.
55
55
  * This object is typically serialized to JSON and sent back to the client.
56
56
  */
57
- export interface ObsidianReadFileResponse {
57
+ export interface ObsidianReadNoteResponse {
58
58
  /**
59
59
  * The content of the file in the requested format.
60
60
  * If format='markdown', this is a string.
@@ -75,13 +75,13 @@ export interface ObsidianReadFileResponse {
75
75
  * internally to access file statistics. Finally, it formats the response
76
76
  * according to the requested format ('markdown' or 'json') and the 'includeStat' flag.
77
77
  *
78
- * @param {ObsidianReadFileInput} params - The validated input parameters.
78
+ * @param {ObsidianReadNoteInput} params - The validated input parameters.
79
79
  * @param {RequestContext} context - The request context for logging and correlation.
80
80
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
81
- * @returns {Promise<ObsidianReadFileResponse>} A promise resolving to the structured success response
81
+ * @returns {Promise<ObsidianReadNoteResponse>} A promise resolving to the structured success response
82
82
  * containing the file content and optionally formatted statistics.
83
83
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
84
84
  * if there's an ambiguous fallback match, or if any other API interaction fails.
85
85
  */
86
- export declare const processObsidianReadFile: (params: ObsidianReadFileInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianReadFileResponse>;
86
+ export declare const processObsidianReadNote: (params: ObsidianReadNoteInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianReadNoteResponse>;
87
87
  export {};
@@ -10,14 +10,14 @@ import { createFormattedStatWithTokenCount, logger, retryWithDelay, } from "../.
10
10
  * - 'markdown': Returns the raw Markdown content as a string.
11
11
  * - 'json': Returns a structured NoteJson object including content, frontmatter, tags, and stats.
12
12
  */
13
- const ReadFileFormatSchema = z
13
+ const ReadNoteFormatSchema = z
14
14
  .enum(["markdown", "json"])
15
15
  .default("markdown")
16
16
  .describe("Specifies the format for the returned content ('markdown' or 'json'). Defaults to 'markdown'.");
17
17
  /**
18
- * Zod schema for validating the input parameters of the 'obsidian_read_file' tool.
18
+ * Zod schema for validating the input parameters of the 'obsidian_read_note' tool.
19
19
  */
20
- export const ObsidianReadFileInputSchema = z
20
+ export const ObsidianReadNoteInputSchema = z
21
21
  .object({
22
22
  /**
23
23
  * The vault-relative path to the target file (e.g., "Folder/My Note.md").
@@ -34,7 +34,7 @@ export const ObsidianReadFileInputSchema = z
34
34
  * 'json' returns a structured NoteJson object containing content, parsed frontmatter, tags, and file metadata (stat).
35
35
  * Defaults to 'markdown'.
36
36
  */
37
- format: ReadFileFormatSchema.optional() // Optional, defaults to 'markdown' via ReadFileFormatSchema
37
+ format: ReadNoteFormatSchema.optional() // Optional, defaults to 'markdown' via ReadNoteFormatSchema
38
38
  .describe("Format for the returned content ('markdown' or 'json'). Defaults to 'markdown'."),
39
39
  /**
40
40
  * If true and the requested format is 'markdown', includes formatted file statistics
@@ -59,18 +59,18 @@ export const ObsidianReadFileInputSchema = z
59
59
  * internally to access file statistics. Finally, it formats the response
60
60
  * according to the requested format ('markdown' or 'json') and the 'includeStat' flag.
61
61
  *
62
- * @param {ObsidianReadFileInput} params - The validated input parameters.
62
+ * @param {ObsidianReadNoteInput} params - The validated input parameters.
63
63
  * @param {RequestContext} context - The request context for logging and correlation.
64
64
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
65
- * @returns {Promise<ObsidianReadFileResponse>} A promise resolving to the structured success response
65
+ * @returns {Promise<ObsidianReadNoteResponse>} A promise resolving to the structured success response
66
66
  * containing the file content and optionally formatted statistics.
67
67
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
68
68
  * if there's an ambiguous fallback match, or if any other API interaction fails.
69
69
  */
70
- export const processObsidianReadFile = async (params, context, obsidianService) => {
70
+ export const processObsidianReadNote = async (params, context, obsidianService) => {
71
71
  const { filePath: originalFilePath, format: requestedFormat, includeStat, } = params;
72
72
  let effectiveFilePath = originalFilePath; // Track the actual path used (might change during fallback)
73
- logger.debug(`Processing obsidian_read_file request for path: ${originalFilePath}`, { ...context, format: requestedFormat, includeStat });
73
+ logger.debug(`Processing obsidian_read_note request for path: ${originalFilePath}`, { ...context, format: requestedFormat, includeStat });
74
74
  const shouldRetryNotFound = (err) => err instanceof McpError && err.code === BaseErrorCode.NOT_FOUND;
75
75
  try {
76
76
  let noteJson;
@@ -1,7 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.js";
3
3
  /**
4
- * Registers the 'obsidian_read_file' tool with the MCP server.
4
+ * Registers the 'obsidian_read_note' tool with the MCP server.
5
5
  *
6
6
  * This tool retrieves the content and optionally metadata of a specified file
7
7
  * within the user's Obsidian vault. It supports specifying the output format
@@ -17,4 +17,4 @@ import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.
17
17
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
18
18
  * @throws {McpError} Throws an McpError if registration fails critically.
19
19
  */
20
- export declare const registerObsidianReadFileTool: (server: McpServer, obsidianService: ObsidianRestApiService) => Promise<void>;
20
+ export declare const registerObsidianReadNoteTool: (server: McpServer, obsidianService: ObsidianRestApiService) => Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import { BaseErrorCode, McpError } from "../../../types-global/errors.js";
2
2
  import { ErrorHandler, logger, requestContextService, } from "../../../utils/index.js";
3
- import { ObsidianReadFileInputSchema, processObsidianReadFile, } from "./logic.js";
3
+ import { ObsidianReadNoteInputSchema, processObsidianReadNote, } from "./logic.js";
4
4
  /**
5
- * Registers the 'obsidian_read_file' tool with the MCP server.
5
+ * Registers the 'obsidian_read_note' tool with the MCP server.
6
6
  *
7
7
  * This tool retrieves the content and optionally metadata of a specified file
8
8
  * within the user's Obsidian vault. It supports specifying the output format
@@ -18,26 +18,26 @@ import { ObsidianReadFileInputSchema, processObsidianReadFile, } from "./logic.j
18
18
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
19
19
  * @throws {McpError} Throws an McpError if registration fails critically.
20
20
  */
21
- export const registerObsidianReadFileTool = async (server, obsidianService) => {
22
- const toolName = "obsidian_read_file";
21
+ export const registerObsidianReadNoteTool = async (server, obsidianService) => {
22
+ const toolName = "obsidian_read_note";
23
23
  const toolDescription = "Retrieves the content and metadata of a specified file within the Obsidian vault. Tries the exact path first, then attempts a case-insensitive fallback. Returns an object containing the content (markdown string or full NoteJson object based on 'format'), and optionally formatted file stats ('stats' object with creationTime, modifiedTime, tokenCountEstimate). Use 'includeStat: true' with 'format: markdown' to include stats; stats are always included with 'format: json'.";
24
24
  // Create a context specifically for the registration process.
25
25
  const registrationContext = requestContextService.createRequestContext({
26
- operation: "RegisterObsidianReadFileTool",
26
+ operation: "RegisterObsidianReadNoteTool",
27
27
  toolName: toolName,
28
- module: "ObsidianReadFileRegistration", // Identify the module
28
+ module: "ObsidianReadNoteRegistration", // Identify the module
29
29
  });
30
30
  logger.info(`Attempting to register tool: ${toolName}`, registrationContext);
31
31
  // Wrap the registration logic in a tryCatch block for robust error handling during server setup.
32
32
  await ErrorHandler.tryCatch(async () => {
33
33
  // Use the high-level SDK method `server.tool` for registration.
34
34
  // It handles schema generation from the shape, basic validation, and routing.
35
- server.tool(toolName, toolDescription, ObsidianReadFileInputSchema.shape, // Provide the Zod schema shape for input definition.
35
+ server.tool(toolName, toolDescription, ObsidianReadNoteInputSchema.shape, // Provide the Zod schema shape for input definition.
36
36
  /**
37
- * The handler function executed when the 'obsidian_read_file' tool is called by the client.
37
+ * The handler function executed when the 'obsidian_read_note' tool is called by the client.
38
38
  *
39
- * @param {ObsidianReadFileInput} params - The input parameters received from the client,
40
- * validated against the ObsidianReadFileInputSchema shape. Note: The handler receives the raw input;
39
+ * @param {ObsidianReadNoteInput} params - The input parameters received from the client,
40
+ * validated against the ObsidianReadNoteInputSchema shape. Note: The handler receives the raw input;
41
41
  * stricter validation against the full schema should happen inside if needed, though in this case,
42
42
  * the shape and the full schema are identical.
43
43
  * @returns {Promise<CallToolResult>} A promise resolving to the structured result for the MCP client,
@@ -48,7 +48,7 @@ export const registerObsidianReadFileTool = async (server, obsidianService) => {
48
48
  // Create a specific context for this handler invocation.
49
49
  const handlerContext = requestContextService.createRequestContext({
50
50
  parentContext: registrationContext, // Link to registration context
51
- operation: "HandleObsidianReadFileRequest",
51
+ operation: "HandleObsidianReadNoteRequest",
52
52
  toolName: toolName,
53
53
  params: {
54
54
  // Log key parameters for debugging
@@ -63,7 +63,7 @@ export const registerObsidianReadFileTool = async (server, obsidianService) => {
63
63
  // Delegate the actual file reading logic to the dedicated processing function.
64
64
  // Pass the (already shape-validated) parameters, context, and the Obsidian service.
65
65
  // The process function handles the refined validation internally if needed, but here shape = refined.
66
- const response = await processObsidianReadFile(params, // Pass params directly as shape matches refined schema
66
+ const response = await processObsidianReadNote(params, // Pass params directly as shape matches refined schema
67
67
  handlerContext, obsidianService);
68
68
  logger.debug(`'${toolName}' processed successfully`, handlerContext);
69
69
  // Format the successful response object from the logic function into the required MCP CallToolResult structure.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-mcp-server",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Obsidian Knowledge-Management MCP (Model Context Protocol) server that enables AI agents and development tools to interact with an Obsidian vault. It provides a comprehensive suite of tools for reading, writing, searching, and managing notes, tags, and frontmatter, acting as a bridge to the Obsidian Local REST API plugin.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -26,10 +26,10 @@
26
26
  "start": "node dist/index.js",
27
27
  "start:stdio": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=stdio node dist/index.js",
28
28
  "start:http": "MCP_LOG_LEVEL=debug MCP_TRANSPORT_TYPE=http node dist/index.js",
29
- "rebuild": "ts-node --esm scripts/clean.ts && npm run build",
30
- "fetch:spec": "ts-node --esm scripts/fetch-openapi-spec.ts",
29
+ "rebuild": "npx ts-node --esm scripts/clean.ts && npm run build",
30
+ "fetch:spec": "npx ts-node --esm scripts/fetch-openapi-spec.ts",
31
31
  "docs:generate": "typedoc --tsconfig ./tsconfig.typedoc.json",
32
- "tree": "ts-node --esm scripts/tree.ts",
32
+ "tree": "npx ts-node --esm scripts/tree.ts",
33
33
  "format": "prettier --write \"**/*.{ts,js,json,md,html,css}\"",
34
34
  "inspect": "mcp-inspector --config mcp.json",
35
35
  "inspect:stdio": "mcp-inspector --config mcp.json --server obsidian-mcp-server-stdio",