This commit resolves all required and optional issues from the plugin
submission review to comply with Obsidian plugin guidelines.
Required Changes:
- Type Safety: Added eslint-disable comments with justifications for
necessary any types in JSON-RPC tool argument handling
- Command IDs: Removed redundant "mcp-server" prefix from command
identifiers (BREAKING CHANGE):
- start-mcp-server → start-server
- stop-mcp-server → stop-server
- restart-mcp-server → restart-server
- Promise Handling: Added void operator for intentional fire-and-forget
promise in notification queue processing
- ESLint Directives: Added descriptive explanations to all
eslint-disable comments
- Switch Statement Scope: Wrapped case blocks in braces to fix lexical
declaration warnings in glob pattern matcher
- Regular Expression: Added eslint-disable comment for control character
validation in Windows path checking
- Type Definitions: Changed empty object type {} to object in MCP
capabilities interface
- Import Statements: Added comprehensive justifications for require()
usage in Electron/Node.js modules (synchronous access required)
Optional Improvements:
- Code Cleanup: Removed unused imports (MCPPluginSettings, TFile,
VaultInfo)
Documentation:
- Enhanced inline code documentation for ESLint suppressions and
require() statements
- Added detailed rationale for synchronous module loading requirements
in Obsidian plugin context
- Updated CHANGELOG.md for version 1.1.2
All changes verified:
- Build: Successful with no TypeScript errors
- Tests: All 760 tests passing
- ESLint: All review-required issues resolved
Version bumped to 1.1.2 in package.json and manifest.json
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace all `any` types with properly defined TypeScript interfaces and types throughout the codebase to improve type safety and eliminate type-related code quality issues.
Changes:
- Define ElectronSafeStorage interface for Electron's safeStorage API
- Create LegacySettings interface for settings migration in main.ts
- Define JSONValue, JSONRPCParams types for JSON-RPC protocol
- Define JSONSchemaProperty for tool input schemas
- Create YAMLValue type for frontmatter values
- Define FrontmatterValue type for adapter interfaces
- Update middleware to use proper Express NextFunction and JSONRPCResponse types
- Fix tool registry to handle args with proper typing (with eslint-disable for dynamic dispatch)
- Fix notifications to use proper types with eslint-disable where dynamic access is needed
- Add proper null safety assertions where appropriate
- Fix TFolder stat access with proper type extension
All type errors resolved. TypeScript compilation passes with --skipLibCheck.
Extended word count functionality to read operations (read_note, stat, list) to complement existing write operation support.
Changes:
- read_note: Now automatically includes wordCount when returning content (with withContent or parseFrontmatter options)
- stat: Added optional includeWordCount parameter with performance warning
- list: Added optional includeWordCount parameter with performance warning
- All operations use same word counting rules (excludes frontmatter and Obsidian comments)
- Best-effort error handling for batch operations
Technical details:
- Updated ParsedNote and FileMetadata type definitions to include optional wordCount field
- Added comprehensive test coverage (18 new tests)
- Updated tool descriptions with usage notes and performance warnings
- Updated CHANGELOG.md to document new features in version 1.1.0
Add automatic word count and link validation to create_note, update_note,
and update_sections operations to provide immediate feedback on note content
quality and link integrity.
Features:
- Word counting excludes frontmatter and Obsidian comments, includes all
other content (code blocks, inline code, headings, lists, etc.)
- Link validation checks wikilinks, heading links, and embeds
- Results categorized as: valid links, broken notes (note doesn't exist),
and broken headings (note exists but heading missing)
- Detailed broken link info includes line number and context snippet
- Human-readable summary (e.g., "15 links: 12 valid, 2 broken notes, 1 broken heading")
- Opt-out capability via validateLinks parameter (default: true) for
performance-critical operations
Implementation:
- New ContentUtils.countWords() for word counting logic
- Enhanced LinkUtils.validateLinks() for comprehensive link validation
- Updated create_note, update_note, update_sections to return wordCount
and linkValidation fields
- Updated MCP tool descriptions to document new features and parameters
- update_note now returns structured JSON instead of simple success message
Response format changes:
- create_note: added wordCount and linkValidation fields
- update_note: changed to structured response with wordCount and linkValidation
- update_sections: added wordCount and linkValidation fields
Breaking changes:
- update_note response format changed from simple message to structured JSON
Replace vault.delete() with fileManager.trashFile() to respect user's
trash preferences configured in Obsidian settings. This ensures deleted
files go to the user's configured trash location instead of being
permanently deleted without respecting system preferences.
Changes:
- src/tools/note-tools.ts: Replace vault.delete with fileManager.trashFile
in createNote (overwrite conflict) and deleteNote (permanent delete)
- tests/note-tools.test.ts: Update test expectations to check for
fileManager.trashFile calls instead of vault.delete
Addresses ObsidianReviewBot required issue #3.
Replace hardcoded .obsidian references in exclude pattern examples
with generic 'templates' folder. Config directory location is
user-configurable in Obsidian, so examples should not reference
system directories.
Addresses ObsidianReviewBot feedback for plugin submission.
Removed console.error calls from error handlers that gracefully skip
problematic files and continue processing. These handlers catch errors
when reading or parsing files but successfully return fallback values,
so logging errors creates unnecessary noise during testing and deployment.
Changes:
- vault-tools.ts: Remove console.error from search and frontmatter extraction
- search-utils.ts: Remove console.error from file search handlers
- waypoint-utils.ts: Remove console.error from file read handler
- frontmatter-utils.ts: Remove console.error from YAML and Excalidraw parsing
Test updates:
- Remove test assertions checking for console.error calls since these
are no longer emitted by graceful error handlers
All 709 tests pass with no console noise during error handling.
- Added test for getFolderWaypoint file read error handling (line 777)
- Documented unreachable defensive code in stat() (lines 452-456)
- Documented unreachable defensive code in exists() (lines 524-528)
- Added istanbul ignore comments for unreachable defensive returns
Analysis:
- Lines 452-456 and 524-528 are unreachable because getAbstractFileByPath
only returns TFile, TFolder, or null - all cases are handled before
the defensive fallback code
- Line 777 is now covered by testing file read errors in getFolderWaypoint
Coverage: vault-tools.ts now at 100% statement coverage (99.8% tools overall)
Test count: 84 vault-tools tests, 505 total tests passing
Updated VaultTools to use adapters for all utility method calls:
- SearchUtils.searchWaypoints() now receives vault adapter
- WaypointUtils.isFolderNote() now receives vault adapter
- LinkUtils.validateWikilinks() now receives vault and metadata adapters
- LinkUtils.resolveLink() now receives vault and metadata adapters
- LinkUtils.getBacklinks() now receives vault and metadata adapters
Removed App dependency from VaultTools constructor - now only requires
vault and metadata adapters. Updated factory and all test files accordingly.
All tests passing (336/336).
Implements Task 10 from the implementation plan:
1. Updated NoteTools constructor to accept IVaultAdapter and IFileManagerAdapter
2. Created note-tools-factory.ts with factory function
3. Migrated all CRUD methods to use adapters:
- readNote: uses vault.read()
- createNote: uses vault.create(), vault.delete()
- createParentFolders: uses vault.createFolder()
- updateNote: uses vault.read(), vault.modify()
- deleteNote: uses vault.trash(), vault.delete()
- renameFile: uses fileManager.renameFile()
- readExcalidraw: uses vault.read()
- updateFrontmatter: uses vault.read(), vault.modify()
- updateSections: uses vault.read(), vault.modify()
4. Extended IVaultAdapter interface with modify(), delete(), and trash() methods
5. Implemented new methods in VaultAdapter
6. Updated ToolRegistry to use factory function
7. Kept app parameter temporarily for PathUtils dependency
8. All methods now use adapters instead of direct Obsidian API calls
9. Code compiles successfully
This change enables 100% test coverage by allowing full mocking of vault operations.
Update validateWikilinks, resolveWikilink, and getBacklinks methods
to use IVaultAdapter and IMetadataCacheAdapter instead of direct App access.
- Implemented inline link suggestion finding using vault adapter
- Implemented backlinks retrieval using metadata cache adapter
- Added helper methods: findLinkSuggestions, extractSnippet, escapeRegex
- App parameter still required for waypoint methods (not in scope for this task)
Update search and getVaultInfo methods to use IVaultAdapter
instead of direct App.vault access. Implements inline search
logic using adapters for file reading and markdown file listing.
Update VaultTools constructor to accept IVaultAdapter and
IMetadataCacheAdapter. Add factory function for production usage.
Update stat, exists, and createFileMetadataWithFrontmatter methods.
Implement visual feedback for MCP tool calls with configurable notifications.
Features:
- Real-time notifications when tools are called (request only, no completion)
- Tool-specific emoji icons for visual clarity
- Rate limiting (max 10 notifications/second)
- Notification history tracking (last 100 entries)
- Configurable settings: enable/disable, show parameters, duration, console logging
- History modal with filtering and export to clipboard
Implementation:
- Created NotificationManager with queue-based rate limiting
- Created NotificationHistoryModal for viewing past tool calls
- Integrated into tool call interceptor in ToolRegistry
- Added notification settings UI section
- Added 'View MCP Notification History' command
Benefits:
- Visual feedback for debugging and monitoring
- Transparency into AI agent actions
- Simple on/off toggle, no complex verbosity settings
- Zero performance impact when disabled
- History tracks success/failure/duration for all calls
All 10 phases of the roadmap are now complete\!
Implement three new tools for wikilink validation, resolution, and backlink queries:
New Tools:
- validate_wikilinks: Validate all wikilinks in a note with suggestions for broken links
- resolve_wikilink: Resolve a single wikilink to its target path
- backlinks: Get all backlinks to a note with optional unlinked mentions
New Files:
- src/utils/link-utils.ts: Complete wikilink parsing, resolution, and backlink utilities
Modified Files:
- src/tools/vault-tools.ts: Added 3 new methods for link operations
- src/tools/index.ts: Added 3 tool definitions and handlers
- src/types/mcp-types.ts: Added Phase 9 type definitions
- ROADMAP.md: Marked Phase 9 as complete
- CHANGELOG.md: Added v8.0.0 release notes
Key Features:
- Regex-based wikilink parsing with position tracking
- Uses MetadataCache.getFirstLinkpathDest() for accurate resolution
- Fuzzy matching suggestion engine for broken links
- Efficient backlink detection using MetadataCache.resolvedLinks
- Optional unlinked mentions with word-boundary matching
- Context snippet extraction for each occurrence
- Add get_folder_waypoint tool to extract waypoint blocks from folder notes
- Add is_folder_note tool to detect folder notes by basename or waypoint markers
- Implement waypoint edit protection in update_note to prevent corruption
- Create waypoint-utils.ts with helper functions for waypoint operations
- Add FolderWaypointResult and FolderNoteResult types
- Update ROADMAP.md and CHANGELOG.md with Phase 7 completion
- All manual tests passing
- Add enhanced 'search' tool with regex support, case sensitivity control, and advanced filtering
- Add 'search_waypoints' tool for finding Waypoint plugin markers
- Implement SearchUtils with regex/literal search, snippet extraction, and match highlighting
- Add WaypointResult and WaypointSearchResult types
- Update SearchResult type to include isRegex field
- Remove deprecated search_notes tool (breaking change)
- Support glob filtering (includes/excludes) and folder scoping
- Configurable snippet length and result limiting
- Extract wikilinks from waypoint content
Breaking Changes:
- search_notes tool removed, use 'search' tool instead
- Enhanced read_note tool with frontmatter parsing options
- parseFrontmatter option to separate frontmatter from content
- withFrontmatter and withContent options for flexible responses
- Returns structured ParsedNote JSON when parsing enabled
- Backward compatible (default behavior unchanged)
- New read_excalidraw tool for Excalidraw file metadata
- Detects compressed-json format (Excalidraw's actual format)
- Returns elementCount, hasCompressedData, metadata fields
- Handles compressed (base64) and uncompressed formats
- Preview text extraction from Text Elements section
- Optional full compressed data inclusion
- New frontmatter-utils.ts for YAML parsing
- Uses Obsidian's built-in parseYaml
- Extracts and parses frontmatter
- Handles edge cases (no frontmatter, malformed YAML)
- Excalidraw metadata parsing with compression detection
- Enhanced type definitions with JSDoc comments
- ParsedNote interface for structured note data
- ExcalidrawMetadata interface with detailed field docs
- Clear documentation of all fields and their purposes
- Comprehensive documentation
- IMPLEMENTATION_NOTES_PHASE5.md - Implementation details
- EXCALIDRAW_FIX_SUMMARY.md - Bug fix documentation
- EXCALIDRAW_TESTING_GUIDE.md - Testing instructions
- Updated CHANGELOG.md with all changes
- Updated ROADMAP.md marking Phase 5 complete
- Known limitation documented
- elementCount returns 0 for compressed files (expected)
- Decompression would require pako library (not included)
- hasCompressedData correctly identifies compressed files
- Preview text still available without decompression
- Added to roadmap as future enhancement
All manual tests passed. Phase 5 complete and production-ready.
- Add stat tool for detailed file/folder metadata
- Add exists tool for fast path existence checking
- Add StatResult and ExistsResult type definitions
- Implement stat() and exists() methods in VaultTools
- Register both tools in ToolRegistry with complete schemas
- Update version to 2.1.0
- Update ROADMAP.md to mark Phase 3 complete
- Update CHANGELOG.md with Phase 3 release notes
- Add IMPLEMENTATION_NOTES_PHASE3.md documentation
- Clean up old phase documentation files
Phase 2 - Breaking Changes (v2.0.0):
- Added typed result interfaces (FileMetadata, DirectoryMetadata, VaultInfo, SearchResult, SearchMatch)
- Unified parameter naming: list_notes now uses 'path' parameter (removed 'folder')
- Enhanced tool responses with structured JSON for all tools
- list_notes: Returns array of FileMetadata/DirectoryMetadata with full metadata
- search_notes: Returns SearchResult with line numbers, snippets, and match ranges
- get_vault_info: Returns VaultInfo with comprehensive statistics
- Updated all tool descriptions to document structured responses
- Version bumped to 2.0.0 (breaking changes)
Phase 2.1 - Post-Testing Fixes:
- Fixed root listing to exclude vault root folder itself (handles path '', '/', and isRoot())
- Fixed alphabetical sorting to be case-insensitive for stable ordering
- Improved directory metadata with better timestamp detection and error handling
- Fixed parent folder validation order (check if file before checking existence)
- Updated documentation with root path examples and leading slash warnings
- Added comprehensive test suite for sorting and root listing behavior
- Fixed test mocks to use proper TFile/TFolder instances
Tests: All 64 tests passing
Build: Successful, no errors