@prmichaelsen/remember-mcp 2.2.1 → 2.3.1
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 +98 -5
- package/CHANGELOG.md +45 -0
- package/README.md +43 -3
- package/agent/commands/acp.init.md +376 -0
- package/agent/commands/acp.package-install.md +347 -0
- package/agent/commands/acp.proceed.md +311 -0
- package/agent/commands/acp.report.md +392 -0
- package/agent/commands/acp.status.md +280 -0
- package/agent/commands/acp.sync.md +323 -0
- package/agent/commands/acp.update.md +301 -0
- package/agent/commands/acp.validate.md +385 -0
- package/agent/commands/acp.version-check-for-updates.md +275 -0
- package/agent/commands/acp.version-check.md +190 -0
- package/agent/commands/acp.version-update.md +288 -0
- package/agent/commands/command.template.md +273 -0
- package/agent/design/core-memory-user-profile.md +1253 -0
- package/agent/design/ghost-profiles-pseudonymous-identity.md +194 -0
- package/agent/design/publish-tools-confirmation-flow.md +922 -0
- package/agent/milestones/milestone-10-shared-spaces.md +169 -0
- package/agent/progress.yaml +90 -4
- package/agent/scripts/install.sh +118 -0
- package/agent/scripts/update.sh +22 -10
- package/agent/scripts/version.sh +35 -0
- package/agent/tasks/task-27-implement-llm-provider-interface.md +51 -0
- package/agent/tasks/task-28-implement-llm-provider-factory.md +64 -0
- package/agent/tasks/task-29-update-config-for-llm.md +71 -0
- package/agent/tasks/task-30-implement-bedrock-provider.md +147 -0
- package/agent/tasks/task-31-implement-background-job-service.md +120 -0
- package/agent/tasks/task-32-test-llm-provider-integration.md +152 -0
- package/agent/tasks/task-34-create-confirmation-token-service.md +191 -0
- package/agent/tasks/task-35-create-space-memory-types-schema.md +183 -0
- package/agent/tasks/task-36-implement-remember-publish.md +227 -0
- package/agent/tasks/task-37-implement-remember-confirm.md +225 -0
- package/agent/tasks/task-38-implement-remember-deny.md +161 -0
- package/agent/tasks/task-39-implement-remember-search-space.md +188 -0
- package/agent/tasks/task-40-implement-remember-query-space.md +193 -0
- package/agent/tasks/task-41-configure-firestore-ttl.md +188 -0
- package/agent/tasks/task-42-create-tests-shared-spaces.md +216 -0
- package/agent/tasks/task-43-update-documentation.md +255 -0
- package/agent/tasks/task-44-implement-remember-retract.md +263 -0
- package/agent/tasks/task-45-fix-publish-false-success-bug.md +230 -0
- package/dist/llm/types.d.ts +1 -0
- package/dist/server-factory.js +1000 -1
- package/dist/server.js +1002 -3
- package/dist/services/confirmation-token.service.d.ts +99 -0
- package/dist/services/confirmation-token.service.spec.d.ts +5 -0
- package/dist/tools/confirm.d.ts +20 -0
- package/dist/tools/deny.d.ts +19 -0
- package/dist/tools/publish.d.ts +22 -0
- package/dist/tools/query-space.d.ts +28 -0
- package/dist/tools/search-space.d.ts +29 -0
- package/dist/types/space-memory.d.ts +80 -0
- package/dist/weaviate/space-schema.d.ts +59 -0
- package/dist/weaviate/space-schema.spec.d.ts +5 -0
- package/package.json +1 -1
- package/src/llm/types.ts +0 -0
- package/src/server-factory.ts +33 -0
- package/src/server.ts +33 -0
- package/src/services/confirmation-token.service.spec.ts +254 -0
- package/src/services/confirmation-token.service.ts +265 -0
- package/src/tools/confirm.ts +219 -0
- package/src/tools/create-memory.ts +7 -0
- package/src/tools/deny.ts +70 -0
- package/src/tools/publish.ts +190 -0
- package/src/tools/query-space.ts +197 -0
- package/src/tools/search-space.ts +189 -0
- package/src/types/space-memory.ts +94 -0
- package/src/weaviate/space-schema.spec.ts +131 -0
- package/src/weaviate/space-schema.ts +275 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Task 38: Implement remember_deny Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: M10 - Shared Spaces & Confirmation Flow
|
|
4
|
+
**Estimated Time**: 2 hours
|
|
5
|
+
**Dependencies**: Task 34 (Token Service)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Implement the generic `remember_deny` tool that cancels any pending action. This allows users to reject confirmation requests.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Create Tool File
|
|
19
|
+
|
|
20
|
+
Create `src/tools/deny.ts` with denial logic.
|
|
21
|
+
|
|
22
|
+
**Actions**:
|
|
23
|
+
- Import token service
|
|
24
|
+
- Define tool schema
|
|
25
|
+
- Create handler function
|
|
26
|
+
- Export tool definition and handler
|
|
27
|
+
|
|
28
|
+
**Expected Outcome**: Tool file structure created
|
|
29
|
+
|
|
30
|
+
### 2. Define Tool Schema
|
|
31
|
+
|
|
32
|
+
Create MCP tool definition for remember_deny.
|
|
33
|
+
|
|
34
|
+
**Actions**:
|
|
35
|
+
- Set tool name: `remember_deny`
|
|
36
|
+
- Write clear description emphasizing generic nature
|
|
37
|
+
- Define input schema with single parameter:
|
|
38
|
+
- `token` (required): Confirmation token to deny
|
|
39
|
+
- Add helpful description
|
|
40
|
+
|
|
41
|
+
**Expected Outcome**: Tool schema complete
|
|
42
|
+
|
|
43
|
+
### 3. Implement Token Denial
|
|
44
|
+
|
|
45
|
+
Use token service to deny the request.
|
|
46
|
+
|
|
47
|
+
**Actions**:
|
|
48
|
+
- Call `confirmationTokenService.denyRequest()`
|
|
49
|
+
- Pass userId and token
|
|
50
|
+
- Check if denial was successful
|
|
51
|
+
- Handle invalid token error
|
|
52
|
+
- Return appropriate response
|
|
53
|
+
|
|
54
|
+
**Expected Outcome**: Token denial working
|
|
55
|
+
|
|
56
|
+
### 4. Format Success Response
|
|
57
|
+
|
|
58
|
+
Return simple success response.
|
|
59
|
+
|
|
60
|
+
**Actions**:
|
|
61
|
+
- Create response with success flag
|
|
62
|
+
- Keep response minimal (just confirmation of denial)
|
|
63
|
+
- Format as JSON string
|
|
64
|
+
- No payload needed for denial
|
|
65
|
+
|
|
66
|
+
**Expected Outcome**: Clear response format
|
|
67
|
+
|
|
68
|
+
### 5. Implement Error Handling
|
|
69
|
+
|
|
70
|
+
Handle error cases.
|
|
71
|
+
|
|
72
|
+
**Actions**:
|
|
73
|
+
- Invalid token error
|
|
74
|
+
- Token already used error
|
|
75
|
+
- Token not found error
|
|
76
|
+
- Use `handleToolError` utility
|
|
77
|
+
- Include context in errors
|
|
78
|
+
|
|
79
|
+
**Expected Outcome**: Error handling complete
|
|
80
|
+
|
|
81
|
+
### 6. Add Tool to Server
|
|
82
|
+
|
|
83
|
+
Register tool in both server files.
|
|
84
|
+
|
|
85
|
+
**Actions**:
|
|
86
|
+
- Import tool in `src/server.ts`
|
|
87
|
+
- Add to tools list
|
|
88
|
+
- Add to call handler
|
|
89
|
+
- Repeat for `src/server-factory.ts`
|
|
90
|
+
|
|
91
|
+
**Expected Outcome**: Tool available in MCP server
|
|
92
|
+
|
|
93
|
+
### 7. Create Unit Tests
|
|
94
|
+
|
|
95
|
+
Test the deny tool.
|
|
96
|
+
|
|
97
|
+
**Actions**:
|
|
98
|
+
- Create `tests/unit/deny.test.ts`
|
|
99
|
+
- Test successful denial
|
|
100
|
+
- Test invalid token error
|
|
101
|
+
- Test token already used error
|
|
102
|
+
- Mock token service
|
|
103
|
+
- Verify response format
|
|
104
|
+
|
|
105
|
+
**Expected Outcome**: All tests passing
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Verification
|
|
110
|
+
|
|
111
|
+
- [ ] `src/tools/deny.ts` created
|
|
112
|
+
- [ ] Tool schema defined
|
|
113
|
+
- [ ] Token denial implemented
|
|
114
|
+
- [ ] Success response formatted correctly
|
|
115
|
+
- [ ] Error handling complete
|
|
116
|
+
- [ ] Tool registered in server.ts
|
|
117
|
+
- [ ] Tool registered in server-factory.ts
|
|
118
|
+
- [ ] Unit tests created and passing
|
|
119
|
+
- [ ] TypeScript compiles without errors
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Tool Schema
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
export const denyTool = {
|
|
127
|
+
name: 'remember_deny',
|
|
128
|
+
description: 'Deny a pending action. The request will be marked as denied and the token invalidated. Works for any action that requires confirmation.',
|
|
129
|
+
inputSchema: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
token: {
|
|
133
|
+
type: 'string',
|
|
134
|
+
description: 'The confirmation token from the action tool'
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
required: ['token']
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Response Format
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"success": true
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Related Files
|
|
155
|
+
|
|
156
|
+
- Design: [`agent/design/publish-tools-confirmation-flow.md`](../design/publish-tools-confirmation-flow.md)
|
|
157
|
+
- Token Service: [`src/services/confirmation-token.service.ts`](../../src/services/confirmation-token.service.ts)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
**Next Task**: Task 39 - Implement remember_search_space Tool
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Task 39: Implement remember_search_space Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: M10 - Shared Spaces & Confirmation Flow
|
|
4
|
+
**Estimated Time**: 3 hours
|
|
5
|
+
**Dependencies**: Task 35 (Space Types), M2 (Search Memory tool)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Implement `remember_search_space` tool for searching shared spaces. This is similar to `remember_search_memory` but searches space collections instead of personal collections.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Create Tool File
|
|
19
|
+
|
|
20
|
+
Create `src/tools/search-space.ts` based on search-memory.ts.
|
|
21
|
+
|
|
22
|
+
**Actions**:
|
|
23
|
+
- Copy structure from `search-memory.ts`
|
|
24
|
+
- Import space schema utilities
|
|
25
|
+
- Define tool schema
|
|
26
|
+
- Create handler function
|
|
27
|
+
- Export tool definition and handler
|
|
28
|
+
|
|
29
|
+
**Expected Outcome**: Tool file structure created
|
|
30
|
+
|
|
31
|
+
### 2. Define Tool Schema
|
|
32
|
+
|
|
33
|
+
Create MCP tool definition for remember_search_space.
|
|
34
|
+
|
|
35
|
+
**Actions**:
|
|
36
|
+
- Set tool name: `remember_search_space`
|
|
37
|
+
- Write clear description for searching shared spaces
|
|
38
|
+
- Define input schema with properties:
|
|
39
|
+
- `query` (required): Search query
|
|
40
|
+
- `space` (required): Space ID (enum: ['the_void'])
|
|
41
|
+
- All filter options from search_memory (content_type, tags, weight, trust, dates)
|
|
42
|
+
- `limit` and `offset` for pagination
|
|
43
|
+
- Set default values
|
|
44
|
+
|
|
45
|
+
**Expected Outcome**: Tool schema complete
|
|
46
|
+
|
|
47
|
+
### 3. Implement Space Collection Access
|
|
48
|
+
|
|
49
|
+
Get the space collection to search.
|
|
50
|
+
|
|
51
|
+
**Actions**:
|
|
52
|
+
- Call `ensureSpaceCollection()` with space_id
|
|
53
|
+
- Get collection reference
|
|
54
|
+
- Handle collection creation if needed
|
|
55
|
+
- Verify collection exists
|
|
56
|
+
|
|
57
|
+
**Expected Outcome**: Space collection accessible
|
|
58
|
+
|
|
59
|
+
### 4. Implement Hybrid Search
|
|
60
|
+
|
|
61
|
+
Execute hybrid search on space collection.
|
|
62
|
+
|
|
63
|
+
**Actions**:
|
|
64
|
+
- Use Weaviate hybrid search (semantic + keyword)
|
|
65
|
+
- Apply all filters (content_type, tags, weight, trust, dates)
|
|
66
|
+
- Filter by `space_id` (not `user_id`)
|
|
67
|
+
- Use same filter building logic as search_memory
|
|
68
|
+
- Handle pagination with offset/limit
|
|
69
|
+
- Return results with scores
|
|
70
|
+
|
|
71
|
+
**Expected Outcome**: Search working correctly
|
|
72
|
+
|
|
73
|
+
### 5. Format Search Results
|
|
74
|
+
|
|
75
|
+
Format results for agent consumption.
|
|
76
|
+
|
|
77
|
+
**Actions**:
|
|
78
|
+
- Extract memory properties
|
|
79
|
+
- Include relevance scores
|
|
80
|
+
- Format as array of SpaceMemory objects
|
|
81
|
+
- Include metadata (total results, offset, limit)
|
|
82
|
+
- Format as JSON string
|
|
83
|
+
|
|
84
|
+
**Expected Outcome**: Clear result format
|
|
85
|
+
|
|
86
|
+
### 6. Implement Error Handling
|
|
87
|
+
|
|
88
|
+
Handle error cases.
|
|
89
|
+
|
|
90
|
+
**Actions**:
|
|
91
|
+
- Invalid space ID error
|
|
92
|
+
- Collection not found error
|
|
93
|
+
- Weaviate query errors
|
|
94
|
+
- Use `handleToolError` utility
|
|
95
|
+
- Include context in errors
|
|
96
|
+
|
|
97
|
+
**Expected Outcome**: Error handling complete
|
|
98
|
+
|
|
99
|
+
### 7. Add Tool to Server
|
|
100
|
+
|
|
101
|
+
Register tool in both server files.
|
|
102
|
+
|
|
103
|
+
**Actions**:
|
|
104
|
+
- Import tool in `src/server.ts`
|
|
105
|
+
- Add to tools list
|
|
106
|
+
- Add to call handler
|
|
107
|
+
- Repeat for `src/server-factory.ts`
|
|
108
|
+
|
|
109
|
+
**Expected Outcome**: Tool available in MCP server
|
|
110
|
+
|
|
111
|
+
### 8. Create Unit Tests
|
|
112
|
+
|
|
113
|
+
Test the search_space tool.
|
|
114
|
+
|
|
115
|
+
**Actions**:
|
|
116
|
+
- Create `tests/unit/search-space.test.ts`
|
|
117
|
+
- Test successful search
|
|
118
|
+
- Test with various filters
|
|
119
|
+
- Test pagination
|
|
120
|
+
- Test invalid space ID error
|
|
121
|
+
- Mock Weaviate client
|
|
122
|
+
- Verify result format
|
|
123
|
+
|
|
124
|
+
**Expected Outcome**: All tests passing
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Verification
|
|
129
|
+
|
|
130
|
+
- [ ] `src/tools/search-space.ts` created
|
|
131
|
+
- [ ] Tool schema defined with all parameters
|
|
132
|
+
- [ ] Space collection access working
|
|
133
|
+
- [ ] Hybrid search implemented
|
|
134
|
+
- [ ] Filters working correctly
|
|
135
|
+
- [ ] Results formatted properly
|
|
136
|
+
- [ ] Error handling complete
|
|
137
|
+
- [ ] Tool registered in server.ts
|
|
138
|
+
- [ ] Tool registered in server-factory.ts
|
|
139
|
+
- [ ] Unit tests created and passing
|
|
140
|
+
- [ ] TypeScript compiles without errors
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Tool Schema
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
export const searchSpaceTool = {
|
|
148
|
+
name: 'remember_search_space',
|
|
149
|
+
description: 'Search shared spaces to discover thoughts, ideas, and memories. Works like remember_search_memory but searches shared spaces instead of personal memories.',
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
query: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'Search query (semantic + keyword hybrid)'
|
|
156
|
+
},
|
|
157
|
+
space: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
description: 'Which space to search',
|
|
160
|
+
enum: ['the_void'],
|
|
161
|
+
default: 'the_void'
|
|
162
|
+
},
|
|
163
|
+
// Same filters as remember_search_memory
|
|
164
|
+
content_type: { type: 'string' },
|
|
165
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
166
|
+
min_weight: { type: 'number', minimum: 0, maximum: 1 },
|
|
167
|
+
max_weight: { type: 'number', minimum: 0, maximum: 1 },
|
|
168
|
+
date_from: { type: 'string' },
|
|
169
|
+
date_to: { type: 'string' },
|
|
170
|
+
limit: { type: 'number', default: 10 },
|
|
171
|
+
offset: { type: 'number', default: 0 }
|
|
172
|
+
},
|
|
173
|
+
required: ['query', 'space']
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Related Files
|
|
181
|
+
|
|
182
|
+
- Design: [`agent/design/publish-tools-confirmation-flow.md`](../design/publish-tools-confirmation-flow.md)
|
|
183
|
+
- Search Memory: [`src/tools/search-memory.ts`](../../src/tools/search-memory.ts)
|
|
184
|
+
- Space Schema: [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
**Next Task**: Task 40 - Implement remember_query_space Tool
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Task 40: Implement remember_query_space Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: M10 - Shared Spaces & Confirmation Flow
|
|
4
|
+
**Estimated Time**: 3 hours
|
|
5
|
+
**Dependencies**: Task 35 (Space Types), M2 (Query Memory tool)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Implement `remember_query_space` tool for RAG-optimized natural language queries on shared spaces. Similar to `remember_query_memory` but queries space collections.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Create Tool File
|
|
19
|
+
|
|
20
|
+
Create `src/tools/query-space.ts` based on query-memory.ts.
|
|
21
|
+
|
|
22
|
+
**Actions**:
|
|
23
|
+
- Copy structure from `query-memory.ts`
|
|
24
|
+
- Import space schema utilities
|
|
25
|
+
- Define tool schema
|
|
26
|
+
- Create handler function
|
|
27
|
+
- Export tool definition and handler
|
|
28
|
+
|
|
29
|
+
**Expected Outcome**: Tool file structure created
|
|
30
|
+
|
|
31
|
+
### 2. Define Tool Schema
|
|
32
|
+
|
|
33
|
+
Create MCP tool definition for remember_query_space.
|
|
34
|
+
|
|
35
|
+
**Actions**:
|
|
36
|
+
- Set tool name: `remember_query_space`
|
|
37
|
+
- Write clear description for RAG queries on shared spaces
|
|
38
|
+
- Define input schema with properties:
|
|
39
|
+
- `question` (required): Natural language question
|
|
40
|
+
- `space` (required): Space ID (enum: ['the_void'])
|
|
41
|
+
- All filter options from query_memory
|
|
42
|
+
- `format`: 'detailed' or 'compact'
|
|
43
|
+
- `limit` for result count
|
|
44
|
+
- Set default values
|
|
45
|
+
|
|
46
|
+
**Expected Outcome**: Tool schema complete
|
|
47
|
+
|
|
48
|
+
### 3. Implement Space Collection Access
|
|
49
|
+
|
|
50
|
+
Get the space collection to query.
|
|
51
|
+
|
|
52
|
+
**Actions**:
|
|
53
|
+
- Call `ensureSpaceCollection()` with space_id
|
|
54
|
+
- Get collection reference
|
|
55
|
+
- Handle collection creation if needed
|
|
56
|
+
- Verify collection exists
|
|
57
|
+
|
|
58
|
+
**Expected Outcome**: Space collection accessible
|
|
59
|
+
|
|
60
|
+
### 4. Implement RAG Query
|
|
61
|
+
|
|
62
|
+
Execute semantic query on space collection.
|
|
63
|
+
|
|
64
|
+
**Actions**:
|
|
65
|
+
- Use Weaviate nearText for semantic search
|
|
66
|
+
- Apply all filters (content_type, tags, weight, trust, dates)
|
|
67
|
+
- Filter by `space_id` (not `user_id`)
|
|
68
|
+
- Use same filter building logic as query_memory
|
|
69
|
+
- Return results with relevance scores
|
|
70
|
+
- Limit results appropriately
|
|
71
|
+
|
|
72
|
+
**Expected Outcome**: RAG query working
|
|
73
|
+
|
|
74
|
+
### 5. Format Query Results
|
|
75
|
+
|
|
76
|
+
Format results based on requested format.
|
|
77
|
+
|
|
78
|
+
**Actions**:
|
|
79
|
+
- **Detailed format**: Full SpaceMemory objects with all fields
|
|
80
|
+
- **Compact format**: Text summary optimized for LLM context
|
|
81
|
+
- Include relevance scores
|
|
82
|
+
- Include metadata (question, space, result count)
|
|
83
|
+
- Format as JSON string
|
|
84
|
+
|
|
85
|
+
**Expected Outcome**: Both formats working
|
|
86
|
+
|
|
87
|
+
### 6. Implement Error Handling
|
|
88
|
+
|
|
89
|
+
Handle error cases.
|
|
90
|
+
|
|
91
|
+
**Actions**:
|
|
92
|
+
- Invalid space ID error
|
|
93
|
+
- Collection not found error
|
|
94
|
+
- Weaviate query errors
|
|
95
|
+
- Use `handleToolError` utility
|
|
96
|
+
- Include context in errors
|
|
97
|
+
|
|
98
|
+
**Expected Outcome**: Error handling complete
|
|
99
|
+
|
|
100
|
+
### 7. Add Tool to Server
|
|
101
|
+
|
|
102
|
+
Register tool in both server files.
|
|
103
|
+
|
|
104
|
+
**Actions**:
|
|
105
|
+
- Import tool in `src/server.ts`
|
|
106
|
+
- Add to tools list
|
|
107
|
+
- Add to call handler
|
|
108
|
+
- Repeat for `src/server-factory.ts`
|
|
109
|
+
|
|
110
|
+
**Expected Outcome**: Tool available in MCP server
|
|
111
|
+
|
|
112
|
+
### 8. Create Unit Tests
|
|
113
|
+
|
|
114
|
+
Test the query_space tool.
|
|
115
|
+
|
|
116
|
+
**Actions**:
|
|
117
|
+
- Create `tests/unit/query-space.test.ts`
|
|
118
|
+
- Test successful query (detailed format)
|
|
119
|
+
- Test successful query (compact format)
|
|
120
|
+
- Test with various filters
|
|
121
|
+
- Test invalid space ID error
|
|
122
|
+
- Mock Weaviate client
|
|
123
|
+
- Verify result formats
|
|
124
|
+
|
|
125
|
+
**Expected Outcome**: All tests passing
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Verification
|
|
130
|
+
|
|
131
|
+
- [ ] `src/tools/query-space.ts` created
|
|
132
|
+
- [ ] Tool schema defined with all parameters
|
|
133
|
+
- [ ] Space collection access working
|
|
134
|
+
- [ ] RAG query implemented
|
|
135
|
+
- [ ] Filters working correctly
|
|
136
|
+
- [ ] Detailed format working
|
|
137
|
+
- [ ] Compact format working
|
|
138
|
+
- [ ] Error handling complete
|
|
139
|
+
- [ ] Tool registered in server.ts
|
|
140
|
+
- [ ] Tool registered in server-factory.ts
|
|
141
|
+
- [ ] Unit tests created and passing
|
|
142
|
+
- [ ] TypeScript compiles without errors
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Tool Schema
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
export const querySpaceTool = {
|
|
150
|
+
name: 'remember_query_space',
|
|
151
|
+
description: 'Ask natural language questions about memories in shared spaces. Works like remember_query_memory but queries shared spaces.',
|
|
152
|
+
inputSchema: {
|
|
153
|
+
type: 'object',
|
|
154
|
+
properties: {
|
|
155
|
+
question: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
description: 'Natural language question'
|
|
158
|
+
},
|
|
159
|
+
space: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
description: 'Which space to query',
|
|
162
|
+
enum: ['the_void'],
|
|
163
|
+
default: 'the_void'
|
|
164
|
+
},
|
|
165
|
+
// Same filters as remember_query_memory
|
|
166
|
+
content_type: { type: 'string' },
|
|
167
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
168
|
+
min_weight: { type: 'number', minimum: 0, maximum: 1 },
|
|
169
|
+
date_from: { type: 'string' },
|
|
170
|
+
date_to: { type: 'string' },
|
|
171
|
+
limit: { type: 'number', default: 10 },
|
|
172
|
+
format: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
enum: ['detailed', 'compact'],
|
|
175
|
+
default: 'detailed'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
required: ['question', 'space']
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Related Files
|
|
186
|
+
|
|
187
|
+
- Design: [`agent/design/publish-tools-confirmation-flow.md`](../design/publish-tools-confirmation-flow.md)
|
|
188
|
+
- Query Memory: [`src/tools/query-memory.ts`](../../src/tools/query-memory.ts)
|
|
189
|
+
- Space Schema: [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
**Next Task**: Task 41 - Configure Firestore TTL Policy
|