Skip to main content
Glama
ToKiDoO

Advanced Obsidian MCP Server

by ToKiDoO

obsidian_execute_commands

Execute multiple Obsidian commands sequentially to automate workflows, such as note operations and interface actions, through the Advanced Obsidian MCP Server.

Instructions

Execute one or more commands in obsidian interface, in order. For commands used on specific notes, make sure to open a note first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandsYesList of commands to execute

Implementation Reference

  • The run_tool method in ExecuteCommandsToolHandler that implements the core logic of the 'obsidian_execute_commands' tool: executes each command in the input list using api.execute_command and returns success/error messages.
    def run_tool(self, args: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]:
        commands = args.get("commands")
        if not commands:
            raise ValueError("One or more commands are required")
    
        results = []
        success = True
    
        for command in commands:
            try:
                api.execute_command(command)
                results.append(f"Command '{command}' executed successfully")
            except Exception as e:
                success = False
                results.append(f"Failed to execute command '{command}': {str(e)}")
    
        if success:
            return [
                TextContent(
                    type="text",
                    text="All commands executed successfully!"
                )
            ]
        else:
            return [
                TextContent(
                    type="text",
                    text="\n".join(results)
                )
            ]
  • The inputSchema defined in get_tool_description of ExecuteCommandsToolHandler for validating tool arguments: requires an array of command strings.
    return Tool(
        name=self.name,
        description="Execute one or more commands in obsidian interface, *in order*. For commands used on specific notes, make sure to open a note first.",
        inputSchema={
            "type": "object",
            "properties": {
                "commands": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "description": "Command to execute"
                    },
                    "description": "List of commands to execute"
                },
            },
            "required": ["commands"]
        }
    )
  • TOOL_MAPPING dictionary that associates the tool name 'obsidian_execute_commands' (imported as tools.TOOL_EXECUTE_COMMANDS) with its handler class for 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,
    }
  • register_tools function that instantiates handlers from TOOL_MAPPING (conditionally based on INCLUDE_TOOLS env var) and adds them to tool_handlers dictionary used by MCP server endpoints.
    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")
  • Constant defining the tool name string 'obsidian_execute_commands', used in handler __init__ and server registration mapping.
    TOOL_EXECUTE_COMMANDS = "obsidian_execute_commands"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions execution order ('in order') and a prerequisite for note-specific commands, but fails to cover critical aspects like whether this tool is read-only or destructive, what permissions are needed, error handling, or rate limits. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences that are front-loaded: the first states the core purpose, and the second adds a specific usage note. There's no wasted text, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing commands in an interface, the lack of annotations, and no output schema, the description is incomplete. It misses details on return values, error cases, side effects, and how it interacts with sibling tools, making it inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the 'commands' parameter as a list of strings. The description adds minimal value beyond this by emphasizing execution order and note-related context, but doesn't provide additional semantic details like command examples, format, or constraints. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Execute one or more commands in obsidian interface') and specifies the resource ('obsidian interface'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'obsidian_list_commands' or 'obsidian_understand_vault' beyond the execution aspect, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by mentioning 'For commands used on specific notes, make sure to open a note first,' which suggests a prerequisite context. However, it lacks explicit when-to-use vs. alternatives (e.g., compared to 'obsidian_list_commands' or other sibling tools) and doesn't specify exclusions, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ToKiDoO/mcp-obsidian-advanced'

If you have feedback or need assistance with the MCP directory API, please join our Discord server