post-cortex-mcp 0.3.0

Model Context Protocol (MCP) tool definitions for post-cortex. Pure library — embed in rmcp, custom MCP servers, or anywhere else; no rmcp / axum / tonic transport dependencies.
Documentation
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
//! JSON Schema descriptors for every MCP tool.

/// Return the full set of MCP tool JSON Schema descriptors.
pub fn get_all_tool_schemas() -> Vec<serde_json::Value> {
    use serde_json::json;

    vec![
        json!({
            "name": "create_session",
            "description": "Create a new conversation session with optional name and description",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string", "description": "Optional name for the session"},
                    "description": {"type": "string", "description": "Optional description for the session"}
                }
            }
        }),
        json!({
            "name": "load_session",
            "description": "Load an existing session into active memory",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session to load"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "list_sessions",
            "description": "List all available conversation sessions",
            "inputSchema": {
                "type": "object"
            }
        }),
        json!({
            "name": "search_sessions",
            "description": "Search for sessions by name or description",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {"type": "string", "description": "Search query string"}
                },
                "required": ["query"]
            }
        }),
        json!({
            "name": "update_session_metadata",
            "description": "Update session name or description",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "name": {"type": "string", "description": "New name (optional)"},
                    "description": {"type": "string", "description": "New description (optional)"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "update_conversation_context",
            "description": "Add new knowledge to the conversation along with the entity graph for that knowledge. Every call MUST supply at least one entity in `entities` and one relation in `relations`; both endpoints of every relation must appear in the `entities` array (self-relations are rejected). Content fields vary by interaction_type: qa={question,answer}, decision_made={decision,rationale}, problem_solved={problem,solution}, code_change={file_path|description,changes|diff}, requirement_added={requirement,priority}, concept_defined={concept,definition}. Extra fields become details.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "interaction_type": {"type": "string", "description": "Type: qa, decision_made, problem_solved, code_change, requirement_added, concept_defined"},
                    "content": {
                        "type": "object",
                        "description": "Content object. Expected fields by type: qa={question,answer}, decision_made={decision,rationale}, problem_solved={problem,solution}, code_change={file_path,changes}, requirement_added={requirement,priority}, concept_defined={concept,definition}. Accepts variations: question/title/query, answer/response, problem/issue/bug, solution/fix, decision/choice, rationale/reason/why, file_path/file/description, changes/diff/changes_made. Extra fields become details array."
                    },
                    "entities": {
                        "type": "array",
                        "description": "Named entities mentioned in this update. Required: must contain at least one entry so the entity graph is never empty. Each entry: {name, entity_type}. entity_type is one of: technology, concept, problem, solution, decision, code_component.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {"type": "string"},
                                "entity_type": {"type": "string", "enum": ["technology", "concept", "problem", "solution", "decision", "code_component"]}
                            },
                            "required": ["name", "entity_type"]
                        },
                        "minItems": 1
                    },
                    "relations": {
                        "type": "array",
                        "description": "Relations between the entities above. Required: must contain at least one entry. Each entry: {from_entity, to_entity, relation_type, context}. Both endpoints must appear in the entities array; self-relations are rejected. relation_type is one of: required_by, leads_to, related_to, conflicts_with, depends_on, implements, caused_by, solves.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "from_entity": {"type": "string"},
                                "to_entity": {"type": "string"},
                                "relation_type": {"type": "string", "enum": ["required_by", "leads_to", "related_to", "conflicts_with", "depends_on", "implements", "caused_by", "solves"]},
                                "context": {"type": "string", "description": "Short explanation of why this relation exists"}
                            },
                            "required": ["from_entity", "to_entity", "relation_type", "context"]
                        },
                        "minItems": 1
                    },
                    "code_reference": {"type": "object", "description": "Optional code reference with file paths and line numbers"}
                },
                "required": ["session_id", "interaction_type", "content", "entities", "relations"]
            }
        }),
        json!({
            "name": "query_conversation_context",
            "description": "Search conversation context using entities, keywords, or structured queries",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "query_type": {"type": "string", "description": "Query type: find_related_entities, get_entity_context, search_updates, get_most_important_entities"},
                    "parameters": {"type": "object", "description": "Query-specific parameters"}
                },
                "required": ["session_id", "query_type", "parameters"]
            }
        }),
        json!({
            "name": "bulk_update_conversation_context",
            "description": "Add multiple context updates in a single operation. Each item must follow the same shape as update_conversation_context — interaction_type + content + entities + relations are all required per item. Items that fail translation or validation are reported individually in the response payload.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "updates": {
                        "type": "array",
                        "description": "Array of context update objects. Each entry mirrors update_conversation_context fields (without session_id).",
                        "items": {
                            "type": "object",
                            "properties": {
                                "interaction_type": {"type": "string"},
                                "content": {"type": "object"},
                                "entities": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "name": {"type": "string"},
                                            "entity_type": {"type": "string", "enum": ["technology", "concept", "problem", "solution", "decision", "code_component"]}
                                        },
                                        "required": ["name", "entity_type"]
                                    },
                                    "minItems": 1
                                },
                                "relations": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "from_entity": {"type": "string"},
                                            "to_entity": {"type": "string"},
                                            "relation_type": {"type": "string", "enum": ["required_by", "leads_to", "related_to", "conflicts_with", "depends_on", "implements", "caused_by", "solves"]},
                                            "context": {"type": "string"}
                                        },
                                        "required": ["from_entity", "to_entity", "relation_type", "context"]
                                    },
                                    "minItems": 1
                                },
                                "code_reference": {"type": "object"}
                            },
                            "required": ["interaction_type", "content", "entities", "relations"]
                        }
                    }
                },
                "required": ["session_id", "updates"]
            }
        }),
        json!({
            "name": "semantic_search_session",
            "description": "Search within a session using AI semantic understanding (auto-vectorizes on first use)",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "query": {"type": "string", "description": "Natural language search query"},
                    "limit": {"type": "number", "description": "Max results (default: 10)"},
                    "date_from": {"type": "string", "description": "Filter from date (ISO 8601)"},
                    "date_to": {"type": "string", "description": "Filter to date (ISO 8601)"},
                    "interaction_type": {"type": "array", "description": "Filter by interaction types"},
                    "recency_bias": {
                        "type": "number",
                        "description": "Temporal decay factor: 0.0=disabled (default), 0.1-0.5=soft bias, 1.0+=aggressive bias toward recent content",
                        "default": 0.0,
                        "minimum": 0.0,
                        "maximum": 10.0
                    }
                },
                "required": ["session_id", "query"]
            }
        }),
        json!({
            "name": "semantic_search_global",
            "description": "Search across all sessions using AI semantic understanding",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {"type": "string", "description": "Natural language search query"},
                    "limit": {"type": "number", "description": "Max results (default: 10)"},
                    "date_from": {"type": "string", "description": "Filter from date (ISO 8601)"},
                    "date_to": {"type": "string", "description": "Filter to date (ISO 8601)"},
                    "interaction_type": {"type": "array", "description": "Filter by interaction types"},
                    "recency_bias": {
                        "type": "number",
                        "description": "Temporal decay factor: 0.0=disabled (default), 0.1-0.5=soft bias, 1.0+=aggressive bias toward recent content",
                        "default": 0.0,
                        "minimum": 0.0,
                        "maximum": 10.0
                    }
                },
                "required": ["query"]
            }
        }),
        json!({
            "name": "find_related_content",
            "description": "Find content related to a specific topic within a session",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "topic": {"type": "string", "description": "Topic to find related content for"},
                    "limit": {"type": "number", "description": "Max results (default: 10)"}
                },
                "required": ["session_id", "topic"]
            }
        }),
        json!({
            "name": "vectorize_session",
            "description": "Manually trigger vectorization for a session (usually happens automatically)",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session to vectorize"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_vectorization_stats",
            "description": "Get statistics about vectorization status and HNSW index",
            "inputSchema": {
                "type": "object"
            }
        }),
        json!({
            "name": "get_structured_summary",
            "description": "Get comprehensive session overview with decisions, entities, questions, and concepts",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "compact": {"type": "boolean", "description": "Use compact format for large sessions"},
                    "decisions_limit": {"type": "number", "description": "Max decisions to return"},
                    "entities_limit": {"type": "number", "description": "Max entities to return"},
                    "questions_limit": {"type": "number", "description": "Max questions to return"},
                    "concepts_limit": {"type": "number", "description": "Max concepts to return"},
                    "min_confidence": {"type": "number", "description": "Minimum confidence threshold (0.0-1.0)"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_key_decisions",
            "description": "Get timeline of key architectural and technical decisions from a session",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_key_insights",
            "description": "Get most important insights from a session ranked by importance",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "limit": {"type": "number", "description": "Max insights to return (default: 10)"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_entity_importance_analysis",
            "description": "Analyze which entities (people, concepts, files) are most important in the conversation",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "limit": {"type": "number", "description": "Max entities to return"},
                    "min_importance": {"type": "number", "description": "Minimum importance score (0.0-1.0)"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_entity_network_view",
            "description": "View the network of relationships between entities in the knowledge graph",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "center_entity": {"type": "string", "description": "Optional entity to center the network on"},
                    "max_entities": {"type": "number", "description": "Max entities to include"},
                    "max_relationships": {"type": "number", "description": "Max relationships to include"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_session_statistics",
            "description": "Get detailed statistics about session size, update counts, and entity counts",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "create_session_checkpoint",
            "description": "Create a snapshot of current session state for backup or versioning",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "session_id": {"type": "string", "description": "UUID of the session"}
                },
                "required": ["session_id"]
            }
        }),
        json!({
            "name": "get_tool_catalog",
            "description": "Get comprehensive catalog of all available tools with usage guidance",
            "inputSchema": {
                "type": "object"
            }
        }),
        json!({
            "name": "create_workspace",
            "description": "Create a workspace for organizing related sessions by project or topic",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string", "description": "Workspace name"},
                    "description": {"type": "string", "description": "Workspace description"}
                },
                "required": ["name", "description"]
            }
        }),
        json!({
            "name": "get_workspace",
            "description": "Get details about a specific workspace including all sessions",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "workspace_id": {"type": "string", "description": "UUID of the workspace"}
                },
                "required": ["workspace_id"]
            }
        }),
        json!({
            "name": "list_workspaces",
            "description": "List all available workspaces",
            "inputSchema": {
                "type": "object"
            }
        }),
        json!({
            "name": "delete_workspace",
            "description": "Delete a workspace (does not delete the sessions within it)",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "workspace_id": {"type": "string", "description": "UUID of the workspace"}
                },
                "required": ["workspace_id"]
            }
        }),
        json!({
            "name": "add_session_to_workspace",
            "description": "Add a session to a workspace with a specific role",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "workspace_id": {"type": "string", "description": "UUID of the workspace"},
                    "session_id": {"type": "string", "description": "UUID of the session"},
                    "role": {"type": "string", "description": "Role of this session in the workspace"}
                },
                "required": ["workspace_id", "session_id", "role"]
            }
        }),
        json!({
            "name": "remove_session_from_workspace",
            "description": "Remove a session from a workspace",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "workspace_id": {"type": "string", "description": "UUID of the workspace"},
                    "session_id": {"type": "string", "description": "UUID of the session"}
                },
                "required": ["workspace_id", "session_id"]
            }
        }),
    ]
}