configure_vault
Set the absolute path to your Obsidian vault for local-first access.
Instructions
Configure the Obsidian vault path.
Args: vault_path: Absolute path to your Obsidian vault
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vault_path | Yes |
Implementation Reference
- server.py:61-84 (handler)The tool handler for 'configure_vault' that sets the vault path, resets the client, initializes a new ObsidianVaultClient, and returns success with note count or an error.
@mcp.tool() def configure_vault(vault_path: str) -> dict: """Configure the Obsidian vault path. Args: vault_path: Absolute path to your Obsidian vault """ global _vault_client, _vault_path _vault_path = vault_path _vault_client = None # Reset client try: client = get_vault_client() return { "success": True, "message": f"Vault configured successfully: {vault_path}", "note_count": len(client.list_notes()) } except Exception as e: return { "success": False, "error": str(e) } - server.py:61-61 (registration)The tool is registered with the MCP server via the @mcp.tool() decorator on the configure_vault function.
@mcp.tool() - server.py:44-58 (helper)Helper function used by configure_vault to initialize and retrieve the ObsidianVaultClient instance.
def get_vault_client() -> ObsidianVaultClient: """Get or create the vault client.""" global _vault_client, _vault_path if _vault_client is None: if _vault_path is None: # Try to get from environment variable _vault_path = os.getenv("OBSIDIAN_VAULT_PATH") if not _vault_path: raise ValueError("Obsidian vault path not configured. Set OBSIDIAN_VAULT_PATH environment variable.") _vault_client = ObsidianVaultClient(_vault_path, backup_on_write=backup_on_write_enabled()) logger.info(f"Connected to vault: {_vault_path}") return _vault_client - server.py:62-67 (schema)Input schema: takes a single 'vault_path' string parameter. Returns a dict with success/error structure.
def configure_vault(vault_path: str) -> dict: """Configure the Obsidian vault path. Args: vault_path: Absolute path to your Obsidian vault """