refactor: apply 5-pass audit optimizations across mcp-memory codebase
This commit is contained in:
1 parent
924b6d09fa
commit
5bd8b1587a
43 files changed
+1866
-1658
No files matched your search
+13
-28
@@ -25,10 +25,11 @@ pub struct CreateEntitiesTool {
|
||||
pub entities: Vec<crate::models::Entity>,
|
||||
}
|
||||
|
||||
/// Create new relations between entities in the knowledge graph. Note: relation_type MUST ALWAYS be snake_case (e.g. depends_on, calls, implements).
|
||||
/// Create new relations between entities in the knowledge graph.
|
||||
/// CRITICAL SCHEMA REQUIREMENT: Each relation item MUST strictly contain fields 'from' (source entity name string), 'to' (target entity name string), and 'relation_type' (snake_case string, e.g., 'depends_on', 'calls', 'implements'). Do NOT use 'source', 'target', or 'relationType'.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct CreateRelationsTool {
|
||||
/// Array of relations to create.
|
||||
/// Array of relations to create. Each relation item MUST use 'from', 'to', and 'relation_type'.
|
||||
pub relations: Vec<crate::models::Relation>,
|
||||
}
|
||||
|
||||
@@ -81,7 +82,8 @@ pub struct ReadGraphTool {
|
||||
pub max_tokens: Option<usize>,
|
||||
}
|
||||
|
||||
/// Search for entities in the knowledge graph by name or type.
|
||||
/// Search specifically for Knowledge Graph entities and nodes by name or type.
|
||||
/// Note: For searching across tasks, snippets, ADRs, error fixes, and graph entities simultaneously, use 'omni_search' instead.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct SearchNodesTool {
|
||||
/// The search query.
|
||||
@@ -134,9 +136,13 @@ pub struct VisualizeGraphTool {
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum StickyNoteAction {
|
||||
#[serde(alias = "ADD", alias = "Add", alias = "create", alias = "insert")]
|
||||
Add,
|
||||
#[serde(alias = "READ", alias = "Read", alias = "list", alias = "get")]
|
||||
Read,
|
||||
#[serde(alias = "DELETE", alias = "Delete", alias = "remove", alias = "rm")]
|
||||
Delete,
|
||||
#[serde(alias = "CLEAR", alias = "Clear", alias = "purge")]
|
||||
Clear,
|
||||
}
|
||||
|
||||
@@ -161,31 +167,6 @@ pub struct StickyNotesTool {
|
||||
pub session_only: Option<bool>,
|
||||
}
|
||||
|
||||
/// Add a sticky note for unstructured thoughts or reminders.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct AddStickyNoteTool {
|
||||
/// The content of the sticky note.
|
||||
pub content: String,
|
||||
/// Optional time-to-live in seconds. Automatically expires the note after specified duration.
|
||||
pub ttl_seconds: Option<u64>,
|
||||
/// Optional flag to auto-expire the note at the end of the current session.
|
||||
pub session_only: Option<bool>,
|
||||
}
|
||||
|
||||
/// Read all active sticky notes.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct ReadStickyNotesTool {}
|
||||
|
||||
/// Delete a specific sticky note by its 1-indexed position.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct DeleteStickyNoteTool {
|
||||
/// The 1-indexed position of the sticky note to delete.
|
||||
pub index: usize,
|
||||
}
|
||||
|
||||
/// Clear all sticky notes.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
pub struct ClearStickyNotesTool {}
|
||||
|
||||
/// Condense or summarize an entity's observations to reduce size.
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
|
||||
@@ -266,8 +247,11 @@ pub struct TagSnippetTool {
|
||||
#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SnippetSearchMode {
|
||||
#[serde(alias = "HYBRID", alias = "Hybrid")]
|
||||
Hybrid,
|
||||
#[serde(alias = "KEYWORD", alias = "Keyword")]
|
||||
Keyword,
|
||||
#[serde(alias = "SEMANTIC", alias = "Semantic")]
|
||||
Semantic,
|
||||
}
|
||||
|
||||
@@ -374,6 +358,7 @@ pub struct LogDecisionTool {
|
||||
/// The decision made.
|
||||
pub decision: String,
|
||||
/// The consequence of the decision.
|
||||
#[serde(alias = "consequences")]
|
||||
pub consequence: String,
|
||||
/// The ID of an older ADR this decision supersedes, if any.
|
||||
pub supersedes: Option<String>,
|
||||
|
||||
Reference in new issue
Block a user