Skip to main content
Glama

set_memory_bank_path

Define or update the custom path for the Memory Bank in mcp-with-ssh, ensuring centralized knowledge storage and access via SSH. Use the command to specify a directory or default to the current one.

Instructions

Set a custom path for the Memory Bank

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoCustom path for the Memory Bank. If not provided, the current directory will be used.

Implementation Reference

  • The handler function that executes the set_memory_bank_path tool logic by setting a custom path for the Memory Bank using the MemoryBankManager.
    export async function handleSetMemoryBankPath(
      memoryBankManager: MemoryBankManager,
      customPath?: string
    ) {
      // Use the provided path, project path, or the current directory
      const basePath = customPath || memoryBankManager.getProjectPath();
      
      // Ensure the path is absolute
      const absolutePath = path.isAbsolute(basePath) ? basePath : path.resolve(process.cwd(), basePath);
      console.error('Using absolute path for Memory Bank:', absolutePath);
      
      // Set the custom path and check for a memory-bank directory
      await memoryBankManager.setCustomPath(absolutePath);
      
      // Check if a memory-bank directory was found
      const memoryBankDir = memoryBankManager.getMemoryBankDir();
      if (memoryBankDir) {
        return {
          content: [
            {
              type: 'text',
              text: `Memory Bank path set to ${memoryBankDir}`,
            },
          ],
        };
      }
      
      // If we get here, no valid Memory Bank was found
      return {
        content: [
          {
            type: 'text',
            text: `Memory Bank not found in the provided directory. Use initialize_memory_bank to create one.`,
          },
        ],
      };
    }
  • The schema definition for the set_memory_bank_path tool, including name, description, and input schema, part of the coreTools array.
    {
      name: 'set_memory_bank_path',
      description: 'Set a custom path for the Memory Bank',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Custom path for the Memory Bank. If not provided, the current directory will be used.',
          },
        },
        required: [],
      },
    },
  • The switch case registration that routes calls to the set_memory_bank_path handler in the MCP server's tool request handler.
    case 'set_memory_bank_path': {
      const { path: customPath } = request.params.arguments as { path?: string };
      return handleSetMemoryBankPath(memoryBankManager, customPath);
    }
  • Registers the list of tools including coreTools (which contains set_memory_bank_path schema) for the MCP list tools request.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        ...coreTools,
        ...progressTools,
        ...contextTools,
        ...decisionTools,
        ...modeTools,
      ],

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/aakarsh-sasi/memory-bank-mcp'

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