1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! 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)
}
}