@pimzino/agentic-tools-mcp
Version:
A comprehensive MCP server for task management and agent memories with JSON file storage
79 lines (78 loc) • 2.27 kB
TypeScript
import { MemoryStorage } from './storage.js';
import { Memory, SearchMemoryInput, MemorySearchResult } from '../models/memory.js';
/**
* File-based storage implementation for agent memories
* Stores each memory as an individual JSON file organized by category
*/
export declare class FileStorage implements MemoryStorage {
private workingDirectory;
private storageDir;
private memoriesDir;
constructor(workingDirectory: string);
/**
* Initialize the file storage system
*/
initialize(): Promise<void>;
/**
* Sanitize a string for safe filesystem usage
*/
private sanitizeFileName;
/**
* Validate title length (max 50 characters for file naming)
*/
private validateTitle;
/**
* Get file path for a memory
*/
private getMemoryFilePath;
/**
* Get file path by ID (scan all categories)
*/
private findMemoryFileById;
/**
* Ensure category directory exists
*/
private ensureCategoryDirectory;
/**
* Handle file name conflicts by adding numeric suffix
*/
private resolveFileNameConflict;
/**
* Create a new memory
*/
createMemory(memory: Memory): Promise<Memory>;
/**
* Get a specific memory by ID
*/
getMemory(id: string): Promise<Memory | null>;
/**
* Get all memories with optional filtering
*/
getMemories(agentId?: string, category?: string, limit?: number): Promise<Memory[]>;
/**
* Update an existing memory
*/
updateMemory(id: string, updates: Partial<Memory>): Promise<Memory | null>;
/**
* Delete a memory
*/
deleteMemory(id: string): Promise<boolean>;
/**
* Search memories by text content
*/
searchMemories(input: SearchMemoryInput): Promise<MemorySearchResult[]>;
/**
* Delete all memories for a specific agent (not applicable for simplified schema)
*/
deleteMemoriesByAgent(agentId: string): Promise<number>;
/**
* Get memory statistics
*/
getStatistics(): Promise<{
totalMemories: number;
memoriesByAgent: Record<string, number>;
memoriesByCategory: Record<string, number>;
oldestMemory?: string;
newestMemory?: string;
}>;
}