@vibescope/mcp-server 0.4.9 → 0.5.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.
Files changed (159) hide show
  1. package/CHANGELOG.md +84 -84
  2. package/README.md +194 -194
  3. package/dist/api-client/tasks.d.ts +1 -0
  4. package/dist/cli-init.js +21 -21
  5. package/dist/cli.js +26 -26
  6. package/dist/handlers/tasks.js +7 -1
  7. package/dist/handlers/tool-docs.js +1216 -1216
  8. package/dist/index.js +73 -73
  9. package/dist/templates/agent-guidelines.d.ts +1 -1
  10. package/dist/templates/agent-guidelines.js +205 -205
  11. package/dist/templates/help-content.js +1621 -1621
  12. package/dist/tools/bodies-of-work.js +6 -6
  13. package/dist/tools/cloud-agents.js +22 -22
  14. package/dist/tools/milestones.js +2 -2
  15. package/dist/tools/requests.js +1 -1
  16. package/dist/tools/session.js +11 -11
  17. package/dist/tools/sprints.js +9 -9
  18. package/dist/tools/tasks.js +43 -35
  19. package/dist/tools/worktrees.js +14 -14
  20. package/dist/utils.js +11 -11
  21. package/docs/TOOLS.md +2687 -2685
  22. package/package.json +53 -53
  23. package/scripts/generate-docs.ts +212 -212
  24. package/scripts/version-bump.ts +203 -203
  25. package/src/api-client/blockers.ts +86 -86
  26. package/src/api-client/bodies-of-work.ts +194 -194
  27. package/src/api-client/chat.ts +50 -50
  28. package/src/api-client/connectors.ts +152 -152
  29. package/src/api-client/cost.ts +185 -185
  30. package/src/api-client/decisions.ts +87 -87
  31. package/src/api-client/deployment.ts +313 -313
  32. package/src/api-client/discovery.ts +81 -81
  33. package/src/api-client/fallback.ts +52 -52
  34. package/src/api-client/file-checkouts.ts +115 -115
  35. package/src/api-client/findings.ts +100 -100
  36. package/src/api-client/git-issues.ts +88 -88
  37. package/src/api-client/ideas.ts +112 -112
  38. package/src/api-client/index.ts +592 -592
  39. package/src/api-client/milestones.ts +83 -83
  40. package/src/api-client/organizations.ts +185 -185
  41. package/src/api-client/progress.ts +94 -94
  42. package/src/api-client/project.ts +181 -181
  43. package/src/api-client/requests.ts +54 -54
  44. package/src/api-client/session.ts +220 -220
  45. package/src/api-client/sprints.ts +227 -227
  46. package/src/api-client/subtasks.ts +57 -57
  47. package/src/api-client/tasks.ts +451 -450
  48. package/src/api-client/types.ts +32 -32
  49. package/src/api-client/validation.ts +60 -60
  50. package/src/api-client/worktrees.ts +53 -53
  51. package/src/api-client.test.ts +847 -847
  52. package/src/api-client.ts +2728 -2728
  53. package/src/cli-init.ts +558 -558
  54. package/src/cli.test.ts +284 -284
  55. package/src/cli.ts +204 -204
  56. package/src/handlers/__test-setup__.ts +240 -240
  57. package/src/handlers/__test-utils__.ts +89 -89
  58. package/src/handlers/blockers.test.ts +468 -468
  59. package/src/handlers/blockers.ts +172 -172
  60. package/src/handlers/bodies-of-work.test.ts +704 -704
  61. package/src/handlers/bodies-of-work.ts +526 -526
  62. package/src/handlers/chat.test.ts +185 -185
  63. package/src/handlers/chat.ts +101 -101
  64. package/src/handlers/cloud-agents.test.ts +438 -438
  65. package/src/handlers/cloud-agents.ts +156 -156
  66. package/src/handlers/connectors.test.ts +834 -834
  67. package/src/handlers/connectors.ts +229 -229
  68. package/src/handlers/cost.test.ts +462 -462
  69. package/src/handlers/cost.ts +285 -285
  70. package/src/handlers/decisions.test.ts +382 -382
  71. package/src/handlers/decisions.ts +153 -153
  72. package/src/handlers/deployment.test.ts +551 -551
  73. package/src/handlers/deployment.ts +570 -570
  74. package/src/handlers/discovery.test.ts +206 -206
  75. package/src/handlers/discovery.ts +433 -433
  76. package/src/handlers/fallback.test.ts +537 -537
  77. package/src/handlers/fallback.ts +194 -194
  78. package/src/handlers/file-checkouts.test.ts +750 -750
  79. package/src/handlers/file-checkouts.ts +185 -185
  80. package/src/handlers/findings.test.ts +633 -633
  81. package/src/handlers/findings.ts +239 -239
  82. package/src/handlers/git-issues.test.ts +631 -631
  83. package/src/handlers/git-issues.ts +136 -136
  84. package/src/handlers/ideas.test.ts +644 -644
  85. package/src/handlers/ideas.ts +207 -207
  86. package/src/handlers/index.ts +93 -93
  87. package/src/handlers/milestones.test.ts +475 -475
  88. package/src/handlers/milestones.ts +180 -180
  89. package/src/handlers/organizations.test.ts +826 -826
  90. package/src/handlers/organizations.ts +315 -315
  91. package/src/handlers/progress.test.ts +269 -269
  92. package/src/handlers/progress.ts +77 -77
  93. package/src/handlers/project.test.ts +546 -546
  94. package/src/handlers/project.ts +245 -245
  95. package/src/handlers/requests.test.ts +303 -303
  96. package/src/handlers/requests.ts +99 -99
  97. package/src/handlers/roles.test.ts +305 -305
  98. package/src/handlers/roles.ts +219 -219
  99. package/src/handlers/session.test.ts +998 -998
  100. package/src/handlers/session.ts +1105 -1105
  101. package/src/handlers/sprints.test.ts +732 -732
  102. package/src/handlers/sprints.ts +537 -537
  103. package/src/handlers/tasks.test.ts +931 -931
  104. package/src/handlers/tasks.ts +1144 -1137
  105. package/src/handlers/tool-categories.test.ts +66 -66
  106. package/src/handlers/tool-docs.test.ts +511 -511
  107. package/src/handlers/tool-docs.ts +1595 -1595
  108. package/src/handlers/types.test.ts +259 -259
  109. package/src/handlers/types.ts +176 -176
  110. package/src/handlers/validation.test.ts +582 -582
  111. package/src/handlers/validation.ts +164 -164
  112. package/src/handlers/version.ts +63 -63
  113. package/src/index.test.ts +674 -674
  114. package/src/index.ts +884 -884
  115. package/src/setup.test.ts +243 -243
  116. package/src/setup.ts +410 -410
  117. package/src/templates/agent-guidelines.ts +233 -233
  118. package/src/templates/help-content.ts +1751 -1751
  119. package/src/token-tracking.test.ts +463 -463
  120. package/src/token-tracking.ts +167 -167
  121. package/src/tools/blockers.ts +122 -122
  122. package/src/tools/bodies-of-work.ts +283 -283
  123. package/src/tools/chat.ts +72 -72
  124. package/src/tools/cloud-agents.ts +101 -101
  125. package/src/tools/connectors.ts +191 -191
  126. package/src/tools/cost.ts +111 -111
  127. package/src/tools/decisions.ts +111 -111
  128. package/src/tools/deployment.ts +455 -455
  129. package/src/tools/discovery.ts +76 -76
  130. package/src/tools/fallback.ts +111 -111
  131. package/src/tools/features.ts +154 -154
  132. package/src/tools/file-checkouts.ts +145 -145
  133. package/src/tools/findings.ts +101 -101
  134. package/src/tools/git-issues.ts +130 -130
  135. package/src/tools/ideas.ts +162 -162
  136. package/src/tools/index.ts +145 -145
  137. package/src/tools/milestones.ts +118 -118
  138. package/src/tools/organizations.ts +224 -224
  139. package/src/tools/persona-templates.ts +25 -25
  140. package/src/tools/progress.ts +73 -73
  141. package/src/tools/project.ts +210 -210
  142. package/src/tools/requests.ts +68 -68
  143. package/src/tools/roles.ts +112 -112
  144. package/src/tools/session.ts +181 -181
  145. package/src/tools/sprints.ts +298 -298
  146. package/src/tools/tasks.ts +583 -575
  147. package/src/tools/tools.test.ts +222 -222
  148. package/src/tools/types.ts +9 -9
  149. package/src/tools/validation.ts +75 -75
  150. package/src/tools/version.ts +34 -34
  151. package/src/tools/worktrees.ts +66 -66
  152. package/src/tools.test.ts +416 -416
  153. package/src/utils.test.ts +1014 -1014
  154. package/src/utils.ts +586 -586
  155. package/src/validators.test.ts +223 -223
  156. package/src/validators.ts +249 -249
  157. package/src/version.ts +162 -162
  158. package/tsconfig.json +16 -16
  159. package/vitest.config.ts +14 -14
@@ -1,575 +1,583 @@
1
- /**
2
- * Task Tool Definitions
3
- *
4
- * Tools for task CRUD and management:
5
- * - get_task
6
- * - search_tasks
7
- * - get_tasks_by_priority
8
- * - get_recent_tasks
9
- * - get_task_stats
10
- * - get_next_task
11
- * - add_task
12
- * - update_task
13
- * - complete_task
14
- * - delete_task
15
- * - cancel_task
16
- * - release_task
17
- * - add_task_reference
18
- * - remove_task_reference
19
- * - batch_update_tasks
20
- * - batch_complete_tasks
21
- * - add_subtask
22
- * - get_subtasks
23
- * - get_stale_worktrees
24
- * - clear_worktree_path
25
- */
26
-
27
- import type { Tool } from './types.js';
28
-
29
- export const taskTools: Tool[] = [
30
- {
31
- name: 'get_task',
32
- description: `Get a single task by ID with optional subtasks and milestones.`,
33
- inputSchema: {
34
- type: 'object',
35
- properties: {
36
- task_id: {
37
- type: 'string',
38
- description: 'Task UUID',
39
- },
40
- include_subtasks: {
41
- type: 'boolean',
42
- description: 'Include subtasks array (default: false)',
43
- },
44
- include_milestones: {
45
- type: 'boolean',
46
- description: 'Include milestones array (default: false)',
47
- },
48
- },
49
- required: ['task_id'],
50
- },
51
- },
52
- {
53
- name: 'search_tasks',
54
- description: `Search tasks by text query. Supports pagination with offset. Use for finding specific tasks by title or description.`,
55
- inputSchema: {
56
- type: 'object',
57
- properties: {
58
- project_id: {
59
- type: 'string',
60
- description: 'Project UUID',
61
- },
62
- query: {
63
- type: 'string',
64
- description: 'Search query (min 2 chars). Searches title and description.',
65
- },
66
- status: {
67
- type: 'array',
68
- items: { type: 'string', enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'] },
69
- description: 'Filter by status (optional, array)',
70
- },
71
- limit: {
72
- type: 'number',
73
- description: 'Max results per page (1-20, default: 10)',
74
- },
75
- offset: {
76
- type: 'number',
77
- description: 'Number of results to skip for pagination (default: 0)',
78
- },
79
- },
80
- required: ['project_id', 'query'],
81
- },
82
- },
83
- {
84
- name: 'get_tasks_by_priority',
85
- description: `Get tasks filtered by priority. Supports pagination with offset. Use for finding high-priority or low-priority tasks.`,
86
- inputSchema: {
87
- type: 'object',
88
- properties: {
89
- project_id: {
90
- type: 'string',
91
- description: 'Project UUID',
92
- },
93
- priority: {
94
- type: 'number',
95
- minimum: 1,
96
- maximum: 5,
97
- description: 'Exact priority to match (1=highest, 5=lowest)',
98
- },
99
- priority_max: {
100
- type: 'number',
101
- minimum: 1,
102
- maximum: 5,
103
- description: 'Max priority (for range, e.g., priority=1, priority_max=2 gets P1 and P2)',
104
- },
105
- status: {
106
- type: 'string',
107
- enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
108
- description: 'Filter by status (default: pending)',
109
- },
110
- limit: {
111
- type: 'number',
112
- description: 'Max results per page (1-20, default: 10)',
113
- },
114
- offset: {
115
- type: 'number',
116
- description: 'Number of results to skip for pagination (default: 0)',
117
- },
118
- },
119
- required: ['project_id'],
120
- },
121
- },
122
- {
123
- name: 'get_recent_tasks',
124
- description: `Get tasks ordered by creation date. Supports pagination with offset. Use to find oldest pending tasks or newest additions.`,
125
- inputSchema: {
126
- type: 'object',
127
- properties: {
128
- project_id: {
129
- type: 'string',
130
- description: 'Project UUID',
131
- },
132
- order: {
133
- type: 'string',
134
- enum: ['newest', 'oldest'],
135
- description: 'Sort order (default: newest)',
136
- },
137
- status: {
138
- type: 'string',
139
- enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
140
- description: 'Filter by status (optional)',
141
- },
142
- limit: {
143
- type: 'number',
144
- description: 'Max results per page (1-20, default: 10)',
145
- },
146
- offset: {
147
- type: 'number',
148
- description: 'Number of results to skip for pagination (default: 0)',
149
- },
150
- },
151
- required: ['project_id'],
152
- },
153
- },
154
- {
155
- name: 'get_task_stats',
156
- description: `Get aggregate task statistics for a project. Returns counts by status and priority, no task data. Most token-efficient way to understand project state.`,
157
- inputSchema: {
158
- type: 'object',
159
- properties: {
160
- project_id: {
161
- type: 'string',
162
- description: 'Project UUID',
163
- },
164
- },
165
- required: ['project_id'],
166
- },
167
- },
168
- {
169
- name: 'get_next_task',
170
- description: `Get highest priority pending task. Start it IMMEDIATELY by calling update_task(task_id, status: "in_progress").
171
-
172
- Do NOT ask the user for permission. Follow the directive in the response.`,
173
- inputSchema: {
174
- type: 'object',
175
- properties: {
176
- project_id: {
177
- type: 'string',
178
- description: 'Project UUID',
179
- },
180
- },
181
- required: ['project_id'],
182
- },
183
- },
184
- {
185
- name: 'add_task',
186
- description: `Add a new task. Priority 1=highest, 5=lowest. Include estimated_minutes. Use blocking=true for deployment finalization tasks that must complete before other work.
187
-
188
- WHEN TO USE: If the user gives you work directly (e.g., "implement feature X", "fix this bug") that isn't already tracked as a task in Vibescope, you MUST create a task first using this tool. This ensures:
189
- - The work is visible on the dashboard
190
- - Progress can be tracked
191
- - Other agents won't duplicate the work
192
- - The human can see what you're working on`,
193
- inputSchema: {
194
- type: 'object',
195
- properties: {
196
- project_id: {
197
- type: 'string',
198
- description: 'Project UUID',
199
- },
200
- title: {
201
- type: 'string',
202
- description: 'Task title',
203
- },
204
- description: {
205
- type: 'string',
206
- description: 'Detailed description',
207
- },
208
- priority: {
209
- type: 'number',
210
- minimum: 1,
211
- maximum: 5,
212
- description: 'Priority 1-5 (1 = highest)',
213
- },
214
- estimated_minutes: {
215
- type: 'number',
216
- minimum: 1,
217
- description: 'Estimated time to complete in minutes',
218
- },
219
- blocking: {
220
- type: 'boolean',
221
- description: 'When true, this task blocks all other work until complete (used for deployment finalization)',
222
- },
223
- model_capability: {
224
- type: 'string',
225
- enum: ['haiku', 'sonnet', 'opus'],
226
- description: 'Recommended model capability: haiku (simple tasks), sonnet (standard), opus (complex reasoning)',
227
- },
228
- assigned_agent_name: {
229
- type: 'string',
230
- description: 'Pre-assign this task to a specific agent by persona name. Only that agent will pick it up via get_next_task.',
231
- },
232
- },
233
- required: ['project_id', 'title'],
234
- },
235
- },
236
- {
237
- name: 'update_task',
238
- description: `Update task status, progress, or details. Include progress_note with progress_percentage.
239
-
240
- CRITICAL - WORKTREE REQUIRED: For projects using github-flow or git-flow, you MUST use a git worktree to isolate your work. This prevents conflicts with other agents working on the same repository.
241
-
242
- When setting status to "in_progress":
243
- 1. Create worktree FIRST: git worktree add ../PROJECT-PERSONA-task-desc -b feature/TASKID-description BASE_BRANCH
244
- 2. cd into the worktree directory
245
- 3. THEN call update_task with git_branch AND worktree_path
246
-
247
- Example: update_task(task_id, status: "in_progress", git_branch: "feature/abc123-add-login", worktree_path: "../MyProject-Edge-add-login")
248
-
249
- For projects without git branching (trunk-based or none), use skip_worktree_requirement: true.`,
250
- inputSchema: {
251
- type: 'object',
252
- properties: {
253
- task_id: {
254
- type: 'string',
255
- description: 'Task UUID',
256
- },
257
- title: { type: 'string', description: 'New task title' },
258
- description: { type: 'string', description: 'New task description' },
259
- priority: {
260
- type: 'number',
261
- minimum: 1,
262
- maximum: 5,
263
- description: 'Task priority (1=highest, 5=lowest)',
264
- },
265
- status: {
266
- type: 'string',
267
- enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
268
- description: 'Task status',
269
- },
270
- progress_percentage: {
271
- type: 'number',
272
- minimum: 0,
273
- maximum: 100,
274
- description: '0-100 completion percentage',
275
- },
276
- progress_note: {
277
- type: 'string',
278
- description: 'Brief note (auto-logged)',
279
- },
280
- estimated_minutes: {
281
- type: 'number',
282
- minimum: 1,
283
- description: 'Revised time estimate',
284
- },
285
- git_branch: {
286
- type: 'string',
287
- description: 'Git branch associated with this task. REQUIRED when status is "in_progress" (unless skip_worktree_requirement is true)',
288
- },
289
- worktree_path: {
290
- type: 'string',
291
- description: 'Git worktree path for this task (e.g., "../project-task-abc123"). Store this for cleanup tracking across sessions.',
292
- },
293
- worktree_hostname: {
294
- type: 'string',
295
- description: 'Machine hostname where worktree was created (os.hostname()). Required with worktree_path to enable machine-aware cleanup.',
296
- },
297
- model_capability: {
298
- type: 'string',
299
- enum: ['haiku', 'sonnet', 'opus'],
300
- description: 'Recommended model capability: haiku (simple tasks), sonnet (standard), opus (complex reasoning)',
301
- },
302
- assigned_agent_name: {
303
- type: ['string', 'null'],
304
- description: 'Pre-assign this task to a specific agent by persona name. Set to null to unassign. Only the assigned agent will pick it up via get_next_task.',
305
- },
306
- skip_worktree_requirement: {
307
- type: 'boolean',
308
- description: 'Skip git_branch requirement for projects without branching workflows (trunk-based or none). Default: false',
309
- },
310
- session_id: {
311
- type: 'string',
312
- description: 'Session ID from start_work_session. Required for cloud agents using mcporter (session context is not preserved between calls). Links the task to your agent on the dashboard.',
313
- },
314
- },
315
- required: ['task_id'],
316
- },
317
- },
318
- {
319
- name: 'complete_task',
320
- description: `Mark task done. Returns next_task which you MUST start immediately without asking the user.
321
-
322
- CRITICAL: Before calling complete_task on branching workflows (github-flow, git-flow):
323
- 1. Create your PR targeting the correct branch (develop for git-flow, main for github-flow)
324
- 2. Call add_task_reference(task_id, pr_url) to link the PR to your task
325
- 3. THEN call complete_task - validators CANNOT approve tasks without a PR reference
326
-
327
- CRITICAL: After calling this tool, you must:
328
- 1. If next_task is returned Start it immediately by calling update_task(task_id, status: "in_progress")
329
- 2. If no next_task → Call get_next_task() or start a fallback_activity
330
- 3. NEVER ask the user "What should I do next?" or "Should I continue?"
331
-
332
- The auto_continue: true flag in the response means you are expected to continue working autonomously.`,
333
- inputSchema: {
334
- type: 'object',
335
- properties: {
336
- task_id: {
337
- type: 'string',
338
- description: 'Task UUID',
339
- },
340
- summary: {
341
- type: 'string',
342
- description: 'Brief summary of what was done. This is stored on the task as completion_summary and displayed when reviewing completed tasks.',
343
- },
344
- session_id: {
345
- type: 'string',
346
- description: 'Session ID from start_work_session. Required for cloud agents using mcporter.',
347
- },
348
- commit_hash: {
349
- type: 'string',
350
- description: 'Git commit hash (7-40 hex chars) of your last commit. Stored on the task for verification.',
351
- },
352
- check_results: {
353
- type: 'array',
354
- description: 'Results of pre-completion checks (required if project has pre_completion_commands configured). Each item: { command, passed, output? }',
355
- items: {
356
- type: 'object',
357
- properties: {
358
- command: { type: 'string', description: 'The command that was run' },
359
- passed: { type: 'boolean', description: 'Whether the command succeeded' },
360
- output: { type: 'string', description: 'First 500 chars of output if failed' },
361
- },
362
- required: ['command', 'passed'],
363
- },
364
- },
365
- },
366
- required: ['task_id'],
367
- },
368
- },
369
- {
370
- name: 'delete_task',
371
- description: `Delete a task.`,
372
- inputSchema: {
373
- type: 'object',
374
- properties: {
375
- task_id: {
376
- type: 'string',
377
- description: 'Task UUID',
378
- },
379
- },
380
- required: ['task_id'],
381
- },
382
- },
383
- {
384
- name: 'cancel_task',
385
- description: `Cancel a task with an optional reason. Use this when a task should be marked as cancelled rather than deleted (e.g., PR was closed, work was superseded). The task remains visible with a cancelled status for historical tracking.`,
386
- inputSchema: {
387
- type: 'object',
388
- properties: {
389
- task_id: {
390
- type: 'string',
391
- description: 'Task UUID',
392
- },
393
- cancelled_reason: {
394
- type: 'string',
395
- description: 'Reason for cancellation',
396
- enum: ['pr_closed', 'superseded', 'user_cancelled', 'validation_failed', 'obsolete', 'blocked'],
397
- },
398
- cancellation_note: {
399
- type: 'string',
400
- description: 'Optional note explaining the cancellation (logged to progress)',
401
- },
402
- },
403
- required: ['task_id'],
404
- },
405
- },
406
- {
407
- name: 'release_task',
408
- description: `Release a claimed task back to pending status. Use when you need to give up a task you've started but cannot complete (e.g., context limits reached, conflicts with other work, user requested different approach). The task becomes available for other agents to claim.`,
409
- inputSchema: {
410
- type: 'object',
411
- properties: {
412
- task_id: {
413
- type: 'string',
414
- description: 'Task UUID',
415
- },
416
- reason: {
417
- type: 'string',
418
- description: 'Optional reason for releasing the task (logged to progress)',
419
- },
420
- },
421
- required: ['task_id'],
422
- },
423
- },
424
- {
425
- name: 'add_task_reference',
426
- description: 'Add a reference URL to a task (docs, PRs, issues).',
427
- inputSchema: {
428
- type: 'object',
429
- properties: {
430
- task_id: {
431
- type: 'string',
432
- description: 'Task UUID',
433
- },
434
- url: {
435
- type: 'string',
436
- description: 'URL to add as reference',
437
- },
438
- label: {
439
- type: 'string',
440
- description: 'Optional label/title for the reference',
441
- },
442
- },
443
- required: ['task_id', 'url'],
444
- },
445
- },
446
- {
447
- name: 'remove_task_reference',
448
- description: `Remove a reference link from a task by URL.`,
449
- inputSchema: {
450
- type: 'object',
451
- properties: {
452
- task_id: {
453
- type: 'string',
454
- description: 'Task UUID',
455
- },
456
- url: {
457
- type: 'string',
458
- description: 'URL of the reference to remove',
459
- },
460
- },
461
- required: ['task_id', 'url'],
462
- },
463
- },
464
- {
465
- name: 'batch_update_tasks',
466
- description: 'Update multiple tasks at once. Include progress_note with progress_percentage.',
467
- inputSchema: {
468
- type: 'object',
469
- properties: {
470
- updates: {
471
- type: 'array',
472
- description: 'Array of task updates to apply',
473
- items: {
474
- type: 'object',
475
- properties: {
476
- task_id: { type: 'string', description: 'Task UUID' },
477
- status: { type: 'string', enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'] },
478
- progress_percentage: { type: 'number', minimum: 0, maximum: 100 },
479
- progress_note: { type: 'string', description: 'Brief note about what was achieved' },
480
- priority: { type: 'number', minimum: 1, maximum: 5 },
481
- },
482
- required: ['task_id'],
483
- },
484
- },
485
- },
486
- required: ['updates'],
487
- },
488
- },
489
- {
490
- name: 'batch_complete_tasks',
491
- description: `Mark multiple tasks as completed at once.`,
492
- inputSchema: {
493
- type: 'object',
494
- properties: {
495
- completions: {
496
- type: 'array',
497
- description: 'Array of task completions',
498
- items: {
499
- type: 'object',
500
- properties: {
501
- task_id: { type: 'string', description: 'Task UUID' },
502
- summary: { type: 'string', description: 'Optional completion summary' },
503
- },
504
- required: ['task_id'],
505
- },
506
- },
507
- },
508
- required: ['completions'],
509
- },
510
- },
511
- {
512
- name: 'add_subtask',
513
- description: `Add a subtask to break down a larger task into smaller workable pieces.
514
- Subtasks can be claimed and worked on independently by any agent.
515
- Subtasks inherit the project from their parent task.
516
- Max depth is 1 (subtasks cannot have their own subtasks).`,
517
- inputSchema: {
518
- type: 'object',
519
- properties: {
520
- parent_task_id: {
521
- type: 'string',
522
- description: 'UUID of the parent task to add subtask to',
523
- },
524
- title: {
525
- type: 'string',
526
- description: 'Subtask title',
527
- },
528
- description: {
529
- type: 'string',
530
- description: 'Detailed description (optional)',
531
- },
532
- priority: {
533
- type: 'number',
534
- minimum: 1,
535
- maximum: 5,
536
- description: 'Priority 1-5 (1 = highest). Defaults to parent task priority.',
537
- },
538
- estimated_minutes: {
539
- type: 'number',
540
- minimum: 1,
541
- description: 'Estimated time to complete in minutes',
542
- },
543
- },
544
- required: ['parent_task_id', 'title'],
545
- },
546
- },
547
- {
548
- name: 'get_subtasks',
549
- description: `Get subtasks for a parent task with pagination.
550
- Returns subtasks with aggregate completion stats.`,
551
- inputSchema: {
552
- type: 'object',
553
- properties: {
554
- parent_task_id: {
555
- type: 'string',
556
- description: 'UUID of the parent task',
557
- },
558
- status: {
559
- type: 'string',
560
- enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
561
- description: 'Filter by status (optional)',
562
- },
563
- limit: {
564
- type: 'number',
565
- description: 'Max subtasks to return (default: 20, max: 50)',
566
- },
567
- offset: {
568
- type: 'number',
569
- description: 'Number of subtasks to skip (default: 0)',
570
- },
571
- },
572
- required: ['parent_task_id'],
573
- },
574
- },
575
- ];
1
+ /**
2
+ * Task Tool Definitions
3
+ *
4
+ * Tools for task CRUD and management:
5
+ * - get_task
6
+ * - search_tasks
7
+ * - get_tasks_by_priority
8
+ * - get_recent_tasks
9
+ * - get_task_stats
10
+ * - get_next_task
11
+ * - add_task
12
+ * - update_task
13
+ * - complete_task
14
+ * - delete_task
15
+ * - cancel_task
16
+ * - release_task
17
+ * - add_task_reference
18
+ * - remove_task_reference
19
+ * - batch_update_tasks
20
+ * - batch_complete_tasks
21
+ * - add_subtask
22
+ * - get_subtasks
23
+ * - get_stale_worktrees
24
+ * - clear_worktree_path
25
+ */
26
+
27
+ import type { Tool } from './types.js';
28
+
29
+ export const taskTools: Tool[] = [
30
+ {
31
+ name: 'get_task',
32
+ description: `Get a single task by ID with optional subtasks and milestones.`,
33
+ inputSchema: {
34
+ type: 'object',
35
+ properties: {
36
+ task_id: {
37
+ type: 'string',
38
+ description: 'Task UUID',
39
+ },
40
+ include_subtasks: {
41
+ type: 'boolean',
42
+ description: 'Include subtasks array (default: false)',
43
+ },
44
+ include_milestones: {
45
+ type: 'boolean',
46
+ description: 'Include milestones array (default: false)',
47
+ },
48
+ },
49
+ required: ['task_id'],
50
+ },
51
+ },
52
+ {
53
+ name: 'search_tasks',
54
+ description: `Search tasks by text query. Supports pagination with offset. Use for finding specific tasks by title or description.`,
55
+ inputSchema: {
56
+ type: 'object',
57
+ properties: {
58
+ project_id: {
59
+ type: 'string',
60
+ description: 'Project UUID',
61
+ },
62
+ query: {
63
+ type: 'string',
64
+ description: 'Search query (min 2 chars). Searches title and description.',
65
+ },
66
+ status: {
67
+ type: 'array',
68
+ items: { type: 'string', enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'] },
69
+ description: 'Filter by status (optional, array)',
70
+ },
71
+ limit: {
72
+ type: 'number',
73
+ description: 'Max results per page (1-20, default: 10)',
74
+ },
75
+ offset: {
76
+ type: 'number',
77
+ description: 'Number of results to skip for pagination (default: 0)',
78
+ },
79
+ },
80
+ required: ['project_id', 'query'],
81
+ },
82
+ },
83
+ {
84
+ name: 'get_tasks_by_priority',
85
+ description: `Get tasks filtered by priority. Supports pagination with offset. Use for finding high-priority or low-priority tasks.`,
86
+ inputSchema: {
87
+ type: 'object',
88
+ properties: {
89
+ project_id: {
90
+ type: 'string',
91
+ description: 'Project UUID',
92
+ },
93
+ priority: {
94
+ type: 'number',
95
+ minimum: 1,
96
+ maximum: 5,
97
+ description: 'Exact priority to match (1=highest, 5=lowest)',
98
+ },
99
+ priority_max: {
100
+ type: 'number',
101
+ minimum: 1,
102
+ maximum: 5,
103
+ description: 'Max priority (for range, e.g., priority=1, priority_max=2 gets P1 and P2)',
104
+ },
105
+ status: {
106
+ type: 'string',
107
+ enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
108
+ description: 'Filter by status (default: pending)',
109
+ },
110
+ limit: {
111
+ type: 'number',
112
+ description: 'Max results per page (1-20, default: 10)',
113
+ },
114
+ offset: {
115
+ type: 'number',
116
+ description: 'Number of results to skip for pagination (default: 0)',
117
+ },
118
+ },
119
+ required: ['project_id'],
120
+ },
121
+ },
122
+ {
123
+ name: 'get_recent_tasks',
124
+ description: `Get tasks ordered by creation date. Supports pagination with offset. Use to find oldest pending tasks or newest additions.`,
125
+ inputSchema: {
126
+ type: 'object',
127
+ properties: {
128
+ project_id: {
129
+ type: 'string',
130
+ description: 'Project UUID',
131
+ },
132
+ order: {
133
+ type: 'string',
134
+ enum: ['newest', 'oldest'],
135
+ description: 'Sort order (default: newest)',
136
+ },
137
+ status: {
138
+ type: 'string',
139
+ enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
140
+ description: 'Filter by status (optional)',
141
+ },
142
+ limit: {
143
+ type: 'number',
144
+ description: 'Max results per page (1-20, default: 10)',
145
+ },
146
+ offset: {
147
+ type: 'number',
148
+ description: 'Number of results to skip for pagination (default: 0)',
149
+ },
150
+ },
151
+ required: ['project_id'],
152
+ },
153
+ },
154
+ {
155
+ name: 'get_task_stats',
156
+ description: `Get aggregate task statistics for a project. Returns counts by status and priority, no task data. Most token-efficient way to understand project state.`,
157
+ inputSchema: {
158
+ type: 'object',
159
+ properties: {
160
+ project_id: {
161
+ type: 'string',
162
+ description: 'Project UUID',
163
+ },
164
+ },
165
+ required: ['project_id'],
166
+ },
167
+ },
168
+ {
169
+ name: 'get_next_task',
170
+ description: `Get highest priority pending task. Start it IMMEDIATELY by calling update_task(task_id, status: "in_progress").
171
+
172
+ Do NOT ask the user for permission. Follow the directive in the response.`,
173
+ inputSchema: {
174
+ type: 'object',
175
+ properties: {
176
+ project_id: {
177
+ type: 'string',
178
+ description: 'Project UUID',
179
+ },
180
+ },
181
+ required: ['project_id'],
182
+ },
183
+ },
184
+ {
185
+ name: 'add_task',
186
+ description: `Add a new task. Priority 1=highest, 5=lowest. Include estimated_minutes. Use blocking=true for deployment finalization tasks that must complete before other work.
187
+
188
+ WHEN TO USE: If the user gives you work directly (e.g., "implement feature X", "fix this bug") that isn't already tracked as a task in Vibescope, you MUST create a task first using this tool. This ensures:
189
+ - The work is visible on the dashboard
190
+ - Progress can be tracked
191
+ - Other agents won't duplicate the work
192
+ - The human can see what you're working on`,
193
+ inputSchema: {
194
+ type: 'object',
195
+ properties: {
196
+ project_id: {
197
+ type: 'string',
198
+ description: 'Project UUID',
199
+ },
200
+ title: {
201
+ type: 'string',
202
+ description: 'Task title',
203
+ },
204
+ description: {
205
+ type: 'string',
206
+ description: 'Detailed description',
207
+ },
208
+ priority: {
209
+ type: 'number',
210
+ minimum: 1,
211
+ maximum: 5,
212
+ description: 'Priority 1-5 (1 = highest)',
213
+ },
214
+ estimated_minutes: {
215
+ type: 'number',
216
+ minimum: 1,
217
+ description: 'Estimated time to complete in minutes',
218
+ },
219
+ blocking: {
220
+ type: 'boolean',
221
+ description: 'When true, this task blocks all other work until complete (used for deployment finalization)',
222
+ },
223
+ model_capability: {
224
+ type: 'string',
225
+ enum: ['haiku', 'sonnet', 'opus'],
226
+ description: 'Recommended model capability: haiku (simple tasks), sonnet (standard), opus (complex reasoning)',
227
+ },
228
+ assigned_agent_name: {
229
+ type: 'string',
230
+ description: 'Pre-assign this task to a specific agent by persona name. Only that agent will pick it up via get_next_task.',
231
+ },
232
+ is_human_task: {
233
+ type: 'boolean',
234
+ description: 'When true, only humans can claim and perform this task. Agents will skip it in get_next_task.',
235
+ },
236
+ },
237
+ required: ['project_id', 'title'],
238
+ },
239
+ },
240
+ {
241
+ name: 'update_task',
242
+ description: `Update task status, progress, or details. Include progress_note with progress_percentage.
243
+
244
+ CRITICAL - WORKTREE REQUIRED: For projects using github-flow or git-flow, you MUST use a git worktree to isolate your work. This prevents conflicts with other agents working on the same repository.
245
+
246
+ When setting status to "in_progress":
247
+ 1. Create worktree FIRST: git worktree add ../PROJECT-PERSONA-task-desc -b feature/TASKID-description BASE_BRANCH
248
+ 2. cd into the worktree directory
249
+ 3. THEN call update_task with git_branch AND worktree_path
250
+
251
+ Example: update_task(task_id, status: "in_progress", git_branch: "feature/abc123-add-login", worktree_path: "../MyProject-Edge-add-login")
252
+
253
+ For projects without git branching (trunk-based or none), use skip_worktree_requirement: true.`,
254
+ inputSchema: {
255
+ type: 'object',
256
+ properties: {
257
+ task_id: {
258
+ type: 'string',
259
+ description: 'Task UUID',
260
+ },
261
+ title: { type: 'string', description: 'New task title' },
262
+ description: { type: 'string', description: 'New task description' },
263
+ priority: {
264
+ type: 'number',
265
+ minimum: 1,
266
+ maximum: 5,
267
+ description: 'Task priority (1=highest, 5=lowest)',
268
+ },
269
+ status: {
270
+ type: 'string',
271
+ enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
272
+ description: 'Task status',
273
+ },
274
+ progress_percentage: {
275
+ type: 'number',
276
+ minimum: 0,
277
+ maximum: 100,
278
+ description: '0-100 completion percentage',
279
+ },
280
+ progress_note: {
281
+ type: 'string',
282
+ description: 'Brief note (auto-logged)',
283
+ },
284
+ estimated_minutes: {
285
+ type: 'number',
286
+ minimum: 1,
287
+ description: 'Revised time estimate',
288
+ },
289
+ git_branch: {
290
+ type: 'string',
291
+ description: 'Git branch associated with this task. REQUIRED when status is "in_progress" (unless skip_worktree_requirement is true)',
292
+ },
293
+ worktree_path: {
294
+ type: 'string',
295
+ description: 'Git worktree path for this task (e.g., "../project-task-abc123"). Store this for cleanup tracking across sessions.',
296
+ },
297
+ worktree_hostname: {
298
+ type: 'string',
299
+ description: 'Machine hostname where worktree was created (os.hostname()). Required with worktree_path to enable machine-aware cleanup.',
300
+ },
301
+ model_capability: {
302
+ type: 'string',
303
+ enum: ['haiku', 'sonnet', 'opus'],
304
+ description: 'Recommended model capability: haiku (simple tasks), sonnet (standard), opus (complex reasoning)',
305
+ },
306
+ assigned_agent_name: {
307
+ type: ['string', 'null'],
308
+ description: 'Pre-assign this task to a specific agent by persona name. Set to null to unassign. Only the assigned agent will pick it up via get_next_task.',
309
+ },
310
+ is_human_task: {
311
+ type: 'boolean',
312
+ description: 'When true, only humans can claim and perform this task. Agents will skip it in get_next_task.',
313
+ },
314
+ skip_worktree_requirement: {
315
+ type: 'boolean',
316
+ description: 'Skip git_branch requirement for projects without branching workflows (trunk-based or none). Default: false',
317
+ },
318
+ session_id: {
319
+ type: 'string',
320
+ description: 'Session ID from start_work_session. Required for cloud agents using mcporter (session context is not preserved between calls). Links the task to your agent on the dashboard.',
321
+ },
322
+ },
323
+ required: ['task_id'],
324
+ },
325
+ },
326
+ {
327
+ name: 'complete_task',
328
+ description: `Mark task done. Returns next_task which you MUST start immediately without asking the user.
329
+
330
+ CRITICAL: Before calling complete_task on branching workflows (github-flow, git-flow):
331
+ 1. Create your PR targeting the correct branch (develop for git-flow, main for github-flow)
332
+ 2. Call add_task_reference(task_id, pr_url) to link the PR to your task
333
+ 3. THEN call complete_task - validators CANNOT approve tasks without a PR reference
334
+
335
+ CRITICAL: After calling this tool, you must:
336
+ 1. If next_task is returned → Start it immediately by calling update_task(task_id, status: "in_progress")
337
+ 2. If no next_task → Call get_next_task() or start a fallback_activity
338
+ 3. NEVER ask the user "What should I do next?" or "Should I continue?"
339
+
340
+ The auto_continue: true flag in the response means you are expected to continue working autonomously.`,
341
+ inputSchema: {
342
+ type: 'object',
343
+ properties: {
344
+ task_id: {
345
+ type: 'string',
346
+ description: 'Task UUID',
347
+ },
348
+ summary: {
349
+ type: 'string',
350
+ description: 'Brief summary of what was done. This is stored on the task as completion_summary and displayed when reviewing completed tasks.',
351
+ },
352
+ session_id: {
353
+ type: 'string',
354
+ description: 'Session ID from start_work_session. Required for cloud agents using mcporter.',
355
+ },
356
+ commit_hash: {
357
+ type: 'string',
358
+ description: 'Git commit hash (7-40 hex chars) of your last commit. Stored on the task for verification.',
359
+ },
360
+ check_results: {
361
+ type: 'array',
362
+ description: 'Results of pre-completion checks (required if project has pre_completion_commands configured). Each item: { command, passed, output? }',
363
+ items: {
364
+ type: 'object',
365
+ properties: {
366
+ command: { type: 'string', description: 'The command that was run' },
367
+ passed: { type: 'boolean', description: 'Whether the command succeeded' },
368
+ output: { type: 'string', description: 'First 500 chars of output if failed' },
369
+ },
370
+ required: ['command', 'passed'],
371
+ },
372
+ },
373
+ },
374
+ required: ['task_id'],
375
+ },
376
+ },
377
+ {
378
+ name: 'delete_task',
379
+ description: `Delete a task.`,
380
+ inputSchema: {
381
+ type: 'object',
382
+ properties: {
383
+ task_id: {
384
+ type: 'string',
385
+ description: 'Task UUID',
386
+ },
387
+ },
388
+ required: ['task_id'],
389
+ },
390
+ },
391
+ {
392
+ name: 'cancel_task',
393
+ description: `Cancel a task with an optional reason. Use this when a task should be marked as cancelled rather than deleted (e.g., PR was closed, work was superseded). The task remains visible with a cancelled status for historical tracking.`,
394
+ inputSchema: {
395
+ type: 'object',
396
+ properties: {
397
+ task_id: {
398
+ type: 'string',
399
+ description: 'Task UUID',
400
+ },
401
+ cancelled_reason: {
402
+ type: 'string',
403
+ description: 'Reason for cancellation',
404
+ enum: ['pr_closed', 'superseded', 'user_cancelled', 'validation_failed', 'obsolete', 'blocked'],
405
+ },
406
+ cancellation_note: {
407
+ type: 'string',
408
+ description: 'Optional note explaining the cancellation (logged to progress)',
409
+ },
410
+ },
411
+ required: ['task_id'],
412
+ },
413
+ },
414
+ {
415
+ name: 'release_task',
416
+ description: `Release a claimed task back to pending status. Use when you need to give up a task you've started but cannot complete (e.g., context limits reached, conflicts with other work, user requested different approach). The task becomes available for other agents to claim.`,
417
+ inputSchema: {
418
+ type: 'object',
419
+ properties: {
420
+ task_id: {
421
+ type: 'string',
422
+ description: 'Task UUID',
423
+ },
424
+ reason: {
425
+ type: 'string',
426
+ description: 'Optional reason for releasing the task (logged to progress)',
427
+ },
428
+ },
429
+ required: ['task_id'],
430
+ },
431
+ },
432
+ {
433
+ name: 'add_task_reference',
434
+ description: 'Add a reference URL to a task (docs, PRs, issues).',
435
+ inputSchema: {
436
+ type: 'object',
437
+ properties: {
438
+ task_id: {
439
+ type: 'string',
440
+ description: 'Task UUID',
441
+ },
442
+ url: {
443
+ type: 'string',
444
+ description: 'URL to add as reference',
445
+ },
446
+ label: {
447
+ type: 'string',
448
+ description: 'Optional label/title for the reference',
449
+ },
450
+ },
451
+ required: ['task_id', 'url'],
452
+ },
453
+ },
454
+ {
455
+ name: 'remove_task_reference',
456
+ description: `Remove a reference link from a task by URL.`,
457
+ inputSchema: {
458
+ type: 'object',
459
+ properties: {
460
+ task_id: {
461
+ type: 'string',
462
+ description: 'Task UUID',
463
+ },
464
+ url: {
465
+ type: 'string',
466
+ description: 'URL of the reference to remove',
467
+ },
468
+ },
469
+ required: ['task_id', 'url'],
470
+ },
471
+ },
472
+ {
473
+ name: 'batch_update_tasks',
474
+ description: 'Update multiple tasks at once. Include progress_note with progress_percentage.',
475
+ inputSchema: {
476
+ type: 'object',
477
+ properties: {
478
+ updates: {
479
+ type: 'array',
480
+ description: 'Array of task updates to apply',
481
+ items: {
482
+ type: 'object',
483
+ properties: {
484
+ task_id: { type: 'string', description: 'Task UUID' },
485
+ status: { type: 'string', enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'] },
486
+ progress_percentage: { type: 'number', minimum: 0, maximum: 100 },
487
+ progress_note: { type: 'string', description: 'Brief note about what was achieved' },
488
+ priority: { type: 'number', minimum: 1, maximum: 5 },
489
+ },
490
+ required: ['task_id'],
491
+ },
492
+ },
493
+ },
494
+ required: ['updates'],
495
+ },
496
+ },
497
+ {
498
+ name: 'batch_complete_tasks',
499
+ description: `Mark multiple tasks as completed at once.`,
500
+ inputSchema: {
501
+ type: 'object',
502
+ properties: {
503
+ completions: {
504
+ type: 'array',
505
+ description: 'Array of task completions',
506
+ items: {
507
+ type: 'object',
508
+ properties: {
509
+ task_id: { type: 'string', description: 'Task UUID' },
510
+ summary: { type: 'string', description: 'Optional completion summary' },
511
+ },
512
+ required: ['task_id'],
513
+ },
514
+ },
515
+ },
516
+ required: ['completions'],
517
+ },
518
+ },
519
+ {
520
+ name: 'add_subtask',
521
+ description: `Add a subtask to break down a larger task into smaller workable pieces.
522
+ Subtasks can be claimed and worked on independently by any agent.
523
+ Subtasks inherit the project from their parent task.
524
+ Max depth is 1 (subtasks cannot have their own subtasks).`,
525
+ inputSchema: {
526
+ type: 'object',
527
+ properties: {
528
+ parent_task_id: {
529
+ type: 'string',
530
+ description: 'UUID of the parent task to add subtask to',
531
+ },
532
+ title: {
533
+ type: 'string',
534
+ description: 'Subtask title',
535
+ },
536
+ description: {
537
+ type: 'string',
538
+ description: 'Detailed description (optional)',
539
+ },
540
+ priority: {
541
+ type: 'number',
542
+ minimum: 1,
543
+ maximum: 5,
544
+ description: 'Priority 1-5 (1 = highest). Defaults to parent task priority.',
545
+ },
546
+ estimated_minutes: {
547
+ type: 'number',
548
+ minimum: 1,
549
+ description: 'Estimated time to complete in minutes',
550
+ },
551
+ },
552
+ required: ['parent_task_id', 'title'],
553
+ },
554
+ },
555
+ {
556
+ name: 'get_subtasks',
557
+ description: `Get subtasks for a parent task with pagination.
558
+ Returns subtasks with aggregate completion stats.`,
559
+ inputSchema: {
560
+ type: 'object',
561
+ properties: {
562
+ parent_task_id: {
563
+ type: 'string',
564
+ description: 'UUID of the parent task',
565
+ },
566
+ status: {
567
+ type: 'string',
568
+ enum: ['backlog', 'pending', 'in_progress', 'completed', 'cancelled'],
569
+ description: 'Filter by status (optional)',
570
+ },
571
+ limit: {
572
+ type: 'number',
573
+ description: 'Max subtasks to return (default: 20, max: 50)',
574
+ },
575
+ offset: {
576
+ type: 'number',
577
+ description: 'Number of subtasks to skip (default: 0)',
578
+ },
579
+ },
580
+ required: ['parent_task_id'],
581
+ },
582
+ },
583
+ ];