@prmichaelsen/remember-mcp 2.0.0 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT.md +216 -2
- package/CHANGELOG.md +48 -0
- package/README.md +68 -7
- package/agent/design/design.template.md +136 -0
- package/agent/design/requirements.template.md +387 -0
- package/agent/milestones/milestone-1-{title}.template.md +206 -0
- package/agent/patterns/bootstrap.template.md +1237 -0
- package/agent/patterns/pattern.template.md +364 -0
- package/agent/progress.template.yaml +158 -0
- package/agent/progress.yaml +111 -8
- package/agent/scripts/check-for-updates.sh +88 -0
- package/agent/scripts/uninstall.sh +75 -0
- package/agent/scripts/update.sh +75 -0
- package/agent/tasks/task-1-{title}.template.md +225 -0
- package/agent/tasks/task-22-comprehensive-error-handling.md +218 -0
- package/agent/tasks/task-23-fix-relationship-creation-errors.md +97 -0
- package/agent/tasks/task-24-fix-weaviate-filter-path-error.md +132 -0
- package/agent/tasks/task-25-fix-update-memory-errors.md +116 -0
- package/dist/server-factory.js +192 -74
- package/dist/server.js +192 -74
- package/dist/utils/error-handler.d.ts +40 -0
- package/package.json +1 -1
- package/src/tools/create-memory.ts +8 -2
- package/src/tools/create-relationship.ts +42 -5
- package/src/tools/delete-memory.ts +8 -2
- package/src/tools/delete-relationship.ts +7 -2
- package/src/tools/find-similar.ts +9 -2
- package/src/tools/get-preferences.ts +7 -2
- package/src/tools/query-memory.ts +8 -2
- package/src/tools/search-memory.ts +8 -3
- package/src/tools/search-relationship.ts +44 -47
- package/src/tools/set-preference.ts +7 -2
- package/src/tools/update-memory.ts +41 -10
- package/src/tools/update-relationship.ts +8 -2
- package/src/utils/error-handler.ts +79 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Agent Context Protocol (ACP) Update Checker
|
|
4
|
+
# This script checks if updates are available for AGENT.md
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # No Color
|
|
14
|
+
|
|
15
|
+
# Repository URL
|
|
16
|
+
REPO_URL="https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainline"
|
|
17
|
+
AGENT_MD_URL="$REPO_URL/AGENT.md"
|
|
18
|
+
CHANGELOG_URL="$REPO_URL/CHANGELOG.md"
|
|
19
|
+
|
|
20
|
+
# Silent mode (no output, just exit codes)
|
|
21
|
+
SILENT=false
|
|
22
|
+
if [ "$1" = "--silent" ] || [ "$1" = "-s" ]; then
|
|
23
|
+
SILENT=true
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Check if AGENT.md exists
|
|
27
|
+
if [ ! -f "AGENT.md" ]; then
|
|
28
|
+
if [ "$SILENT" = false ]; then
|
|
29
|
+
echo -e "${RED}Error: AGENT.md not found in current directory${NC}" >&2
|
|
30
|
+
echo "This script should be run from your project root where AGENT.md is located." >&2
|
|
31
|
+
fi
|
|
32
|
+
exit 2
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Download latest AGENT.md for comparison
|
|
36
|
+
if [ "$SILENT" = false ]; then
|
|
37
|
+
echo -e "${BLUE}Checking for updates...${NC}"
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if command -v curl &> /dev/null; then
|
|
41
|
+
curl -fsSL "$AGENT_MD_URL" -o /tmp/AGENT.md.latest 2>/dev/null
|
|
42
|
+
elif command -v wget &> /dev/null; then
|
|
43
|
+
wget -q "$AGENT_MD_URL" -O /tmp/AGENT.md.latest 2>/dev/null
|
|
44
|
+
else
|
|
45
|
+
if [ "$SILENT" = false ]; then
|
|
46
|
+
echo -e "${RED}Error: Neither curl nor wget is available${NC}" >&2
|
|
47
|
+
fi
|
|
48
|
+
exit 2
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
if [ $? -ne 0 ]; then
|
|
52
|
+
if [ "$SILENT" = false ]; then
|
|
53
|
+
echo -e "${RED}Error: Failed to download latest AGENT.md${NC}" >&2
|
|
54
|
+
echo "Please check your internet connection." >&2
|
|
55
|
+
fi
|
|
56
|
+
rm -f /tmp/AGENT.md.latest
|
|
57
|
+
exit 2
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Compare files
|
|
61
|
+
if cmp -s AGENT.md /tmp/AGENT.md.latest; then
|
|
62
|
+
# Files are identical - no updates
|
|
63
|
+
if [ "$SILENT" = false ]; then
|
|
64
|
+
echo -e "${GREEN}✓${NC} Your AGENT.md is up to date!"
|
|
65
|
+
fi
|
|
66
|
+
rm -f /tmp/AGENT.md.latest
|
|
67
|
+
exit 0
|
|
68
|
+
else
|
|
69
|
+
# Files differ - updates available
|
|
70
|
+
if [ "$SILENT" = false ]; then
|
|
71
|
+
echo -e "${YELLOW}⚠${NC} Updates are available for AGENT.md"
|
|
72
|
+
echo ""
|
|
73
|
+
|
|
74
|
+
# Download and display changelog
|
|
75
|
+
echo "Recent changes:"
|
|
76
|
+
echo "---------------"
|
|
77
|
+
if command -v curl &> /dev/null; then
|
|
78
|
+
curl -fsSL "$CHANGELOG_URL" 2>/dev/null | head -n 50
|
|
79
|
+
elif command -v wget &> /dev/null; then
|
|
80
|
+
wget -q "$CHANGELOG_URL" -O - 2>/dev/null | head -n 50
|
|
81
|
+
fi
|
|
82
|
+
echo ""
|
|
83
|
+
echo "To update, run: ./agent/scripts/update.sh"
|
|
84
|
+
echo "Or: curl -fsSL https://raw.githubusercontent.com/prmichaelsen/agent-context-protocol/mainlin./agent/scripts/update.sh | bash"
|
|
85
|
+
fi
|
|
86
|
+
rm -f /tmp/AGENT.md.latest
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Agent Context Protocol (ACP) Uninstall Script
|
|
4
|
+
# This script removes all ACP files from a project
|
|
5
|
+
# Usage: ./agent/scripts/uninstall.sh [-y]
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
# Colors for output
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Check for -y flag
|
|
17
|
+
AUTO_CONFIRM=false
|
|
18
|
+
if [ "$1" = "-y" ]; then
|
|
19
|
+
AUTO_CONFIRM=true
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
echo -e "${YELLOW}Agent Context Protocol (ACP) Uninstall${NC}"
|
|
23
|
+
echo "======================================"
|
|
24
|
+
echo ""
|
|
25
|
+
|
|
26
|
+
# Check if agent directory exists
|
|
27
|
+
if [ ! -d "agent" ] && [ ! -f "AGENT.md" ]; then
|
|
28
|
+
echo -e "${YELLOW}No ACP files found in current directory${NC}"
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# If not auto-confirmed, show instructions for agents
|
|
33
|
+
if [ "$AUTO_CONFIRM" = false ]; then
|
|
34
|
+
echo -e "${BLUE}Note for AI Agents:${NC}"
|
|
35
|
+
echo "This script requires user confirmation to prevent accidental deletion."
|
|
36
|
+
echo "Please ask the user: 'Do you want to uninstall ACP from this project?'"
|
|
37
|
+
echo "If yes, rerun this script with: ./agent/scripts/uninstall.sh -y"
|
|
38
|
+
echo ""
|
|
39
|
+
echo -e "${RED}WARNING: This will permanently delete:${NC}"
|
|
40
|
+
echo " - agent/ directory (all contents)"
|
|
41
|
+
echo " - AGENT.md file"
|
|
42
|
+
echo ""
|
|
43
|
+
echo "Make sure you have committed any important changes to git."
|
|
44
|
+
echo ""
|
|
45
|
+
|
|
46
|
+
read -p "Are you sure you want to remove all ACP files? (y/N) " -n 1 -r
|
|
47
|
+
echo
|
|
48
|
+
|
|
49
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
50
|
+
echo "Uninstall cancelled. No files were deleted."
|
|
51
|
+
exit 0
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo ""
|
|
56
|
+
echo "Removing ACP files..."
|
|
57
|
+
|
|
58
|
+
# Remove agent directory
|
|
59
|
+
if [ -d "agent" ]; then
|
|
60
|
+
rm -rf agent
|
|
61
|
+
echo -e "${GREEN}✓${NC} Removed agent/ directory"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Remove AGENT.md
|
|
65
|
+
if [ -f "AGENT.md" ]; then
|
|
66
|
+
rm -f AGENT.md
|
|
67
|
+
echo -e "${GREEN}✓${NC} Removed AGENT.md"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
echo ""
|
|
71
|
+
echo -e "${GREEN}Uninstall complete!${NC}"
|
|
72
|
+
echo ""
|
|
73
|
+
echo "All ACP files have been removed from this project."
|
|
74
|
+
echo "Use 'git status' to see what was deleted."
|
|
75
|
+
echo ""
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Agent Context Protocol (ACP) Update Script
|
|
4
|
+
# This script updates AGENT.md, template files, and utility scripts from the repository
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # No Color
|
|
14
|
+
|
|
15
|
+
# Repository details
|
|
16
|
+
REPO_URL="https://github.com/prmichaelsen/agent-context-protocol.git"
|
|
17
|
+
BRANCH="mainline"
|
|
18
|
+
|
|
19
|
+
echo -e "${BLUE}Agent Context Protocol (ACP) Updater${NC}"
|
|
20
|
+
echo "======================================"
|
|
21
|
+
echo ""
|
|
22
|
+
|
|
23
|
+
# Check if AGENT.md exists
|
|
24
|
+
if [ ! -f "AGENT.md" ]; then
|
|
25
|
+
echo -e "${RED}Error: AGENT.md not found in current directory${NC}"
|
|
26
|
+
echo "This script should be run from your project root where AGENT.md is located."
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Create temporary directory
|
|
31
|
+
TEMP_DIR=$(mktemp -d)
|
|
32
|
+
trap "rm -rf $TEMP_DIR" EXIT
|
|
33
|
+
|
|
34
|
+
echo "Fetching latest ACP files..."
|
|
35
|
+
if ! git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$TEMP_DIR" &>/dev/null; then
|
|
36
|
+
echo -e "${RED}Error: Failed to fetch repository${NC}"
|
|
37
|
+
echo "Please check your internet connection and try again."
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
echo -e "${GREEN}✓${NC} Latest files fetched"
|
|
42
|
+
echo ""
|
|
43
|
+
|
|
44
|
+
echo "Updating ACP files..."
|
|
45
|
+
|
|
46
|
+
# Update template files
|
|
47
|
+
cp "$TEMP_DIR/agent/design/design.template.md" "agent/design/"
|
|
48
|
+
cp "$TEMP_DIR/agent/design/requirements.template.md" "agent/design/"
|
|
49
|
+
cp "$TEMP_DIR/agent/milestones/milestone-1-{title}.template.md" "agent/milestones/"
|
|
50
|
+
cp "$TEMP_DIR/agent/tasks/task-1-{title}.template.md" "agent/tasks/"
|
|
51
|
+
cp "$TEMP_DIR/agent/patterns/pattern.template.md" "agent/patterns/"
|
|
52
|
+
cp "$TEMP_DIR/agent/patterns/bootstrap.template.md" "agent/patterns/"
|
|
53
|
+
cp "$TEMP_DIR/agent/progress.template.yaml" "agent/"
|
|
54
|
+
|
|
55
|
+
# Update AGENT.md
|
|
56
|
+
cp "$TEMP_DIR/AGENT.md" "."
|
|
57
|
+
|
|
58
|
+
# Update scripts
|
|
59
|
+
cp "$TEMP_DIR/scripts/update.sh" "agent/scripts/"
|
|
60
|
+
cp "$TEMP_DIR/scripts/check-for-updates.sh" "agent/scripts/"
|
|
61
|
+
cp "$TEMP_DIR/scripts/uninstall.sh" "agent/scripts/"
|
|
62
|
+
chmod +x agent/scripts/*.sh
|
|
63
|
+
|
|
64
|
+
echo -e "${GREEN}✓${NC} All files updated"
|
|
65
|
+
echo ""
|
|
66
|
+
echo -e "${GREEN}Update complete!${NC}"
|
|
67
|
+
echo ""
|
|
68
|
+
echo -e "${BLUE}Next steps:${NC}"
|
|
69
|
+
echo "1. Review changes: git diff"
|
|
70
|
+
echo "2. See what changed: git status"
|
|
71
|
+
echo "3. Revert if needed: git checkout <file>"
|
|
72
|
+
echo ""
|
|
73
|
+
echo "For detailed changelog:"
|
|
74
|
+
echo " https://github.com/prmichaelsen/agent-context-protocol/blob/mainline/CHANGELOG.md"
|
|
75
|
+
echo ""
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Task {N}: {Descriptive Task Name}
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M{N} - Milestone Name](../milestones/milestone-{N}-{name}.md)
|
|
4
|
+
**Estimated Time**: [e.g., "2 hours", "4 hours", "1 day"]
|
|
5
|
+
**Dependencies**: [List prerequisite tasks, or "None"]
|
|
6
|
+
**Status**: Not Started | In Progress | Completed
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
[Clearly state what this task accomplishes. Be specific and focused on a single, achievable goal.]
|
|
13
|
+
|
|
14
|
+
**Example**: "Create the basic project structure with all necessary configuration files and directory organization for a TypeScript-based MCP server."
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Context
|
|
19
|
+
|
|
20
|
+
[Provide background information that helps understand why this task is necessary and how it fits into the larger milestone.]
|
|
21
|
+
|
|
22
|
+
**Example**: "This task establishes the foundation for the project. Without proper structure and configuration, subsequent development tasks cannot proceed. The structure follows industry best practices for TypeScript projects and MCP server organization."
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Steps
|
|
27
|
+
|
|
28
|
+
[Provide a detailed, sequential list of actions to complete this task. Each step should be concrete and actionable.]
|
|
29
|
+
|
|
30
|
+
### 1. [Step Category or Action]
|
|
31
|
+
[Detailed description of what to do]
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Command examples if applicable
|
|
35
|
+
command --with-flags
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Code examples if applicable
|
|
40
|
+
const example = "code";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. [Next Step]
|
|
44
|
+
[Detailed description]
|
|
45
|
+
|
|
46
|
+
### 3. [Next Step]
|
|
47
|
+
[Detailed description]
|
|
48
|
+
|
|
49
|
+
**Example**:
|
|
50
|
+
|
|
51
|
+
### 1. Create Project Directory
|
|
52
|
+
Create the root directory for the project and navigate into it:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
mkdir -p my-project
|
|
56
|
+
cd my-project
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. Initialize npm Project
|
|
60
|
+
Initialize a new npm project with default settings:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm init -y
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 3. Update package.json
|
|
67
|
+
Edit the generated package.json to include proper metadata and scripts:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"name": "my-project",
|
|
72
|
+
"version": "0.1.0",
|
|
73
|
+
"description": "Description of what this project does",
|
|
74
|
+
"main": "dist/index.js",
|
|
75
|
+
"type": "module",
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "node esbuild.build.js",
|
|
78
|
+
"dev": "tsx watch src/index.ts",
|
|
79
|
+
"start": "node dist/index.js",
|
|
80
|
+
"test": "vitest",
|
|
81
|
+
"typecheck": "tsc --noEmit"
|
|
82
|
+
},
|
|
83
|
+
"keywords": ["mcp", "relevant", "keywords"],
|
|
84
|
+
"author": "Your Name",
|
|
85
|
+
"license": "MIT"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Create Directory Structure
|
|
90
|
+
Create all necessary directories:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p src/{types,utils,tools}
|
|
94
|
+
mkdir -p tests/{unit,integration}
|
|
95
|
+
mkdir -p agent/{design,milestones,patterns,tasks}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 5. Create Configuration Files
|
|
99
|
+
Create TypeScript configuration, build scripts, and other config files.
|
|
100
|
+
|
|
101
|
+
**tsconfig.json**:
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"compilerOptions": {
|
|
105
|
+
"target": "ES2022",
|
|
106
|
+
"module": "Node16",
|
|
107
|
+
"moduleResolution": "Node16",
|
|
108
|
+
"lib": ["ES2022"],
|
|
109
|
+
"outDir": "./dist",
|
|
110
|
+
"rootDir": "./src",
|
|
111
|
+
"strict": true,
|
|
112
|
+
"esModuleInterop": true,
|
|
113
|
+
"skipLibCheck": true,
|
|
114
|
+
"forceConsistentCasingInFileNames": true,
|
|
115
|
+
"resolveJsonModule": true,
|
|
116
|
+
"declaration": true,
|
|
117
|
+
"declarationMap": true,
|
|
118
|
+
"sourceMap": true
|
|
119
|
+
},
|
|
120
|
+
"include": ["src/**/*"],
|
|
121
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
[Continue with other config files...]
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Verification
|
|
130
|
+
|
|
131
|
+
[Provide a checklist of items to verify the task is complete. Each item should be objectively verifiable.]
|
|
132
|
+
|
|
133
|
+
- [ ] Verification item 1: [Specific condition to check]
|
|
134
|
+
- [ ] Verification item 2: [Specific condition to check]
|
|
135
|
+
- [ ] Verification item 3: [Specific condition to check]
|
|
136
|
+
- [ ] Verification item 4: [Specific condition to check]
|
|
137
|
+
- [ ] Verification item 5: [Specific condition to check]
|
|
138
|
+
|
|
139
|
+
**Example**:
|
|
140
|
+
- [ ] Project directory created and contains expected subdirectories
|
|
141
|
+
- [ ] package.json exists and contains correct metadata
|
|
142
|
+
- [ ] tsconfig.json exists and is valid JSON
|
|
143
|
+
- [ ] All configuration files created (.gitignore, .env.example, etc.)
|
|
144
|
+
- [ ] Directory structure matches specification
|
|
145
|
+
- [ ] No syntax errors in configuration files
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Expected Output
|
|
150
|
+
|
|
151
|
+
[Describe what the project should look like after this task is complete.]
|
|
152
|
+
|
|
153
|
+
**File Structure**:
|
|
154
|
+
```
|
|
155
|
+
project-root/
|
|
156
|
+
├── file1
|
|
157
|
+
├── file2
|
|
158
|
+
└── directory/
|
|
159
|
+
└── file3
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Key Files Created**:
|
|
163
|
+
- `file1`: [Purpose]
|
|
164
|
+
- `file2`: [Purpose]
|
|
165
|
+
- `directory/file3`: [Purpose]
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Common Issues and Solutions
|
|
170
|
+
|
|
171
|
+
[Document potential problems and how to resolve them:]
|
|
172
|
+
|
|
173
|
+
### Issue 1: [Problem description]
|
|
174
|
+
**Symptom**: [What the user will see]
|
|
175
|
+
**Solution**: [How to fix it]
|
|
176
|
+
|
|
177
|
+
### Issue 2: [Problem description]
|
|
178
|
+
**Symptom**: [What the user will see]
|
|
179
|
+
**Solution**: [How to fix it]
|
|
180
|
+
|
|
181
|
+
**Example**:
|
|
182
|
+
|
|
183
|
+
### Issue 1: npm init fails
|
|
184
|
+
**Symptom**: Error message about permissions or missing npm
|
|
185
|
+
**Solution**: Ensure Node.js and npm are installed correctly. Run `node --version` and `npm --version` to verify.
|
|
186
|
+
|
|
187
|
+
### Issue 2: TypeScript configuration errors
|
|
188
|
+
**Symptom**: tsc complains about invalid configuration
|
|
189
|
+
**Solution**: Validate JSON syntax in tsconfig.json. Ensure all required fields are present.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Resources
|
|
194
|
+
|
|
195
|
+
[Link to relevant documentation, examples, or references:]
|
|
196
|
+
|
|
197
|
+
- [Resource 1 Name](URL): Description
|
|
198
|
+
- [Resource 2 Name](URL): Description
|
|
199
|
+
- [Resource 3 Name](URL): Description
|
|
200
|
+
|
|
201
|
+
**Example**:
|
|
202
|
+
- [TypeScript Handbook](https://www.typescriptlang.org/docs/): Official TypeScript documentation
|
|
203
|
+
- [esbuild Documentation](https://esbuild.github.io/): Build tool documentation
|
|
204
|
+
- [MCP SDK Documentation](https://github.com/modelcontextprotocol/sdk): MCP protocol reference
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Notes
|
|
209
|
+
|
|
210
|
+
[Any additional context, warnings, or considerations:]
|
|
211
|
+
|
|
212
|
+
- Note 1: [Important information]
|
|
213
|
+
- Note 2: [Important information]
|
|
214
|
+
- Note 3: [Important information]
|
|
215
|
+
|
|
216
|
+
**Example**:
|
|
217
|
+
- This task creates the foundation for all subsequent work
|
|
218
|
+
- Configuration files may need adjustment based on specific project requirements
|
|
219
|
+
- Keep .env files out of version control (ensure .gitignore is correct)
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
**Next Task**: [Link to next task: task-{N+1}-{name}.md]
|
|
224
|
+
**Related Design Docs**: [Links to relevant design documents]
|
|
225
|
+
**Estimated Completion Date**: [YYYY-MM-DD or "TBD"]
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Task 22: Comprehensive Error Handling for All Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: Cross-cutting improvement (applies to M1-M4)
|
|
4
|
+
**Estimated Time**: 3-4 hours
|
|
5
|
+
**Dependencies**: All tool implementations (Tasks 12-17, M3, M4)
|
|
6
|
+
**Status**: Completed
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Implement centralized error handling across all 12 MCP tools to provide detailed error diagnostics for production debugging. Replace generic error messages with comprehensive context including stack traces, user IDs, operation details, and tool-specific information.
|
|
13
|
+
|
|
14
|
+
## Problem Statement
|
|
15
|
+
|
|
16
|
+
Production errors were showing only generic messages like "Failed to update memory" without:
|
|
17
|
+
- Stack traces
|
|
18
|
+
- User context (userId, memoryId, etc.)
|
|
19
|
+
- Operation details
|
|
20
|
+
- Which specific operation failed (fetch vs update, etc.)
|
|
21
|
+
|
|
22
|
+
This made debugging production issues extremely difficult, requiring multiple deployment cycles to add logging incrementally.
|
|
23
|
+
|
|
24
|
+
## Solution
|
|
25
|
+
|
|
26
|
+
Created a centralized error handling framework that:
|
|
27
|
+
1. Provides consistent error formatting across all tools
|
|
28
|
+
2. Includes full stack traces in error messages
|
|
29
|
+
3. Adds structured logging with tool-specific context
|
|
30
|
+
4. Maintains detailed error information for Cloud Run logs
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Steps
|
|
35
|
+
|
|
36
|
+
### 1. Create Centralized Error Handler ✅
|
|
37
|
+
|
|
38
|
+
Created `src/utils/error-handler.ts` with three helper functions:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// Format error with detailed context
|
|
42
|
+
export function formatDetailedError(error: unknown, context: ErrorContext): string
|
|
43
|
+
|
|
44
|
+
// Handle tool execution error (logs and throws)
|
|
45
|
+
export function handleToolError(error: unknown, context: ErrorContext): never
|
|
46
|
+
|
|
47
|
+
// Wrap async operations with error handling
|
|
48
|
+
export async function withErrorHandling<T>(
|
|
49
|
+
operation: () => Promise<T>,
|
|
50
|
+
context: ErrorContext
|
|
51
|
+
): Promise<T>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Key Features**:
|
|
55
|
+
- Extracts error message and stack trace
|
|
56
|
+
- Logs structured error information
|
|
57
|
+
- Formats error with full context for throwing
|
|
58
|
+
- Supports custom context fields per tool
|
|
59
|
+
|
|
60
|
+
### 2. Apply to All 12 Tools ✅
|
|
61
|
+
|
|
62
|
+
Updated every tool to use `handleToolError()`:
|
|
63
|
+
|
|
64
|
+
**Memory Tools (6)**:
|
|
65
|
+
- `src/tools/create-memory.ts` ✅
|
|
66
|
+
- `src/tools/update-memory.ts` ✅
|
|
67
|
+
- `src/tools/delete-memory.ts` ✅
|
|
68
|
+
- `src/tools/search-memory.ts` ✅
|
|
69
|
+
- `src/tools/find-similar.ts` ✅
|
|
70
|
+
- `src/tools/query-memory.ts` ✅
|
|
71
|
+
|
|
72
|
+
**Relationship Tools (4)**:
|
|
73
|
+
- `src/tools/create-relationship.ts` ✅
|
|
74
|
+
- `src/tools/update-relationship.ts` ✅
|
|
75
|
+
- `src/tools/delete-relationship.ts` ✅
|
|
76
|
+
- `src/tools/search-relationship.ts` ✅
|
|
77
|
+
|
|
78
|
+
**Preference Tools (2)**:
|
|
79
|
+
- `src/tools/set-preference.ts` ✅
|
|
80
|
+
- `src/tools/get-preferences.ts` ✅
|
|
81
|
+
|
|
82
|
+
### 3. Enhanced Error Context ✅
|
|
83
|
+
|
|
84
|
+
Each tool now provides specific context:
|
|
85
|
+
|
|
86
|
+
**Example - update-memory.ts**:
|
|
87
|
+
```typescript
|
|
88
|
+
} catch (error) {
|
|
89
|
+
handleToolError(error, {
|
|
90
|
+
toolName: 'remember_update_memory',
|
|
91
|
+
operation: 'update memory',
|
|
92
|
+
userId,
|
|
93
|
+
memoryId: args.memory_id,
|
|
94
|
+
updatedFields: Object.keys(args).filter(k => k !== 'memory_id'),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Example - search-memory.ts**:
|
|
100
|
+
```typescript
|
|
101
|
+
} catch (error) {
|
|
102
|
+
handleToolError(error, {
|
|
103
|
+
toolName: 'remember_search_memory',
|
|
104
|
+
operation: 'search memories',
|
|
105
|
+
userId,
|
|
106
|
+
query: args.query,
|
|
107
|
+
includeRelationships: args.include_relationships,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. Build and Test ✅
|
|
113
|
+
|
|
114
|
+
- TypeScript compiles without errors
|
|
115
|
+
- All 53 tests passing (1 skipped)
|
|
116
|
+
- Build successful
|
|
117
|
+
- Version bumped to 2.0.2
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Verification
|
|
122
|
+
|
|
123
|
+
- [x] Centralized error handler created (`src/utils/error-handler.ts`)
|
|
124
|
+
- [x] All 12 tools updated to use error handler
|
|
125
|
+
- [x] Each tool provides tool-specific context
|
|
126
|
+
- [x] Stack traces included in all error messages
|
|
127
|
+
- [x] Structured logging implemented
|
|
128
|
+
- [x] TypeScript compiles without errors
|
|
129
|
+
- [x] All tests passing
|
|
130
|
+
- [x] Build successful
|
|
131
|
+
- [x] Version updated to 2.0.2
|
|
132
|
+
- [x] CHANGELOG.md updated
|
|
133
|
+
- [x] Progress tracking updated
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Results
|
|
138
|
+
|
|
139
|
+
### Before
|
|
140
|
+
```
|
|
141
|
+
Error: Failed to update memory
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### After
|
|
145
|
+
```
|
|
146
|
+
Error: Failed to update memory: Memory not found
|
|
147
|
+
|
|
148
|
+
Stack trace:
|
|
149
|
+
Error: Memory not found
|
|
150
|
+
at handleUpdateMemory (update-memory.ts:120)
|
|
151
|
+
at async Server.handleToolCall (server.ts:45)
|
|
152
|
+
...
|
|
153
|
+
|
|
154
|
+
Context: userId=user_123, memoryId=abc-def-ghi, operation=update memory, toolName=remember_update_memory
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Impact
|
|
158
|
+
|
|
159
|
+
**Production Debugging**:
|
|
160
|
+
- Errors now include full stack traces
|
|
161
|
+
- User context always available
|
|
162
|
+
- Operation details clearly logged
|
|
163
|
+
- Tool-specific information included
|
|
164
|
+
|
|
165
|
+
**Developer Experience**:
|
|
166
|
+
- Consistent error format across all tools
|
|
167
|
+
- Easy to add new tools with proper error handling
|
|
168
|
+
- Reusable error handling utilities
|
|
169
|
+
- Structured logging for Cloud Run
|
|
170
|
+
|
|
171
|
+
**Maintenance**:
|
|
172
|
+
- Single source of truth for error formatting
|
|
173
|
+
- Easy to enhance error handling globally
|
|
174
|
+
- Consistent logging patterns
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Files Created
|
|
179
|
+
|
|
180
|
+
- `src/utils/error-handler.ts` - Centralized error handling utilities
|
|
181
|
+
|
|
182
|
+
## Files Modified
|
|
183
|
+
|
|
184
|
+
All 12 tool files:
|
|
185
|
+
- `src/tools/create-memory.ts`
|
|
186
|
+
- `src/tools/update-memory.ts`
|
|
187
|
+
- `src/tools/delete-memory.ts`
|
|
188
|
+
- `src/tools/search-memory.ts`
|
|
189
|
+
- `src/tools/find-similar.ts`
|
|
190
|
+
- `src/tools/query-memory.ts`
|
|
191
|
+
- `src/tools/create-relationship.ts`
|
|
192
|
+
- `src/tools/update-relationship.ts`
|
|
193
|
+
- `src/tools/delete-relationship.ts`
|
|
194
|
+
- `src/tools/search-relationship.ts`
|
|
195
|
+
- `src/tools/set-preference.ts`
|
|
196
|
+
- `src/tools/get-preferences.ts`
|
|
197
|
+
|
|
198
|
+
Documentation:
|
|
199
|
+
- `package.json` - Version 2.0.2
|
|
200
|
+
- `CHANGELOG.md` - Added v2.0.2 entry
|
|
201
|
+
- `agent/progress.yaml` - Updated status
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Notes
|
|
206
|
+
|
|
207
|
+
- Error handler uses structured logging compatible with Cloud Run
|
|
208
|
+
- Stack traces are preserved and included in error messages
|
|
209
|
+
- Context is customizable per tool
|
|
210
|
+
- No sensitive data (tokens, passwords) logged
|
|
211
|
+
- Consistent prefix format for easy log filtering
|
|
212
|
+
- All tools now have production-grade error handling
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
**Completed**: 2026-02-14
|
|
217
|
+
**Version**: 2.0.2
|
|
218
|
+
**Next Steps**: Deploy to production and monitor improved error diagnostics
|