Skip to main content
Glama
disnet
by disnet

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
NameRequiredDescriptionDefault
idYesID of the vault to switch to

Implementation Reference

  • 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
        };
      }
    };
  • 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
  • TypeScript interface defining the input arguments for the switch_vault tool.
    export interface SwitchVaultArgs {
      id: string;
    }
  • 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']
      }
    },
  • Runtime validation rules for switch_vault tool arguments.
    switch_vault: [
      {
        field: 'id',
        required: true,
        type: 'string',
        allowEmpty: false
      }
    ],

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/disnet/flint-note'

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