codex-memory 3.0.15

A simple memory storage service with MCP interface for Claude Desktop
Documentation
//! MCP Tools for text storage with optional advanced features
use serde_json::{json, Value};

/// MCP Tools registry with optional advanced features
pub struct MCPTools;

impl MCPTools {
    /// Get the list of available tools (basic + optional advanced)
    pub fn get_tools_list() -> Value {
        let tools = vec![
            json!({
                "name": "store_memory",
                "description": "Store text content directly in the database with required context and summary for better organization and retrieval.",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "content": {
                            "type": "string",
                            "description": "The exact text content to store (will be stored as-is without modification)"
                        },
                        "context": {
                            "type": "string",
                            "description": "Required: Contextual information about what is being stored (e.g., 'User's code review feedback', 'Error log from debugging session')"
                        },
                        "summary": {
                            "type": "string",
                            "description": "Required: A brief summary of the content (120 words or less) to aid in search and retrieval"
                        },
                        "tags": {
                            "type": "array",
                            "items": {"type": "string"},
                            "description": "Required: Tags for categorization and search (e.g., ['debugging', 'python', 'error'])"
                        }
                    },
                    "required": ["content", "context", "summary", "tags"]
                }
            }),
            json!({
                "name": "get_memory",
                "description": "Retrieve stored content by ID",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string",
                            "description": "UUID of the memory to retrieve"
                        }
                    },
                    "required": ["id"]
                }
            }),
            json!({
                "name": "delete_memory",
                "description": "Delete stored content by ID",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string",
                            "description": "UUID of the memory to delete"
                        }
                    },
                    "required": ["id"]
                }
            }),
            json!({
                "name": "get_statistics",
                "description": "Get storage statistics",
                "inputSchema": {
                    "type": "object",
                    "properties": {},
                    "required": []
                }
            }),
            json!({
                "name": "store_file",
                "description": "Read a file from disk, chunk it using semantic boundaries to preserve meaning, and store it with context and summary",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "file_path": {
                            "type": "string",
                            "description": "Absolute path to the file to store"
                        },
                        "chunk_size": {
                            "type": "integer",
                            "description": "Maximum size of each chunk in characters (default: 8000)",
                            "default": 8000
                        },
                        "overlap": {
                            "type": "integer",
                            "description": "Number of characters to overlap between chunks (default: 200)",
                            "default": 200
                        },
                        "chunking_strategy": {
                            "type": "string",
                            "description": "Chunking strategy: 'sentence' (by sentences), 'paragraph' (by paragraphs), 'semantic' (NLP boundaries), 'hybrid' (size+semantic, default)",
                            "enum": ["sentence", "paragraph", "semantic", "hybrid"],
                            "default": "hybrid"
                        },
                        "tags": {
                            "type": "array",
                            "items": {"type": "string"},
                            "description": "Optional tags to apply to all chunks"
                        }
                    },
                    "required": ["file_path"]
                }
            }),
            json!({
                "name": "search_memory",
                "description": "Search stored memories using semantic similarity on tags and content with configurable ranking",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "Search query text to find similar memories"
                        },
                        "tag_filter": {
                            "type": "array",
                            "items": {"type": "string"},
                            "description": "Optional array of tags to pre-filter results"
                        },
                        "use_tag_embedding": {
                            "type": "boolean",
                            "description": "Use tag-based embedding similarity (default: true)",
                            "default": true
                        },
                        "use_content_embedding": {
                            "type": "boolean",
                            "description": "Use content-based embedding similarity (default: true)",
                            "default": true
                        },
                        "similarity_threshold": {
                            "type": "number",
                            "description": "Minimum similarity score (0.0-1.0, default: 0.7)",
                            "minimum": 0.0,
                            "maximum": 1.0,
                            "default": 0.7
                        },
                        "max_results": {
                            "type": "integer",
                            "description": "Maximum number of results to return (default: 10)",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 10
                        },
                        "search_strategy": {
                            "type": "string",
                            "description": "Search strategy to use",
                            "enum": ["tags_first", "content_first", "hybrid"],
                            "default": "hybrid"
                        },
                        "boost_recent": {
                            "type": "boolean",
                            "description": "Apply recency boost to newer memories (default: false)",
                            "default": false
                        },
                        "tag_weight": {
                            "type": "number",
                            "description": "Weight for tag similarity in combined score (default: 0.4)",
                            "minimum": 0.0,
                            "maximum": 1.0,
                            "default": 0.4
                        },
                        "content_weight": {
                            "type": "number",
                            "description": "Weight for content similarity in combined score (default: 0.6)",
                            "minimum": 0.0,
                            "maximum": 1.0,
                            "default": 0.6
                        }
                    },
                    "required": ["query"]
                }
            }),
        ];

        json!(tools)
    }
}