obsidian_list_commands
Discover available commands to execute within Obsidian by listing all interface actions, enabling command execution through the MCP server's integration.
Instructions
List all available commands you can run in obsidian interface. For commands used on specific notes, make sure to open a note first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The run_tool method of ListCommandsToolHandler that executes the core logic: calls api.list_commands() and returns the JSON list of Obsidian commands.def run_tool(self, args: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]: commands = api.list_commands() return [ TextContent( type="text", text=json.dumps(commands, indent=2) ) ]
- The get_tool_description method defining the tool schema: no input parameters required.def get_tool_description(self): return Tool( name=self.name, description="List all available commands you can run in obsidian interface. For commands used on specific notes, make sure to open a note first.", inputSchema={ "type": "object", "properties": {}, } )
- src/mcp_obsidian_advanced/server.py:26-43 (registration)TOOL_MAPPING dictionary that maps the tool name 'obsidian_list_commands' (via constant) to its handler class ListCommandsToolHandler, used during registration.TOOL_MAPPING = { tools.TOOL_LIST_FILES_IN_DIR: tools.ListFilesInDirToolHandler, tools.TOOL_SIMPLE_SEARCH: tools.SearchToolHandler, tools.TOOL_PATCH_CONTENT: tools.PatchContentToolHandler, tools.TOOL_PUT_CONTENT: tools.PutContentToolHandler, tools.TOOL_APPEND_CONTENT: tools.AppendContentToolHandler, tools.TOOL_DELETE_FILE: tools.DeleteFileToolHandler, tools.TOOL_COMPLEX_SEARCH: tools.ComplexSearchToolHandler, tools.TOOL_BATCH_GET_FILES: tools.BatchGetFilesToolHandler, tools.TOOL_PERIODIC_NOTES: tools.PeriodicNotesToolHandler, tools.TOOL_RECENT_PERIODIC_NOTES: tools.RecentPeriodicNotesToolHandler, tools.TOOL_RECENT_CHANGES: tools.RecentChangesToolHandler, tools.TOOL_UNDERSTAND_VAULT: tools.UnderstandVaultToolHandler, tools.TOOL_GET_ACTIVE_NOTE: tools.GetActiveNoteToolHandler, tools.TOOL_OPEN_FILES: tools.OpenFilesToolHandler, tools.TOOL_LIST_COMMANDS: tools.ListCommandsToolHandler, tools.TOOL_EXECUTE_COMMANDS: tools.ExecuteCommandsToolHandler, }
- The Obsidian class method list_commands() that makes the HTTP request to Obsidian API to fetch the list of commands, called by the tool handler.def list_commands(self) -> Any: """List all available commands you can run in obsidian interface. For commands on open notes, make sure to open a note first. Returns: List of available commands in obsidian. """ url = f"{self.get_base_url()}/commands/" def call_fn(): response = requests.get(url, headers=self._get_headers(), verify=self.verify_ssl, timeout=self.timeout) response.raise_for_status() return response.json() return self._safe_call(call_fn)
- src/mcp_obsidian_advanced/server.py:95-108 (registration)The register_tools function that iterates over selected tools, instantiates the handler classes from TOOL_MAPPING, and adds them to tool_handlers dictionary for use in list_tools and call_tool.def register_tools(): """Register the selected tools with the server.""" tools_to_include = parse_include_tools() registered_count = 0 for tool_name in tools_to_include: if tool_name in TOOL_MAPPING: handler_class = TOOL_MAPPING[tool_name] handler_instance = handler_class() add_tool_handler(handler_instance) registered_count += 1 logger.debug(f"Registered tool: {tool_name}") logger.info(f"Successfully registered {registered_count} tools")