get_current_vault
Retrieve details about the currently active note vault to understand the working context and access organized markdown files.
Instructions
Get information about the currently active vault
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/vault-handlers.ts:260-305 (handler)The main handler function for the 'get_current_vault' tool. It retrieves the current vault information from GlobalConfigManager, formats it nicely, and returns it as a text response. Handles the case where no vault is selected.
handleGetCurrentVault = async (): Promise<{ content: Array<{ type: string; text: string }>; }> => { try { const currentVault = this.globalConfig.getCurrentVault(); if (!currentVault) { return { content: [ { type: 'text', text: '⚠️ No vault is currently selected. Use list_vaults to see available vaults or create_vault to add a new one.' } ] }; } // Find the vault ID const vaults = this.globalConfig.listVaults(); const currentVaultEntry = vaults.find(v => v.is_current); const vaultId = currentVaultEntry?.info.id || 'unknown'; return { content: [ { type: 'text', text: `🟢 **Current Vault**: ${currentVault.name} (${vaultId}) **Path**: ${currentVault.path} **Created**: ${new Date(currentVault.created).toLocaleDateString()} **Last accessed**: ${new Date(currentVault.last_accessed).toLocaleDateString()}${currentVault.description ? `\n**Description**: ${currentVault.description}` : ''}` } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text', text: `Failed to get current vault: ${errorMessage}` } ] }; } }; - src/server/tool-schemas.ts:630-637 (schema)The input schema definition for the 'get_current_vault' tool, specifying no required parameters.
name: 'get_current_vault', description: 'Get information about the currently active vault', inputSchema: { type: 'object', properties: {}, required: [] } }, - src/server.ts:1289-1291 (registration)Registration of the tool handler in the main MCP server's CallToolRequestSchema switch statement, dispatching calls to 'get_current_vault' to the VaultHandlers.handleGetCurrentVault method.
case 'get_current_vault': return await this.vaultHandlers.handleGetCurrentVault(); case 'update_vault': - src/utils/global-config.ts:357-363 (helper)Core helper method in GlobalConfigManager that retrieves the current vault information from the configuration, used by the tool handler.
getCurrentVault(): VaultInfo | null { if (!this.#config || !this.#config.current_vault) { return null; } return this.#config.vaults[this.#config.current_vault] || null; }