-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmcp_memory_workflow.yaml
More file actions
156 lines (141 loc) · 4.02 KB
/
mcp_memory_workflow.yaml
File metadata and controls
156 lines (141 loc) · 4.02 KB
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
# MCP Memory Workflow
# Demonstrates using MCP memory for context management
id: mcp_memory_workflow
name: MCP Memory Context Management
description: Use MCP memory to maintain context across pipeline steps
version: "1.0.0"
parameters:
user_name:
type: string
default: "User"
task_description:
type: string
default: "Analyze sales data and create visualizations"
output_path:
type: string
default: "examples/outputs/mcp_memory_workflow"
steps:
# Initialize conversation context
- id: init_context
tool: mcp-memory
action: execute
parameters:
action: "store"
namespace: "conversation"
key: "user_profile"
value:
name: "{{ user_name }}"
task: "{{ task_description }}"
started_at: "{{ execution['timestamp'] }}"
ttl: 7200 # 2 hours
# Store task breakdown
- id: store_task_steps
tool: mcp-memory
action: execute
parameters:
action: "store"
namespace: "conversation"
key: "task_steps"
value:
- "Load and validate data"
- "Perform statistical analysis"
- "Create visualizations"
- "Generate report"
ttl: 7200
dependencies:
- init_context
# Simulate processing first step
- id: process_step_1
tool: task-delegation
action: execute
parameters:
task: "Identify specific data sources for: {{ task_description }}"
requirements:
capabilities: ["data-analysis"]
dependencies:
- store_task_steps
# Store progress
- id: update_progress
tool: mcp-memory
action: execute
parameters:
action: "store"
namespace: "conversation"
key: "progress"
value:
current_step: 1
completed_steps: ["Data loading plan created"]
next_action: "Execute data loading"
ttl: 7200
dependencies:
- process_step_1
# Retrieve all context
- id: get_full_context
tool: mcp-memory
action: execute
parameters:
action: "list"
namespace: "conversation"
dependencies:
- update_progress
# Build context summary
- id: build_context_summary
tool: filesystem
action: write
parameters:
path: "{{ output_path }}/{{ user_name | slugify }}_context_summary.md"
content: |
# Context Summary
**Generated on:** {{ execution['timestamp'] }}
## Current Context State
**Namespace**: conversation
**Active Keys**: {{ get_full_context['keys'] | join(', ') }}
### Details:
{% for key in get_full_context['keys'] %}
- **{{ key }}**: Stored in memory
{% endfor %}
dependencies:
- get_full_context
# Create persistent memory export
- id: export_memory
tool: filesystem
action: write
parameters:
path: "{{ output_path }}/{{ user_name | slugify }}_memory_export.json"
content: |
{
"namespace": "conversation",
"exported_at": "{{ execution['timestamp'] }}",
"keys": {{ get_full_context['keys'] | tojson }},
"metadata": {
"user": "{{ user_name }}",
"task": "{{ task_description }}"
}
}
dependencies:
- get_full_context
# Demonstrate TTL expiration check
- id: check_expiration
tool: mcp-memory
action: execute
parameters:
action: "retrieve"
namespace: "conversation"
key: "user_profile"
dependencies:
- export_memory
# Clean up namespace (optional)
- id: cleanup_memory
tool: mcp-memory
action: execute
parameters:
action: "clear"
namespace: "temporary_workspace"
dependencies:
- export_memory
condition: "false" # Disabled by default
outputs:
context_keys: "{{ get_full_context['keys'] | tojson }}"
user_profile_found: "{{ check_expiration['found'] }}"
memory_export_path: "{{ output_path }}/{{ user_name | slugify }}_memory_export.json"
context_summary_path: "{{ output_path }}/{{ user_name | slugify }}_context_summary.md"