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
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | Yes | The name of the memory bank file (e.g., 'productContext.md') |
Input Schema (JSON Schema)
{
"properties": {
"file_name": {
"description": "The name of the memory bank file (e.g., 'productContext.md')",
"type": "string"
}
},
"required": [
"file_name"
],
"type": "object"
}
Implementation Reference
- src/index.ts:165-178 (handler)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 }; } }
- src/index.ts:70-84 (schema)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);