codex_memory/mcp_server/
tools.rs1use serde_json::{json, Value};
3
4pub struct MCPTools;
6
7impl MCPTools {
8 pub fn get_tools_list() -> Value {
10 let tools = vec![
11 json!({
12 "name": "store_memory",
13 "description": "Store text content directly in the database with required context and summary for better organization and retrieval.",
14 "inputSchema": {
15 "type": "object",
16 "properties": {
17 "content": {
18 "type": "string",
19 "description": "The exact text content to store (will be stored as-is without modification)"
20 },
21 "context": {
22 "type": "string",
23 "description": "Required: Contextual information about what is being stored (e.g., 'User's code review feedback', 'Error log from debugging session')"
24 },
25 "summary": {
26 "type": "string",
27 "description": "Required: A brief summary of the content (120 words or less) to aid in search and retrieval"
28 },
29 "tags": {
30 "type": "array",
31 "items": {"type": "string"},
32 "description": "Required: Tags for categorization and search (e.g., ['debugging', 'python', 'error'])"
33 }
34 },
35 "required": ["content", "context", "summary", "tags"]
36 }
37 }),
38 json!({
39 "name": "get_memory",
40 "description": "Retrieve stored content by ID",
41 "inputSchema": {
42 "type": "object",
43 "properties": {
44 "id": {
45 "type": "string",
46 "description": "UUID of the memory to retrieve"
47 }
48 },
49 "required": ["id"]
50 }
51 }),
52 json!({
53 "name": "delete_memory",
54 "description": "Delete stored content by ID",
55 "inputSchema": {
56 "type": "object",
57 "properties": {
58 "id": {
59 "type": "string",
60 "description": "UUID of the memory to delete"
61 }
62 },
63 "required": ["id"]
64 }
65 }),
66 json!({
67 "name": "get_statistics",
68 "description": "Get storage statistics",
69 "inputSchema": {
70 "type": "object",
71 "properties": {},
72 "required": []
73 }
74 }),
75 json!({
76 "name": "store_file",
77 "description": "Read a file from disk, chunk it using semantic boundaries to preserve meaning, and store it with context and summary",
78 "inputSchema": {
79 "type": "object",
80 "properties": {
81 "file_path": {
82 "type": "string",
83 "description": "Absolute path to the file to store"
84 },
85 "chunk_size": {
86 "type": "integer",
87 "description": "Maximum size of each chunk in characters (default: 8000)",
88 "default": 8000
89 },
90 "overlap": {
91 "type": "integer",
92 "description": "Number of characters to overlap between chunks (default: 200)",
93 "default": 200
94 },
95 "chunking_strategy": {
96 "type": "string",
97 "description": "Chunking strategy: 'sentence' (by sentences), 'paragraph' (by paragraphs), 'semantic' (NLP boundaries), 'hybrid' (size+semantic, default)",
98 "enum": ["sentence", "paragraph", "semantic", "hybrid"],
99 "default": "hybrid"
100 },
101 "tags": {
102 "type": "array",
103 "items": {"type": "string"},
104 "description": "Optional tags to apply to all chunks"
105 }
106 },
107 "required": ["file_path"]
108 }
109 }),
110 ];
111
112 json!(tools)
113 }
114}