switch_vault
Change to a different vault in Flint Note to manage markdown files with semantic note types for AI collaboration.
Instructions
Switch to a different vault
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the vault to switch to |
Implementation Reference
- src/server/vault-handlers.ts:164-201 (handler)The core handler function for the 'switch_vault' tool. Validates arguments, checks if vault exists, switches the current vault using GlobalConfigManager, reinitializes the server workspace, and returns a formatted success or error message.handleSwitchVault = async ( args: SwitchVaultArgs ): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> => { try { // Validate arguments validateToolArgs('switch_vault', args); const vault = this.globalConfig.getVault(args.id); if (!vault) { throw new Error(`Vault with ID '${args.id}' does not exist`); } // Switch to the vault await this.globalConfig.switchVault(args.id); // Reinitialize server with new vault await this.initializeServer(); return { content: [ { type: 'text', text: `🔄 Switched to vault: ${vault.name} (${args.id})\nPath: ${vault.path}` } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text', text: `Failed to switch vault: ${errorMessage}` } ], isError: true }; } };
- src/server.ts:1284-1287 (registration)MCP tool registration in the CallToolRequestSchema handler. Dispatches 'switch_vault' calls to the VaultHandlers.handleSwitchVault method.); case 'remove_vault': return await this.vaultHandlers.handleRemoveVault( args as unknown as RemoveVaultArgs
- src/server/types.ts:140-142 (schema)TypeScript interface defining the input arguments for the switch_vault tool.export interface SwitchVaultArgs { id: string; }
- src/server/tool-schemas.ts:602-614 (schema)JSON Schema definition for the switch_vault tool input, used for MCP tool listing and validation.name: 'switch_vault', description: 'Switch to a different vault', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the vault to switch to' } }, required: ['id'] } },
- src/server/validation.ts:684-691 (helper)Runtime validation rules for switch_vault tool arguments.switch_vault: [ { field: 'id', required: true, type: 'string', allowEmpty: false } ],