Skip to main content
Glama
IncomeStreamSurfer

Roo Code Memory Bank MCP Server

initialize_memory_bank

Set up a memory bank directory and initialize standard markdown templates to store project context for AI assistants, ensuring persistent information across sessions.

Instructions

Creates the memory-bank directory and standard .md files with initial templates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_brief_contentNo(Optional) Content from projectBrief.md to pre-fill productContext.md

Implementation Reference

  • The main execution logic for the 'initialize_memory_bank' tool. Creates the memory-bank directory if it doesn't exist and populates it with initial markdown template files, optionally customizing productContext.md with provided project brief content. Returns JSON status messages.
    async initializeMemoryBank(input: any): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      try {
        await ensureMemoryBankDir();
        let initializationMessages: string[] = [];
    
        for (const [fileName, template] of Object.entries(INITIAL_FILES)) {
          const filePath = path.join(MEMORY_BANK_PATH, fileName);
          try {
            await fs.access(filePath);
            initializationMessages.push(`File ${fileName} already exists.`);
          } catch {
            // File doesn't exist, create it
            let content = template;
            // Add timestamp to initial content
            content = content.replace('YYYY-MM-DD HH:MM:SS', getCurrentTimestamp());
    
            // Special handling for project brief in productContext.md
            if (fileName === "productContext.md" && input?.project_brief_content) {
               content = content.replace('...', `based on project brief:\n\n${input.project_brief_content}\n\n...`);
            }
    
            await fs.writeFile(filePath, content);
            initializationMessages.push(`Created file: ${fileName}`);
          }
        }
        return { content: [{ type: "text", text: JSON.stringify({ status: "success", messages: initializationMessages }, null, 2) }] };
      } catch (error: any) {
        console.error(chalk.red("Error initializing memory bank:"), error);
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", message: error.message }, null, 2) }], isError: true };
      }
    }
  • Tool schema definition including input schema for optional project_brief_content.
    const INITIALIZE_MEMORY_BANK_TOOL: Tool = {
      name: "initialize_memory_bank",
      description: "Creates the memory-bank directory and standard .md files with initial templates.",
      inputSchema: {
        type: "object",
        properties: {
          project_brief_content: {
            type: "string",
            description: "(Optional) Content from projectBrief.md to pre-fill productContext.md"
          }
        },
        required: []
      }
      // Output: Confirmation message (handled in implementation)
  • src/index.ts:110-115 (registration)
    Registration of the tool in the ALL_TOOLS array used in listTools response.
    const ALL_TOOLS = [
      INITIALIZE_MEMORY_BANK_TOOL,
      CHECK_MEMORY_BANK_STATUS_TOOL,
      READ_MEMORY_BANK_FILE_TOOL,
      APPEND_MEMORY_BANK_ENTRY_TOOL
    ];
  • src/index.ts:266-267 (registration)
    Tool dispatch registration in the CallToolRequestHandler switch statement.
    case "initialize_memory_bank":
      return memoryBankServer.initializeMemoryBank(args);
  • Helper function used by the handler to ensure the memory-bank directory exists.
    async function ensureMemoryBankDir(): Promise<void> {
      try {
        await fs.access(MEMORY_BANK_PATH);
      } catch (error) {
        // Directory doesn't exist, create it
        await fs.mkdir(MEMORY_BANK_PATH, { recursive: true });
        console.error(chalk.green(`Created memory bank directory: ${MEMORY_BANK_PATH}`));
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool creates directories and files, it doesn't cover critical aspects such as whether this is idempotent (e.g., what happens if the memory bank already exists), permission requirements, error conditions, or side effects. This is a significant gap for a tool that performs file system operations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's action without unnecessary words. It's front-loaded with the core purpose and avoids redundancy, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (file system creation with templates), lack of annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but misses behavioral details like idempotency or error handling. With no structured fields to rely on, the agent would need more information for robust usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with one optional parameter clearly documented. The description doesn't add any parameter-specific information beyond the schema, but since schema coverage is high and there's only one parameter, the baseline is 3. The description's mention of 'initial templates' provides slight additional context about the tool's behavior, justifying a score of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Creates the memory-bank directory and standard .md files with initial templates.' This specifies the verb ('Creates') and resources ('memory-bank directory and standard .md files'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'check_memory_bank_status' or 'read_memory_bank_file', which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the memory bank must not already exist), exclusions, or comparisons to siblings like 'append_memory_bank_entry'. This leaves the agent with minimal context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/IncomeStreamSurfer/roo-code-memory-bank-mcp-server'

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