sqlew 1.1.1 → 2.0.0
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/CHANGELOG.md +90 -0
- package/MIGRATION_v2.md +538 -0
- package/README.md +136 -75
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +4 -0
- package/dist/database.js.map +1 -1
- package/dist/index.js +265 -693
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +8 -6
- package/dist/schema.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,94 @@ All notable changes to sqlew will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.0.0] - 2025-10-11
|
|
9
|
+
|
|
10
|
+
### 🚨 BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
**This is a major release with breaking API changes. Migration required for all v1.x users.**
|
|
13
|
+
|
|
14
|
+
#### Tool Consolidation
|
|
15
|
+
- **20 individual tools** → **6 action-based tools** (70% reduction)
|
|
16
|
+
- All tools now use action-based routing with `action` parameter
|
|
17
|
+
- Tool names completely changed (see migration guide below)
|
|
18
|
+
|
|
19
|
+
#### Old vs New Tool Names
|
|
20
|
+
|
|
21
|
+
| Old (v1.x) | New (v2.0) | Actions |
|
|
22
|
+
|------------|------------|---------|
|
|
23
|
+
| `set_decision`, `get_decision`, `get_context`, `search_by_tags`, `search_by_layer`, `get_versions` | `decision` | `set`, `get`, `list`, `search_tags`, `search_layer`, `versions`, `help` |
|
|
24
|
+
| `send_message`, `get_messages`, `mark_read` | `message` | `send`, `get`, `mark_read`, `help` |
|
|
25
|
+
| `record_file_change`, `get_file_changes`, `check_file_lock` | `file` | `record`, `get`, `check_lock`, `help` |
|
|
26
|
+
| `add_constraint`, `get_constraints`, `deactivate_constraint` | `constraint` | `add`, `get`, `deactivate`, `help` |
|
|
27
|
+
| `get_layer_summary`, `get_stats`, `clear_old_data` | `stats` | `layer_summary`, `db_stats`, `clear`, `help` |
|
|
28
|
+
| `get_config`, `update_config` | `config` | `get`, `update`, `help` |
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **Help Actions:** All 6 tools now support `action: "help"` for comprehensive on-demand documentation
|
|
33
|
+
- Returns detailed usage, parameters, and examples
|
|
34
|
+
- Zero token cost until explicitly called
|
|
35
|
+
- **Action Hints:** Tool descriptions now include available actions for better discoverability
|
|
36
|
+
- **Improved Token Efficiency:** 96% token reduction vs traditional JSON approach
|
|
37
|
+
- Tool definition tokens: ~12,848 → ~481 tokens (96.3% reduction)
|
|
38
|
+
- MCP context usage: ~13,730 → ~4,482 tokens (67% reduction)
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **API Surface:** Complete redesign to action-based routing
|
|
43
|
+
- All tools require `action` parameter
|
|
44
|
+
- Parameters consolidated into single input schema per tool
|
|
45
|
+
- Nested switch statement routing for better maintainability
|
|
46
|
+
- **Tool Descriptions:** Simplified with action hints in parentheses
|
|
47
|
+
- **File Size:** Source reduced 27.4% (25,373 → 18,410 bytes) while adding help docs
|
|
48
|
+
|
|
49
|
+
### Technical Details
|
|
50
|
+
|
|
51
|
+
- Action-based routing with two-level switch statements
|
|
52
|
+
- Shared parameter schemas across actions within each tool
|
|
53
|
+
- Enum deduplication (layer, status, priority defined once per tool)
|
|
54
|
+
- On-demand documentation via help actions
|
|
55
|
+
- 100% backward compatible database schema (no DB changes)
|
|
56
|
+
|
|
57
|
+
### Migration Required
|
|
58
|
+
|
|
59
|
+
**v1.x users must update their tool calls:**
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// OLD (v1.x)
|
|
63
|
+
await callTool('set_decision', { key: 'auth', value: 'jwt' });
|
|
64
|
+
await callTool('get_messages', { unread_only: true });
|
|
65
|
+
|
|
66
|
+
// NEW (v2.0)
|
|
67
|
+
await callTool('decision', { action: 'set', key: 'auth', value: 'jwt' });
|
|
68
|
+
await callTool('message', { action: 'get', unread_only: true });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
See `MIGRATION_v2.md` for complete migration guide.
|
|
72
|
+
|
|
73
|
+
### Performance
|
|
74
|
+
|
|
75
|
+
- 96% token reduction in tool definitions
|
|
76
|
+
- 67% reduction in MCP context consumption
|
|
77
|
+
- Same database performance (no schema changes)
|
|
78
|
+
- Same query response times
|
|
79
|
+
|
|
80
|
+
## [1.1.2] - 2025-10-11
|
|
81
|
+
|
|
82
|
+
### Fixed
|
|
83
|
+
- **Schema Validation Bug:** Fixed validation checking for old unprefixed table names instead of new prefixed names
|
|
84
|
+
- Updated `requiredTables` to check for `m_*` and `t_*` prefixed names
|
|
85
|
+
- Updated `requiredViews` to check for `v_*` prefixed names
|
|
86
|
+
- Updated `requiredTriggers` to check for `trg_*` prefixed names
|
|
87
|
+
- **Migration Missing Views/Triggers:** After migration, views and triggers are now created automatically
|
|
88
|
+
- Added `initializeSchema()` call after successful migration
|
|
89
|
+
- Ensures v1.0.0 → v1.1.x migration creates all required database objects
|
|
90
|
+
|
|
91
|
+
### Technical Details
|
|
92
|
+
- Migration now runs schema initialization after table renaming to create views/triggers
|
|
93
|
+
- Schema validation properly detects v1.1.x databases with prefixed names
|
|
94
|
+
- Full backward compatibility maintained with v1.0.0 databases
|
|
95
|
+
|
|
8
96
|
## [1.1.1] - 2025-10-11
|
|
9
97
|
|
|
10
98
|
### Fixed
|
|
@@ -164,6 +252,8 @@ First production release of sqlew - MCP server for efficient context sharing bet
|
|
|
164
252
|
- Full type safety
|
|
165
253
|
- Comprehensive error handling
|
|
166
254
|
|
|
255
|
+
[2.0.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v2.0.0
|
|
256
|
+
[1.1.2]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.2
|
|
167
257
|
[1.1.1]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.1
|
|
168
258
|
[1.1.0]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.1.0
|
|
169
259
|
[1.0.1]: https://github.com/sin5ddd/mcp-sqlew/releases/tag/v1.0.1
|
package/MIGRATION_v2.md
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
# Migration Guide: v1.x → v2.0.0
|
|
2
|
+
|
|
3
|
+
This guide helps you migrate from sqlew v1.x to v2.0.0. The v2.0 release consolidates 20 individual tools into 6 action-based tools for 96% token reduction.
|
|
4
|
+
|
|
5
|
+
## Breaking Changes Summary
|
|
6
|
+
|
|
7
|
+
### What Changed
|
|
8
|
+
- **Tool Names:** All 20 tool names changed
|
|
9
|
+
- **API Structure:** All tools now use action-based routing with an `action` parameter
|
|
10
|
+
- **Tool Count:** 20 → 6 tools
|
|
11
|
+
|
|
12
|
+
### What Didn't Change
|
|
13
|
+
- **Database Schema:** 100% compatible - no migration needed ✅
|
|
14
|
+
- **Functionality:** All 20 original functions preserved
|
|
15
|
+
- **Parameters:** Same parameter names and types (except `action` is now required)
|
|
16
|
+
- **Return Values:** Identical response structures
|
|
17
|
+
|
|
18
|
+
## Database Compatibility
|
|
19
|
+
|
|
20
|
+
**Good news:** Your v1.x database works with v2.0 without any changes!
|
|
21
|
+
|
|
22
|
+
- ✅ v1.x database → v2.0 server (works immediately)
|
|
23
|
+
- ✅ v2.0 database → v1.x server (if you need to downgrade)
|
|
24
|
+
- ✅ No data migration required
|
|
25
|
+
- ✅ No schema changes
|
|
26
|
+
|
|
27
|
+
The v2.0 consolidation is purely an MCP interface redesign - the database layer is unchanged.
|
|
28
|
+
|
|
29
|
+
## Tool Mapping Reference
|
|
30
|
+
|
|
31
|
+
| v1.x Tool | v2.0 Tool | Action |
|
|
32
|
+
|-----------|-----------|--------|
|
|
33
|
+
| `set_decision` | `decision` | `set` |
|
|
34
|
+
| `get_decision` | `decision` | `get` |
|
|
35
|
+
| `get_context` | `decision` | `list` |
|
|
36
|
+
| `search_by_tags` | `decision` | `search_tags` |
|
|
37
|
+
| `search_by_layer` | `decision` | `search_layer` |
|
|
38
|
+
| `get_versions` | `decision` | `versions` |
|
|
39
|
+
| `send_message` | `message` | `send` |
|
|
40
|
+
| `get_messages` | `message` | `get` |
|
|
41
|
+
| `mark_read` | `message` | `mark_read` |
|
|
42
|
+
| `record_file_change` | `file` | `record` |
|
|
43
|
+
| `get_file_changes` | `file` | `get` |
|
|
44
|
+
| `check_file_lock` | `file` | `check_lock` |
|
|
45
|
+
| `add_constraint` | `constraint` | `add` |
|
|
46
|
+
| `get_constraints` | `constraint` | `get` |
|
|
47
|
+
| `deactivate_constraint` | `constraint` | `deactivate` |
|
|
48
|
+
| `get_layer_summary` | `stats` | `layer_summary` |
|
|
49
|
+
| `get_stats` | `stats` | `db_stats` |
|
|
50
|
+
| `clear_old_data` | `stats` | `clear` |
|
|
51
|
+
| `get_config` | `config` | `get` |
|
|
52
|
+
| `update_config` | `config` | `update` |
|
|
53
|
+
|
|
54
|
+
## Migration Examples
|
|
55
|
+
|
|
56
|
+
### Context Management
|
|
57
|
+
|
|
58
|
+
**v1.x:**
|
|
59
|
+
```typescript
|
|
60
|
+
// Set decision
|
|
61
|
+
await callTool('set_decision', {
|
|
62
|
+
key: 'auth_method',
|
|
63
|
+
value: 'JWT',
|
|
64
|
+
tags: ['security']
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Get decision
|
|
68
|
+
await callTool('get_decision', {
|
|
69
|
+
key: 'auth_method'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Search by tags
|
|
73
|
+
await callTool('search_by_tags', {
|
|
74
|
+
tags: ['security', 'api'],
|
|
75
|
+
match_mode: 'AND'
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**v2.0:**
|
|
80
|
+
```typescript
|
|
81
|
+
// Set decision
|
|
82
|
+
await callTool('decision', {
|
|
83
|
+
action: 'set',
|
|
84
|
+
key: 'auth_method',
|
|
85
|
+
value: 'JWT',
|
|
86
|
+
tags: ['security']
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Get decision
|
|
90
|
+
await callTool('decision', {
|
|
91
|
+
action: 'get',
|
|
92
|
+
key: 'auth_method'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Search by tags
|
|
96
|
+
await callTool('decision', {
|
|
97
|
+
action: 'search_tags',
|
|
98
|
+
tags: ['security', 'api'],
|
|
99
|
+
tag_match: 'AND' // Note: parameter renamed from match_mode
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Messaging
|
|
104
|
+
|
|
105
|
+
**v1.x:**
|
|
106
|
+
```typescript
|
|
107
|
+
// Send message
|
|
108
|
+
await callTool('send_message', {
|
|
109
|
+
from_agent: 'agent1',
|
|
110
|
+
to_agent: 'agent2',
|
|
111
|
+
message: 'Task complete',
|
|
112
|
+
priority: 'high'
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Get messages
|
|
116
|
+
await callTool('get_messages', {
|
|
117
|
+
unread_only: true
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Mark as read
|
|
121
|
+
await callTool('mark_read', {
|
|
122
|
+
message_ids: [1, 2, 3]
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**v2.0:**
|
|
127
|
+
```typescript
|
|
128
|
+
// Send message
|
|
129
|
+
await callTool('message', {
|
|
130
|
+
action: 'send',
|
|
131
|
+
from_agent: 'agent1',
|
|
132
|
+
to_agent: 'agent2',
|
|
133
|
+
message: 'Task complete',
|
|
134
|
+
priority: 'high'
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Get messages
|
|
138
|
+
await callTool('message', {
|
|
139
|
+
action: 'get',
|
|
140
|
+
unread_only: true
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Mark as read
|
|
144
|
+
await callTool('message', {
|
|
145
|
+
action: 'mark_read',
|
|
146
|
+
message_ids: [1, 2, 3]
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### File Tracking
|
|
151
|
+
|
|
152
|
+
**v1.x:**
|
|
153
|
+
```typescript
|
|
154
|
+
// Record file change
|
|
155
|
+
await callTool('record_file_change', {
|
|
156
|
+
file_path: '/src/auth.ts',
|
|
157
|
+
agent_name: 'auth-agent',
|
|
158
|
+
change_type: 'modified',
|
|
159
|
+
layer: 'business'
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Get file changes
|
|
163
|
+
await callTool('get_file_changes', {
|
|
164
|
+
since: '2025-01-10T10:00:00Z'
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Check file lock
|
|
168
|
+
await callTool('check_file_lock', {
|
|
169
|
+
file_path: '/src/auth.ts'
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**v2.0:**
|
|
174
|
+
```typescript
|
|
175
|
+
// Record file change
|
|
176
|
+
await callTool('file', {
|
|
177
|
+
action: 'record',
|
|
178
|
+
file_path: '/src/auth.ts',
|
|
179
|
+
agent_name: 'auth-agent',
|
|
180
|
+
change_type: 'modified',
|
|
181
|
+
layer: 'business'
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Get file changes
|
|
185
|
+
await callTool('file', {
|
|
186
|
+
action: 'get',
|
|
187
|
+
since: '2025-01-10T10:00:00Z'
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Check file lock
|
|
191
|
+
await callTool('file', {
|
|
192
|
+
action: 'check_lock',
|
|
193
|
+
file_path: '/src/auth.ts'
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Constraints
|
|
198
|
+
|
|
199
|
+
**v1.x:**
|
|
200
|
+
```typescript
|
|
201
|
+
// Add constraint
|
|
202
|
+
await callTool('add_constraint', {
|
|
203
|
+
category: 'performance',
|
|
204
|
+
constraint_text: 'Response time < 200ms',
|
|
205
|
+
priority: 'high'
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Get constraints
|
|
209
|
+
await callTool('get_constraints', {
|
|
210
|
+
category: 'performance'
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Deactivate constraint
|
|
214
|
+
await callTool('deactivate_constraint', {
|
|
215
|
+
constraint_id: 42
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**v2.0:**
|
|
220
|
+
```typescript
|
|
221
|
+
// Add constraint
|
|
222
|
+
await callTool('constraint', {
|
|
223
|
+
action: 'add',
|
|
224
|
+
category: 'performance',
|
|
225
|
+
constraint_text: 'Response time < 200ms',
|
|
226
|
+
priority: 'high'
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Get constraints
|
|
230
|
+
await callTool('constraint', {
|
|
231
|
+
action: 'get',
|
|
232
|
+
category: 'performance'
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Deactivate constraint
|
|
236
|
+
await callTool('constraint', {
|
|
237
|
+
action: 'deactivate',
|
|
238
|
+
constraint_id: 42
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Utilities
|
|
243
|
+
|
|
244
|
+
**v1.x:**
|
|
245
|
+
```typescript
|
|
246
|
+
// Layer summary
|
|
247
|
+
await callTool('get_layer_summary');
|
|
248
|
+
|
|
249
|
+
// Database stats
|
|
250
|
+
await callTool('get_stats');
|
|
251
|
+
|
|
252
|
+
// Clear old data
|
|
253
|
+
await callTool('clear_old_data', {
|
|
254
|
+
messages_older_than_hours: 48
|
|
255
|
+
});
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**v2.0:**
|
|
259
|
+
```typescript
|
|
260
|
+
// Layer summary
|
|
261
|
+
await callTool('stats', {
|
|
262
|
+
action: 'layer_summary'
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Database stats
|
|
266
|
+
await callTool('stats', {
|
|
267
|
+
action: 'db_stats'
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Clear old data
|
|
271
|
+
await callTool('stats', {
|
|
272
|
+
action: 'clear',
|
|
273
|
+
messages_older_than_hours: 48
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Configuration
|
|
278
|
+
|
|
279
|
+
**v1.x:**
|
|
280
|
+
```typescript
|
|
281
|
+
// Get config
|
|
282
|
+
await callTool('get_config');
|
|
283
|
+
|
|
284
|
+
// Update config
|
|
285
|
+
await callTool('update_config', {
|
|
286
|
+
ignoreWeekend: true,
|
|
287
|
+
messageRetentionHours: 48
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**v2.0:**
|
|
292
|
+
```typescript
|
|
293
|
+
// Get config
|
|
294
|
+
await callTool('config', {
|
|
295
|
+
action: 'get'
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Update config
|
|
299
|
+
await callTool('config', {
|
|
300
|
+
action: 'update',
|
|
301
|
+
ignoreWeekend: true,
|
|
302
|
+
messageRetentionHours: 48
|
|
303
|
+
});
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## New Feature: Help Actions
|
|
307
|
+
|
|
308
|
+
v2.0 adds `action: "help"` to all tools for on-demand comprehensive documentation:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// Get help for any tool
|
|
312
|
+
await callTool('decision', { action: 'help' });
|
|
313
|
+
await callTool('message', { action: 'help' });
|
|
314
|
+
await callTool('file', { action: 'help' });
|
|
315
|
+
await callTool('constraint', { action: 'help' });
|
|
316
|
+
await callTool('stats', { action: 'help' });
|
|
317
|
+
await callTool('config', { action: 'help' });
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Each help action returns:
|
|
321
|
+
- Tool description
|
|
322
|
+
- Complete action list with parameters
|
|
323
|
+
- Usage examples
|
|
324
|
+
- Parameter requirements
|
|
325
|
+
|
|
326
|
+
**Zero token cost** until explicitly called!
|
|
327
|
+
|
|
328
|
+
## Migration Checklist
|
|
329
|
+
|
|
330
|
+
### 1. Update Package
|
|
331
|
+
```bash
|
|
332
|
+
npm install sqlew@2.0.0
|
|
333
|
+
# or
|
|
334
|
+
npm update sqlew
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 2. Update Tool Calls
|
|
338
|
+
|
|
339
|
+
Search your codebase for v1.x tool calls:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Find all v1.x tool calls
|
|
343
|
+
grep -r "set_decision\|get_decision\|get_context\|search_by_tags" .
|
|
344
|
+
grep -r "send_message\|get_messages\|mark_read" .
|
|
345
|
+
grep -r "record_file_change\|get_file_changes\|check_file_lock" .
|
|
346
|
+
grep -r "add_constraint\|get_constraints\|deactivate_constraint" .
|
|
347
|
+
grep -r "get_layer_summary\|get_stats\|clear_old_data" .
|
|
348
|
+
grep -r "get_config\|update_config" .
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Replace each with v2.0 equivalent using the mapping table above.
|
|
352
|
+
|
|
353
|
+
### 3. Test Your Changes
|
|
354
|
+
|
|
355
|
+
Use MCP Inspector to verify tool calls:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
npx @modelcontextprotocol/inspector npx sqlew
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Test each migrated tool call to ensure:
|
|
362
|
+
- ✅ Correct tool name
|
|
363
|
+
- ✅ `action` parameter included
|
|
364
|
+
- ✅ All other parameters unchanged
|
|
365
|
+
- ✅ Response structure matches expectations
|
|
366
|
+
|
|
367
|
+
### 4. Verify Database Works
|
|
368
|
+
|
|
369
|
+
Your existing database should work immediately with v2.0:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Start v2.0 server with your existing database
|
|
373
|
+
npx sqlew /path/to/your/existing/v1.db
|
|
374
|
+
|
|
375
|
+
# Test a few operations
|
|
376
|
+
# Your data should be intact
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Parameter Changes
|
|
380
|
+
|
|
381
|
+
### search_by_tags
|
|
382
|
+
|
|
383
|
+
**v1.x:** `match_mode` parameter
|
|
384
|
+
**v2.0:** `tag_match` parameter
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
// v1.x
|
|
388
|
+
search_by_tags({ tags: ['api'], match_mode: 'AND' })
|
|
389
|
+
|
|
390
|
+
// v2.0
|
|
391
|
+
decision({ action: 'search_tags', tags: ['api'], tag_match: 'AND' })
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
All other parameters remain unchanged.
|
|
395
|
+
|
|
396
|
+
## Common Pitfalls
|
|
397
|
+
|
|
398
|
+
### ❌ Forgetting `action` Parameter
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
// WRONG - will fail
|
|
402
|
+
await callTool('decision', { key: 'auth_method' });
|
|
403
|
+
|
|
404
|
+
// CORRECT
|
|
405
|
+
await callTool('decision', { action: 'get', key: 'auth_method' });
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### ❌ Using Old Tool Names
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
// WRONG - tool doesn't exist
|
|
412
|
+
await callTool('set_decision', { action: 'set', key: 'auth' });
|
|
413
|
+
|
|
414
|
+
// CORRECT
|
|
415
|
+
await callTool('decision', { action: 'set', key: 'auth' });
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### ❌ Wrong Action Name
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
// WRONG - action doesn't exist
|
|
422
|
+
await callTool('decision', { action: 'search_tags', match_mode: 'AND' });
|
|
423
|
+
|
|
424
|
+
// CORRECT - parameter also renamed
|
|
425
|
+
await callTool('decision', { action: 'search_tags', tag_match: 'AND' });
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
## Rollback Plan
|
|
429
|
+
|
|
430
|
+
If you need to rollback to v1.x:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Downgrade package
|
|
434
|
+
npm install sqlew@1.1.2
|
|
435
|
+
|
|
436
|
+
# Your database will continue to work
|
|
437
|
+
# No schema migration needed
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Your v2.0 database is 100% compatible with v1.x servers.
|
|
441
|
+
|
|
442
|
+
## Benefits of v2.0
|
|
443
|
+
|
|
444
|
+
After migration, you'll enjoy:
|
|
445
|
+
|
|
446
|
+
- **96% Token Reduction:** Tool definitions use 481 tokens instead of 12,848
|
|
447
|
+
- **67% MCP Context Reduction:** From ~13,730 to ~4,482 tokens
|
|
448
|
+
- **On-Demand Help:** Use `action: "help"` for comprehensive documentation
|
|
449
|
+
- **Same Functionality:** All 20 original functions preserved
|
|
450
|
+
- **Better Organization:** Related operations grouped into single tools
|
|
451
|
+
|
|
452
|
+
## Support
|
|
453
|
+
|
|
454
|
+
Need help with migration?
|
|
455
|
+
|
|
456
|
+
- **Issues:** [GitHub Issues](https://github.com/sin5ddd/mcp-sqlew/issues)
|
|
457
|
+
- **Changelog:** See [CHANGELOG.md](CHANGELOG.md) for complete v2.0 details
|
|
458
|
+
- **Documentation:** Updated [README.md](README.md) with v2.0 examples
|
|
459
|
+
|
|
460
|
+
## Example: Complete Migration
|
|
461
|
+
|
|
462
|
+
Here's a complete before/after example showing typical usage:
|
|
463
|
+
|
|
464
|
+
### Before (v1.x)
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
// Set up authentication decision
|
|
468
|
+
await callTool('set_decision', {
|
|
469
|
+
key: 'auth_method',
|
|
470
|
+
value: 'JWT',
|
|
471
|
+
tags: ['security', 'api'],
|
|
472
|
+
layer: 'business'
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
// Send notification
|
|
476
|
+
await callTool('send_message', {
|
|
477
|
+
from_agent: 'auth-agent',
|
|
478
|
+
to_agent: 'api-agent',
|
|
479
|
+
message: 'Auth configured',
|
|
480
|
+
priority: 'high'
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// Track file change
|
|
484
|
+
await callTool('record_file_change', {
|
|
485
|
+
file_path: '/src/auth.ts',
|
|
486
|
+
agent_name: 'auth-agent',
|
|
487
|
+
change_type: 'created',
|
|
488
|
+
layer: 'business'
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// Add constraint
|
|
492
|
+
await callTool('add_constraint', {
|
|
493
|
+
category: 'security',
|
|
494
|
+
constraint_text: 'Use JWT with RS256',
|
|
495
|
+
priority: 'critical'
|
|
496
|
+
});
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### After (v2.0)
|
|
500
|
+
|
|
501
|
+
```typescript
|
|
502
|
+
// Set up authentication decision
|
|
503
|
+
await callTool('decision', {
|
|
504
|
+
action: 'set',
|
|
505
|
+
key: 'auth_method',
|
|
506
|
+
value: 'JWT',
|
|
507
|
+
tags: ['security', 'api'],
|
|
508
|
+
layer: 'business'
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// Send notification
|
|
512
|
+
await callTool('message', {
|
|
513
|
+
action: 'send',
|
|
514
|
+
from_agent: 'auth-agent',
|
|
515
|
+
to_agent: 'api-agent',
|
|
516
|
+
message: 'Auth configured',
|
|
517
|
+
priority: 'high'
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Track file change
|
|
521
|
+
await callTool('file', {
|
|
522
|
+
action: 'record',
|
|
523
|
+
file_path: '/src/auth.ts',
|
|
524
|
+
agent_name: 'auth-agent',
|
|
525
|
+
change_type: 'created',
|
|
526
|
+
layer: 'business'
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
// Add constraint
|
|
530
|
+
await callTool('constraint', {
|
|
531
|
+
action: 'add',
|
|
532
|
+
category: 'security',
|
|
533
|
+
constraint_text: 'Use JWT with RS256',
|
|
534
|
+
priority: 'critical'
|
|
535
|
+
});
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
Only changes: tool names and added `action` parameters. All other parameters identical!
|