Skip to main content
Glama
IncomeStreamSurfer

Roo Code Memory Bank MCP Server

read_memory_bank_file

Extracts and retrieves the complete content of a specified memory bank file to maintain persistent project context for AI assistants, ensuring information continuity across sessions.

Instructions

Reads the full content of a specified memory bank file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_nameYesThe name of the memory bank file (e.g., 'productContext.md')

Implementation Reference

  • The handler function in RooMemoryBankServer class that reads the content of the specified memory bank file and returns it as JSON.
    async readMemoryBankFile(input: any): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      const fileName = input?.file_name;
      if (!fileName || typeof fileName !== 'string') {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", message: "Missing or invalid 'file_name' parameter." }, null, 2) }], isError: true };
      }
      const filePath = path.join(MEMORY_BANK_PATH, fileName);
      try {
        const fileContent = await fs.readFile(filePath, 'utf-8');
        return { content: [{ type: "text", text: JSON.stringify({ content: fileContent }, null, 2) }] };
      } catch (error: any) {
        console.error(chalk.red(`Error reading file ${fileName}:`), error);
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", message: `Failed to read file ${fileName}: ${error.message}` }, null, 2) }], isError: true };
      }
    }
  • Tool schema definition including name, description, and input schema with required 'file_name' parameter.
    const READ_MEMORY_BANK_FILE_TOOL: Tool = {
      name: "read_memory_bank_file",
      description: "Reads the full content of a specified memory bank file.",
      inputSchema: {
        type: "object",
        properties: {
          file_name: {
            type: "string",
            description: "The name of the memory bank file (e.g., 'productContext.md')"
          }
        },
        required: ["file_name"]
      }
      // Output: { content: string } (handled in implementation)
    };
  • src/index.ts:110-115 (registration)
    Registers the tool by including it in the ALL_TOOLS array, used for listing available tools via ListToolsRequestHandler.
    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:270-271 (registration)
    Registers the tool call handler by dispatching to the readMemoryBankFile method in the CallToolRequestSchema switch statement.
    case "read_memory_bank_file":
      return memoryBankServer.readMemoryBankFile(args);
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