1use 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 json!({
111 "name": "search_memory",
112 "description": "Search stored memories using semantic similarity on tags and content with configurable ranking",
113 "inputSchema": {
114 "type": "object",
115 "properties": {
116 "query": {
117 "type": "string",
118 "description": "Search query text to find similar memories"
119 },
120 "tag_filter": {
121 "type": "array",
122 "items": {"type": "string"},
123 "description": "Optional array of tags to pre-filter results"
124 },
125 "use_tag_embedding": {
126 "type": "boolean",
127 "description": "Use tag-based embedding similarity (default: true)",
128 "default": true
129 },
130 "use_content_embedding": {
131 "type": "boolean",
132 "description": "Use content-based embedding similarity (default: true)",
133 "default": true
134 },
135 "similarity_threshold": {
136 "type": "number",
137 "description": "Minimum similarity score (0.0-1.0, default: 0.7)",
138 "minimum": 0.0,
139 "maximum": 1.0,
140 "default": 0.7
141 },
142 "max_results": {
143 "type": "integer",
144 "description": "Maximum number of results to return (default: 10)",
145 "minimum": 1,
146 "maximum": 100,
147 "default": 10
148 },
149 "search_strategy": {
150 "type": "string",
151 "description": "Search strategy to use",
152 "enum": ["tags_first", "content_first", "hybrid"],
153 "default": "hybrid"
154 },
155 "boost_recent": {
156 "type": "boolean",
157 "description": "Apply recency boost to newer memories (default: false)",
158 "default": false
159 },
160 "tag_weight": {
161 "type": "number",
162 "description": "Weight for tag similarity in combined score (default: 0.4)",
163 "minimum": 0.0,
164 "maximum": 1.0,
165 "default": 0.4
166 },
167 "content_weight": {
168 "type": "number",
169 "description": "Weight for content similarity in combined score (default: 0.6)",
170 "minimum": 0.0,
171 "maximum": 1.0,
172 "default": 0.6
173 }
174 },
175 "required": ["query"]
176 }
177 }),
178 ];
179
180 json!(tools)
181 }
182}