feat: Add Obsidian command execution support via MCP tools (#29)#47
Open
vanmarkic wants to merge 2 commits intojacksteamdev:mainfrom
Open
Conversation
…dev#29) Implemented two new MCP tools to expose Obsidian's command palette functionality: **New Tools:** 1. `list_obsidian_commands` - Lists all available Obsidian commands with their IDs and names 2. `execute_obsidian_command` - Executes a command by its ID **Use Cases:** - Automated daily note creation respecting plugin configurations - External triggering of plugin-specific workflows - Command palette automation through MCP integration - Integration with AI assistants for workflow automation **Implementation:** - Leverages existing Local REST API `/commands/` endpoints - Uses proper schema validation with empty object for no-arg tools - Includes descriptive examples in tool descriptions - URL-encodes command IDs to handle special characters safely **Example commands that can be executed:** - `daily-notes` - Create today's daily note - `editor:toggle-bold` - Toggle bold formatting - `workspace:split-vertical` - Split workspace vertically - Plugin-specific commands from installed plugins This allows MCP clients like Claude Desktop to discover and execute any Obsidian command, enabling powerful automation while respecting plugin settings and templates. Fixes jacksteamdev#29
- Test list_obsidian_commands schema structure - Test execute_obsidian_command schema with commandId argument - Test command ID validation and type checking - Test URL encoding for command IDs with special characters - Test encoding of colons, slashes, spaces in command IDs - Test ApiCommandsResponse and ApiCommand schema structures - Test integration between listing and executing commands - Verify common Obsidian command patterns are properly encoded
✅ Deploy Preview for superb-starlight-b5acb5 canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
list_commandstool to retrieve available Obsidian commandsexecute_commandtool to run commands by IDRelated Issue
Addresses feature request #29
🤖 Generated with Claude Code