write_memory_bank_file
Store and manage data efficiently by writing content to a specified file in the memory bank using SSH-supported central knowledge base for seamless access.
Instructions
Write to a Memory Bank file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Content to write to the file | |
| filename | Yes | Name of the file to write |
Implementation Reference
- src/server/tools/CoreTools.ts:323-350 (handler)The core handler function that implements the logic for the 'write_memory_bank_file' tool by writing the provided content to the specified filename in the Memory Bank.export async function handleWriteMemoryBankFile( memoryBankManager: MemoryBankManager, filename: string, content: string ) { try { await memoryBankManager.writeFile(filename, content); return { content: [ { type: 'text', text: `File ${filename} successfully written to Memory Bank`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error writing file ${filename}: ${error}`, }, ], isError: true, }; } }
- src/server/tools/CoreTools.ts:68-85 (schema)The input schema definition for the 'write_memory_bank_file' tool, specifying required filename and content parameters.{ name: 'write_memory_bank_file', description: 'Write to a Memory Bank file', inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Name of the file to write', }, content: { type: 'string', description: 'Content to write to the file', }, }, required: ['filename', 'content'], }, },
- src/server/tools/index.ts:104-128 (registration)Registration and dispatching logic in the main tool call handler (setupToolHandlers) that validates inputs and calls the handleWriteMemoryBankFile function for 'write_memory_bank_file' tool invocations.case 'write_memory_bank_file': { if (!memoryBankManager.getMemoryBankDir()) { return { content: [ { type: 'text', text: 'Memory Bank not found. Use initialize_memory_bank to create one.', }, ], isError: true, }; } const { filename, content } = request.params.arguments as { filename: string; content: string; }; if (!filename) { throw new McpError(ErrorCode.InvalidParams, 'Filename not specified'); } if (content === undefined) { throw new McpError(ErrorCode.InvalidParams, 'Content not specified'); } return handleWriteMemoryBankFile(memoryBankManager, filename, content); }