pub struct MemoryMCPServer { /* private fields */ }Expand description
MCP server for memory integration
Implementations§
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_advanced_pattern_analysis(
&self,
input: AdvancedPatternAnalysisInput,
) -> Result<Value>
pub async fn execute_advanced_pattern_analysis( &self, input: AdvancedPatternAnalysisInput, ) -> Result<Value>
Sourcepub async fn execute_quality_metrics(
&self,
input: QualityMetricsInput,
) -> Result<Value>
pub async fn execute_quality_metrics( &self, input: QualityMetricsInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn list_tools(&self) -> Vec<Tool>
pub async fn list_tools(&self) -> Vec<Tool>
List all available tools
Returns tools based on progressive disclosure - commonly used tools are returned first, advanced tools are shown after usage patterns indicate need.
With lazy loading, this initially returns only core tools to significantly reduce input token usage. Extended tools are loaded on-demand.
Sourcepub async fn get_tool(&self, name: &str) -> Option<Tool>
pub async fn get_tool(&self, name: &str) -> Option<Tool>
Get a specific tool by name
Loads the tool on-demand from the registry if not already loaded.
Sourcepub async fn query_memory(
&self,
query: String,
domain: String,
task_type: Option<String>,
limit: usize,
sort: String,
fields: Option<Vec<String>>,
) -> Result<Value>
pub async fn query_memory( &self, query: String, domain: String, task_type: Option<String>, limit: usize, sort: String, fields: Option<Vec<String>>, ) -> Result<Value>
Execute the query_memory tool
§Arguments
query- Search querydomain- Task domaintask_type- Optional task type filterlimit- Maximum results to returnsort- Sort order (relevance, newest, oldest, duration, success)
§Returns
Returns a JSON array of relevant episodes
§Field Selection
Clients can request specific fields using the fields parameter:
{
"query": "test",
"domain": "web-api",
"fields": ["episodes.id", "episodes.task_description", "patterns.success_rate"]
}Sourcepub async fn analyze_patterns(
&self,
task_type: String,
min_success_rate: f32,
limit: usize,
fields: Option<Vec<String>>,
) -> Result<Value>
pub async fn analyze_patterns( &self, task_type: String, min_success_rate: f32, limit: usize, fields: Option<Vec<String>>, ) -> Result<Value>
Execute the analyze_patterns tool
§Arguments
task_type- Type of task to analyzemin_success_rate- Minimum success rate filterlimit- Maximum patterns to return
§Returns
Returns a JSON array of patterns with statistics
§Field Selection
Clients can request specific fields:
{
"task_type": "code_generation",
"fields": ["patterns.tool_sequence", "statistics.most_common_tools"]
}Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_configure_embeddings(
&self,
input: ConfigureEmbeddingsInput,
) -> Result<Value>
pub async fn execute_configure_embeddings( &self, input: ConfigureEmbeddingsInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_generate_embedding(
&self,
input: GenerateEmbeddingInput,
) -> Result<Value>
pub async fn execute_generate_embedding( &self, input: GenerateEmbeddingInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_query_semantic_memory(
&self,
input: QuerySemanticMemoryInput,
) -> Result<Value>
pub async fn execute_query_semantic_memory( &self, input: QuerySemanticMemoryInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_search_by_embedding(
&self,
input: SearchByEmbeddingInput,
) -> Result<Value>
pub async fn execute_search_by_embedding( &self, input: SearchByEmbeddingInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_embedding_provider_status_tool(
&self,
input: EmbeddingProviderStatusInput,
) -> Result<Value>
pub async fn execute_embedding_provider_status_tool( &self, input: EmbeddingProviderStatusInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_test_embeddings(&self) -> Result<Value>
pub async fn execute_test_embeddings(&self) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn complete_episode_tool(&self, args: Value) -> Result<Value>
pub async fn complete_episode_tool(&self, args: Value) -> Result<Value>
Complete an episode with an outcome
This tool finalizes an episode by recording the outcome and triggering the learning cycle (reward calculation, reflection, pattern extraction).
§Arguments (from JSON)
episode_id- UUID of the episode to completeoutcome_type- Type of outcome (“success”, “partial_success”, “failure”)verdict- Description of the outcome (required for success/partial)artifacts- Array of artifact names (optional, for success)completed- Array of completed items (required for partial_success)failed- Array of failed items (required for partial_success)reason- Failure reason (required for failure)error_details- Detailed error information (optional, for failure)
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn create_episode_tool(&self, args: Value) -> Result<Value>
pub async fn create_episode_tool(&self, args: Value) -> Result<Value>
Create a new episode
This tool allows AI agents to programmatically create new episodes for tracking task execution through the MCP interface.
§Arguments (from JSON)
task_description- Clear description of the taskdomain- Task domain (e.g., “web-api”, “cli”)task_type- Type of task (e.g., “code_generation”, “debugging”)language- Optional programming languageframework- Optional framework nametags- Optional array of tagscomplexity- Optional complexity level (“simple”, “moderate”, “complex”)
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn get_episode_tool(&self, args: Value) -> Result<Value>
pub async fn get_episode_tool(&self, args: Value) -> Result<Value>
Get episode details by ID
This tool retrieves complete details of an episode including all steps, outcome, reflection, and extracted patterns.
§Arguments (from JSON)
episode_id- UUID of the episode to retrievefields- Optional array of field paths to return (e.g., [“episode.id”, “episode.task_description”])
§Field Selection
Clients can request specific fields to reduce token usage:
{
"episode_id": "123e4567-e89b-12d3-a456-426614174000",
"fields": ["episode.id", "episode.task_description", "episode.outcome"]
}Sourcepub async fn delete_episode_tool(&self, args: Value) -> Result<Value>
pub async fn delete_episode_tool(&self, args: Value) -> Result<Value>
Delete an episode permanently
This tool removes an episode from all storage backends. Warning: This operation cannot be undone.
§Arguments (from JSON)
episode_id- UUID of the episode to deleteconfirm- Must be set to true to confirm deletion
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn add_episode_relationship_tool(&self, args: Value) -> Result<Value>
pub async fn add_episode_relationship_tool(&self, args: Value) -> Result<Value>
Add a relationship between two episodes
This tool creates a directed relationship from one episode to another with validation. Supports relationship types: parent_child, depends_on, follows, related_to, blocks, duplicates, references.
§Arguments (from JSON)
from_episode_id- Source episode UUIDto_episode_id- Target episode UUIDrelationship_type- Type of relationshipreason- Optional explanationpriority- Optional priority (1-10)created_by- Optional creator identifier
Sourcepub async fn remove_episode_relationship_tool(
&self,
args: Value,
) -> Result<Value>
pub async fn remove_episode_relationship_tool( &self, args: Value, ) -> Result<Value>
Remove a relationship by ID
This tool removes an existing episode relationship.
§Arguments (from JSON)
relationship_id- UUID of the relationship to remove
Sourcepub async fn get_episode_relationships_tool(&self, args: Value) -> Result<Value>
pub async fn get_episode_relationships_tool(&self, args: Value) -> Result<Value>
Get relationships for an episode
This tool retrieves all relationships for a given episode with optional direction and type filtering.
§Arguments (from JSON)
episode_id- Episode UUID to querydirection- Optional direction filter (“outgoing”, “incoming”, “both”)relationship_type- Optional relationship type filter
Find episodes related to a given episode
This tool finds all episodes related to the specified episode with optional filtering by relationship type.
§Arguments (from JSON)
episode_id- Episode UUID to find relationships forrelationship_type- Optional relationship type filterlimit- Optional maximum number of results (default: 10)include_metadata- Optional flag to include relationship metadata
Sourcepub async fn check_relationship_exists_tool(&self, args: Value) -> Result<Value>
pub async fn check_relationship_exists_tool(&self, args: Value) -> Result<Value>
Check if a specific relationship exists
This tool checks whether a relationship of a specific type exists between two episodes.
§Arguments (from JSON)
from_episode_id- Source episode UUIDto_episode_id- Target episode UUIDrelationship_type- Type of relationship to check
Sourcepub async fn get_dependency_graph_tool(&self, args: Value) -> Result<Value>
pub async fn get_dependency_graph_tool(&self, args: Value) -> Result<Value>
Get dependency graph for visualization
This tool builds a relationship graph starting from an episode up to a specified depth, optionally in DOT format for visualization.
§Arguments (from JSON)
episode_id- Root episode UUIDdepth- Optional maximum traversal depth (1-5, default: 2)format- Optional output format (“json” or “dot”, default: “json”)
Sourcepub async fn validate_no_cycles_tool(&self, args: Value) -> Result<Value>
pub async fn validate_no_cycles_tool(&self, args: Value) -> Result<Value>
Validate that adding a relationship would not create a cycle
This tool checks if adding a relationship between two episodes would create a cycle in the dependency graph. Returns whether a cycle would be created and the cycle path if detected.
§Arguments (from JSON)
from_episode_id- Source episode UUID (proposed from)to_episode_id- Target episode UUID (proposed to)relationship_type- Type of relationship being added
Sourcepub async fn get_topological_order_tool(&self, args: Value) -> Result<Value>
pub async fn get_topological_order_tool(&self, args: Value) -> Result<Value>
Get topological ordering of episodes
This tool returns episodes in topological order where dependencies come before dependents. Only works on directed acyclic graphs (DAGs).
§Arguments (from JSON)
episode_ids- Array of episode UUIDs to sort
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn add_episode_step_tool(&self, args: Value) -> Result<Value>
pub async fn add_episode_step_tool(&self, args: Value) -> Result<Value>
Add a step to an existing episode
This tool allows logging execution steps to track progress within an episode.
§Arguments (from JSON)
episode_id- UUID of the episodestep_number- Sequential step numbertool- Name of the tool/component performing the actionaction- Description of the action takenparameters- Optional JSON object of parametersresult- Optional result object with type and detailslatency_ms- Optional execution time in milliseconds
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn update_episode_tool(&self, args: Value) -> Result<Value>
pub async fn update_episode_tool(&self, args: Value) -> Result<Value>
Update an existing episode with new information
This tool allows AI agents to programmatically update episodes to modify descriptions, tags, and metadata.
§Arguments (from JSON)
episode_id- UUID of the episode to updatedescription- Optional new task descriptionadd_tags- Optional tags to add to the episoderemove_tags- Optional tags to remove from the episodeset_tags- Optional tags to replace all existing tagsmetadata- Optional metadata key-value pairs to merge
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_configure_agentfs(
&self,
input: ConfigureAgentFsInput,
) -> Result<Value>
pub async fn execute_configure_agentfs( &self, input: ConfigureAgentFsInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_external_signal_status(
&self,
input: ExternalSignalStatusInput,
) -> Result<Value>
pub async fn execute_external_signal_status( &self, input: ExternalSignalStatusInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_test_agentfs_connection(
&self,
input: TestAgentFsConnectionInput,
) -> Result<Value>
pub async fn execute_test_agentfs_connection( &self, input: TestAgentFsConnectionInput, ) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn get_stats(&self) -> ExecutionStats
pub async fn get_stats(&self) -> ExecutionStats
Get execution statistics
Sourcepub async fn get_tool_usage(&self) -> HashMap<String, usize>
pub async fn get_tool_usage(&self) -> HashMap<String, usize>
Get tool usage statistics
Sourcepub async fn remove_tool(&self, tool_name: &str) -> Result<()>
pub async fn remove_tool(&self, tool_name: &str) -> Result<()>
Remove a tool from the server
Sourcepub fn monitoring_endpoints(&self) -> Arc<MonitoringEndpoints>
pub fn monitoring_endpoints(&self) -> Arc<MonitoringEndpoints>
Get monitoring endpoints
Sourcepub fn monitoring_system(&self) -> Arc<MonitoringSystem>
pub fn monitoring_system(&self) -> Arc<MonitoringSystem>
Get monitoring system
Sourcepub async fn update_system_metrics(&self)
pub async fn update_system_metrics(&self)
Update system metrics (memory, CPU)
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn health_check(&self) -> Result<Value>
pub async fn health_check(&self) -> Result<Value>
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn execute_search_patterns(
&self,
input: SearchPatternsInput,
) -> Result<Value>
pub async fn execute_search_patterns( &self, input: SearchPatternsInput, ) -> Result<Value>
Execute search_patterns tool
Sourcepub async fn execute_recommend_patterns(
&self,
input: RecommendPatternsInput,
) -> Result<Value>
pub async fn execute_recommend_patterns( &self, input: RecommendPatternsInput, ) -> Result<Value>
Execute recommend_patterns tool
Source§impl MemoryMCPServer
impl MemoryMCPServer
Sourcepub async fn new(
_config: SandboxConfig,
memory: Arc<SelfLearningMemory>,
) -> Result<Self>
pub async fn new( _config: SandboxConfig, memory: Arc<SelfLearningMemory>, ) -> Result<Self>
Sourcepub fn memory(&self) -> Arc<SelfLearningMemory>
pub fn memory(&self) -> Arc<SelfLearningMemory>
Sourcepub fn audit_logger(&self) -> Arc<AuditLogger>
pub fn audit_logger(&self) -> Arc<AuditLogger>
Sourcepub fn rate_limiter(&self) -> &RateLimiter
pub fn rate_limiter(&self) -> &RateLimiter
Sourcepub fn client_id_from_args(&self, args: &Value) -> ClientId
pub fn client_id_from_args(&self, args: &Value) -> ClientId
Sourcepub fn check_rate_limit(
&self,
client_id: &ClientId,
operation: OperationType,
) -> RateLimitResult
pub fn check_rate_limit( &self, client_id: &ClientId, operation: OperationType, ) -> RateLimitResult
Sourcepub fn rate_limit_headers(
&self,
result: &RateLimitResult,
) -> Vec<(String, String)>
pub fn rate_limit_headers( &self, result: &RateLimitResult, ) -> Vec<(String, String)>
Sourcepub fn rate_limited_headers(
&self,
result: &RateLimitResult,
) -> Vec<(String, String)>
pub fn rate_limited_headers( &self, result: &RateLimitResult, ) -> Vec<(String, String)>
Auto Trait Implementations§
impl !Freeze for MemoryMCPServer
impl !RefUnwindSafe for MemoryMCPServer
impl Send for MemoryMCPServer
impl Sync for MemoryMCPServer
impl Unpin for MemoryMCPServer
impl UnsafeUnpin for MemoryMCPServer
impl !UnwindSafe for MemoryMCPServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.