@vibescope/mcp-server 0.5.0 → 0.5.2

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 (162) 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/session.js +3 -1
  7. package/dist/handlers/tasks.js +7 -1
  8. package/dist/handlers/tool-docs.js +1216 -1216
  9. package/dist/index.js +73 -73
  10. package/dist/templates/agent-guidelines.d.ts +1 -1
  11. package/dist/templates/agent-guidelines.js +205 -205
  12. package/dist/templates/help-content.js +1621 -1621
  13. package/dist/tools/bodies-of-work.js +6 -6
  14. package/dist/tools/cloud-agents.js +22 -22
  15. package/dist/tools/milestones.js +2 -2
  16. package/dist/tools/requests.js +1 -1
  17. package/dist/tools/session.js +11 -11
  18. package/dist/tools/sprints.js +9 -9
  19. package/dist/tools/tasks.js +43 -35
  20. package/dist/tools/worktrees.js +14 -14
  21. package/dist/utils.js +11 -11
  22. package/docs/TOOLS.md +2687 -2685
  23. package/package.json +53 -53
  24. package/scripts/generate-docs.ts +212 -212
  25. package/scripts/version-bump.ts +203 -203
  26. package/src/api-client/blockers.ts +86 -86
  27. package/src/api-client/bodies-of-work.ts +194 -194
  28. package/src/api-client/chat.ts +50 -50
  29. package/src/api-client/connectors.ts +152 -152
  30. package/src/api-client/cost.ts +185 -185
  31. package/src/api-client/decisions.ts +87 -87
  32. package/src/api-client/deployment.ts +313 -313
  33. package/src/api-client/discovery.ts +81 -81
  34. package/src/api-client/fallback.ts +52 -52
  35. package/src/api-client/file-checkouts.ts +115 -115
  36. package/src/api-client/findings.ts +100 -100
  37. package/src/api-client/git-issues.ts +88 -88
  38. package/src/api-client/ideas.ts +112 -112
  39. package/src/api-client/index.ts +592 -592
  40. package/src/api-client/milestones.ts +83 -83
  41. package/src/api-client/organizations.ts +185 -185
  42. package/src/api-client/progress.ts +94 -94
  43. package/src/api-client/project.ts +181 -181
  44. package/src/api-client/requests.ts +54 -54
  45. package/src/api-client/session.ts +220 -220
  46. package/src/api-client/sprints.ts +227 -227
  47. package/src/api-client/subtasks.ts +57 -57
  48. package/src/api-client/tasks.ts +451 -450
  49. package/src/api-client/types.ts +32 -32
  50. package/src/api-client/validation.ts +60 -60
  51. package/src/api-client/worktrees.ts +53 -53
  52. package/src/api-client.test.ts +847 -847
  53. package/src/api-client.ts +2728 -2728
  54. package/src/cli-init.ts +558 -558
  55. package/src/cli.test.ts +284 -284
  56. package/src/cli.ts +204 -204
  57. package/src/handlers/__test-setup__.ts +240 -240
  58. package/src/handlers/__test-utils__.ts +89 -89
  59. package/src/handlers/blockers.test.ts +468 -468
  60. package/src/handlers/blockers.ts +172 -172
  61. package/src/handlers/bodies-of-work.test.ts +704 -704
  62. package/src/handlers/bodies-of-work.ts +526 -526
  63. package/src/handlers/chat.test.ts +185 -185
  64. package/src/handlers/chat.ts +101 -101
  65. package/src/handlers/cloud-agents.test.ts +438 -438
  66. package/src/handlers/cloud-agents.ts +156 -156
  67. package/src/handlers/connectors.test.ts +834 -834
  68. package/src/handlers/connectors.ts +229 -229
  69. package/src/handlers/cost.test.ts +462 -462
  70. package/src/handlers/cost.ts +285 -285
  71. package/src/handlers/decisions.test.ts +382 -382
  72. package/src/handlers/decisions.ts +153 -153
  73. package/src/handlers/deployment.test.ts +551 -551
  74. package/src/handlers/deployment.ts +570 -570
  75. package/src/handlers/discovery.test.ts +206 -206
  76. package/src/handlers/discovery.ts +433 -433
  77. package/src/handlers/fallback.test.ts +537 -537
  78. package/src/handlers/fallback.ts +194 -194
  79. package/src/handlers/file-checkouts.test.ts +750 -750
  80. package/src/handlers/file-checkouts.ts +185 -185
  81. package/src/handlers/findings.test.ts +633 -633
  82. package/src/handlers/findings.ts +239 -239
  83. package/src/handlers/git-issues.test.ts +631 -631
  84. package/src/handlers/git-issues.ts +136 -136
  85. package/src/handlers/ideas.test.ts +644 -644
  86. package/src/handlers/ideas.ts +207 -207
  87. package/src/handlers/index.ts +93 -93
  88. package/src/handlers/milestones.test.ts +475 -475
  89. package/src/handlers/milestones.ts +180 -180
  90. package/src/handlers/organizations.test.ts +826 -826
  91. package/src/handlers/organizations.ts +315 -315
  92. package/src/handlers/progress.test.ts +269 -269
  93. package/src/handlers/progress.ts +77 -77
  94. package/src/handlers/project.test.ts +546 -546
  95. package/src/handlers/project.ts +245 -245
  96. package/src/handlers/requests.test.ts +303 -303
  97. package/src/handlers/requests.ts +99 -99
  98. package/src/handlers/roles.test.ts +305 -305
  99. package/src/handlers/roles.ts +219 -219
  100. package/src/handlers/session.test.ts +998 -998
  101. package/src/handlers/session.ts +1107 -1105
  102. package/src/handlers/sprints.test.ts +732 -732
  103. package/src/handlers/sprints.ts +537 -537
  104. package/src/handlers/tasks.test.ts +931 -931
  105. package/src/handlers/tasks.ts +1144 -1137
  106. package/src/handlers/tool-categories.test.ts +66 -66
  107. package/src/handlers/tool-docs.test.ts +511 -511
  108. package/src/handlers/tool-docs.ts +1595 -1595
  109. package/src/handlers/types.test.ts +259 -259
  110. package/src/handlers/types.ts +176 -176
  111. package/src/handlers/validation.test.ts +582 -582
  112. package/src/handlers/validation.ts +164 -164
  113. package/src/handlers/version.ts +63 -63
  114. package/src/index.test.ts +674 -674
  115. package/src/index.ts +884 -884
  116. package/src/setup.test.ts +243 -243
  117. package/src/setup.ts +410 -410
  118. package/src/templates/agent-guidelines.ts +233 -233
  119. package/src/templates/help-content.ts +1751 -1751
  120. package/src/token-tracking.test.ts +463 -463
  121. package/src/token-tracking.ts +167 -167
  122. package/src/tools/blockers.ts +122 -122
  123. package/src/tools/bodies-of-work.ts +283 -283
  124. package/src/tools/chat.ts +72 -72
  125. package/src/tools/cloud-agents.ts +101 -101
  126. package/src/tools/connectors.ts +191 -191
  127. package/src/tools/cost.ts +111 -111
  128. package/src/tools/decisions.ts +111 -111
  129. package/src/tools/deployment.ts +455 -455
  130. package/src/tools/discovery.ts +76 -76
  131. package/src/tools/fallback.ts +111 -111
  132. package/src/tools/features.ts +154 -154
  133. package/src/tools/file-checkouts.ts +145 -145
  134. package/src/tools/findings.ts +101 -101
  135. package/src/tools/git-issues.ts +130 -130
  136. package/src/tools/ideas.ts +162 -162
  137. package/src/tools/index.ts +145 -145
  138. package/src/tools/milestones.ts +118 -118
  139. package/src/tools/organizations.ts +224 -224
  140. package/src/tools/persona-templates.ts +25 -25
  141. package/src/tools/progress.ts +73 -73
  142. package/src/tools/project.ts +210 -210
  143. package/src/tools/requests.ts +68 -68
  144. package/src/tools/roles.ts +112 -112
  145. package/src/tools/session.ts +181 -181
  146. package/src/tools/sprints.ts +298 -298
  147. package/src/tools/tasks.ts +583 -575
  148. package/src/tools/tools.test.ts +222 -222
  149. package/src/tools/types.ts +9 -9
  150. package/src/tools/validation.ts +75 -75
  151. package/src/tools/version.ts +34 -34
  152. package/src/tools/worktrees.ts +66 -66
  153. package/src/tools.test.ts +416 -416
  154. package/src/utils.test.ts +1014 -1014
  155. package/src/utils.ts +586 -586
  156. package/src/validators.test.ts +223 -223
  157. package/src/validators.ts +249 -249
  158. package/src/version.ts +162 -162
  159. package/tsconfig.json +16 -16
  160. package/vitest.config.ts +14 -14
  161. package/dist/tools.d.ts +0 -2
  162. package/dist/tools.js +0 -3602
@@ -1,433 +1,433 @@
1
- /**
2
- * Discovery Handlers
3
- *
4
- * Handles tool discovery and documentation:
5
- * - discover_tools
6
- * - get_tool_info
7
- *
8
- * Note: Tool documentation is lazy-loaded from tool-docs.ts to save tokens.
9
- * This saves ~8,000 tokens per schema load.
10
- */
11
-
12
- import type { Handler, HandlerRegistry } from './types.js';
13
- import { parseArgs } from '../validators.js';
14
-
15
- // Argument schemas for type-safe parsing
16
- const discoverToolsSchema = {
17
- category: { type: 'string' as const },
18
- };
19
-
20
- const getToolInfoSchema = {
21
- tool_name: { type: 'string' as const, required: true as const },
22
- };
23
-
24
- // Lazy-loaded tool documentation cache
25
- let toolInfoCache: Record<string, string> | null = null;
26
-
27
- /**
28
- * Lazy-load tool documentation.
29
- * Only loads the TOOL_INFO module when get_tool_info is called.
30
- */
31
- async function getToolDocs(): Promise<Record<string, string>> {
32
- if (toolInfoCache) {
33
- return toolInfoCache;
34
- }
35
-
36
- const { TOOL_INFO } = await import('./tool-docs.js');
37
- toolInfoCache = TOOL_INFO;
38
- return toolInfoCache;
39
- }
40
-
41
- // Tool categories with brief descriptions (exported for documentation generation)
42
- export const TOOL_CATEGORIES: Record<string, { description: string; tools: Array<{ name: string; brief: string }> }> = {
43
- session: {
44
- description: 'Session lifecycle and monitoring',
45
- tools: [
46
- { name: 'start_work_session', brief: 'Initialize session, get next task' },
47
- { name: 'get_help', brief: 'Get workflow guidance' },
48
- { name: 'get_token_usage', brief: 'View token stats' },
49
- { name: 'report_token_usage', brief: 'Report actual Claude API usage' },
50
- { name: 'heartbeat', brief: 'Maintain active status' },
51
- { name: 'signal_idle', brief: 'Signal agent is idle' },
52
- { name: 'end_work_session', brief: 'End session, release tasks' },
53
- { name: 'confirm_agent_setup', brief: 'Mark agent setup as complete' },
54
- ],
55
- },
56
- project: {
57
- description: 'Project CRUD and configuration',
58
- tools: [
59
- { name: 'get_project_context', brief: 'Full project info' },
60
- { name: 'get_project_summary', brief: 'Unified stats overview' },
61
- { name: 'get_git_workflow', brief: 'Git branching config' },
62
- { name: 'create_project', brief: 'Create new project' },
63
- { name: 'update_project', brief: 'Modify project settings' },
64
- { name: 'update_project_readme', brief: 'Sync README to dashboard' },
65
- ],
66
- },
67
- tasks: {
68
- description: 'Task management and tracking',
69
- tools: [
70
- { name: 'get_task', brief: 'Get single task by ID' },
71
- { name: 'search_tasks', brief: 'Text search tasks' },
72
- { name: 'get_tasks_by_priority', brief: 'Filter tasks by priority' },
73
- { name: 'get_recent_tasks', brief: 'Get oldest/newest tasks' },
74
- { name: 'get_task_stats', brief: 'Get aggregate task counts' },
75
- { name: 'get_next_task', brief: 'Get highest priority task' },
76
- { name: 'add_task', brief: 'Create new task' },
77
- { name: 'update_task', brief: 'Update task status/progress' },
78
- { name: 'complete_task', brief: 'Mark task done' },
79
- { name: 'delete_task', brief: 'Remove a task' },
80
- { name: 'cancel_task', brief: 'Cancel task with reason' },
81
- { name: 'release_task', brief: 'Unclaim task to pending' },
82
- { name: 'batch_update_tasks', brief: 'Update multiple tasks' },
83
- { name: 'batch_complete_tasks', brief: 'Complete multiple tasks' },
84
- { name: 'add_task_reference', brief: 'Add URL to task' },
85
- { name: 'remove_task_reference', brief: 'Remove URL from task' },
86
- ],
87
- },
88
- milestones: {
89
- description: 'Task breakdown into steps',
90
- tools: [
91
- { name: 'add_milestone', brief: 'Add step to task' },
92
- { name: 'update_milestone', brief: 'Update milestone' },
93
- { name: 'complete_milestone', brief: 'Mark step done' },
94
- { name: 'delete_milestone', brief: 'Remove milestone' },
95
- { name: 'get_milestones', brief: 'List task milestones' },
96
- ],
97
- },
98
- progress: {
99
- description: 'Progress logging and activity',
100
- tools: [
101
- { name: 'log_progress', brief: 'Record progress update' },
102
- { name: 'get_activity_feed', brief: 'Combined activity feed' },
103
- ],
104
- },
105
- blockers: {
106
- description: 'Blocker management',
107
- tools: [
108
- { name: 'add_blocker', brief: 'Record a blocker' },
109
- { name: 'resolve_blocker', brief: 'Mark resolved' },
110
- { name: 'get_blocker', brief: 'Get single blocker' },
111
- { name: 'get_blockers', brief: 'List blockers' },
112
- { name: 'get_blockers_stats', brief: 'Get blocker statistics' },
113
- { name: 'delete_blocker', brief: 'Remove blocker' },
114
- ],
115
- },
116
- decisions: {
117
- description: 'Architectural decisions',
118
- tools: [
119
- { name: 'log_decision', brief: 'Record decision' },
120
- { name: 'get_decision', brief: 'Get single decision' },
121
- { name: 'get_decisions', brief: 'List decisions' },
122
- { name: 'get_decisions_stats', brief: 'Get decision statistics' },
123
- { name: 'delete_decision', brief: 'Remove decision' },
124
- ],
125
- },
126
- ideas: {
127
- description: 'Feature ideas tracking',
128
- tools: [
129
- { name: 'add_idea', brief: 'Record an idea' },
130
- { name: 'update_idea', brief: 'Update idea status' },
131
- { name: 'get_idea', brief: 'Get single idea' },
132
- { name: 'get_ideas', brief: 'List ideas' },
133
- { name: 'delete_idea', brief: 'Remove idea' },
134
- { name: 'convert_idea_to_task', brief: 'Convert idea to task' },
135
- ],
136
- },
137
- findings: {
138
- description: 'Audit findings/knowledge base',
139
- tools: [
140
- { name: 'add_finding', brief: 'Record audit finding' },
141
- { name: 'get_finding', brief: 'Get single finding' },
142
- { name: 'get_findings', brief: 'List findings' },
143
- { name: 'get_findings_stats', brief: 'Get findings statistics' },
144
- { name: 'update_finding', brief: 'Update finding status' },
145
- { name: 'delete_finding', brief: 'Remove finding' },
146
- ],
147
- },
148
- validation: {
149
- description: 'Cross-agent task validation',
150
- tools: [
151
- { name: 'get_tasks_awaiting_validation', brief: 'Unvalidated tasks' },
152
- { name: 'claim_validation', brief: 'Claim task for review' },
153
- { name: 'validate_task', brief: 'Approve/reject task' },
154
- ],
155
- },
156
- deployment: {
157
- description: 'Deployment coordination',
158
- tools: [
159
- { name: 'request_deployment', brief: 'Request deploy' },
160
- { name: 'claim_deployment_validation', brief: 'Claim for validation' },
161
- { name: 'report_validation', brief: 'Report build/test results' },
162
- { name: 'check_deployment_status', brief: 'Get deploy status' },
163
- { name: 'start_deployment', brief: 'Begin deployment' },
164
- { name: 'complete_deployment', brief: 'Mark deploy done' },
165
- { name: 'cancel_deployment', brief: 'Cancel deployment' },
166
- { name: 'add_deployment_requirement', brief: 'Add pre-deploy step' },
167
- { name: 'complete_deployment_requirement', brief: 'Mark step done' },
168
- { name: 'get_deployment_requirements', brief: 'List pre-deploy steps' },
169
- { name: 'get_deployment_requirements_stats', brief: 'Get requirements statistics' },
170
- { name: 'reorder_deployment_requirements', brief: 'Reorder steps within a stage' },
171
- { name: 'schedule_deployment', brief: 'Schedule future deployment' },
172
- { name: 'get_scheduled_deployments', brief: 'List scheduled deployments' },
173
- { name: 'update_scheduled_deployment', brief: 'Update schedule config' },
174
- { name: 'delete_scheduled_deployment', brief: 'Delete schedule' },
175
- { name: 'trigger_scheduled_deployment', brief: 'Manual trigger' },
176
- { name: 'check_due_deployments', brief: 'Check due schedules' },
177
- ],
178
- },
179
- fallback: {
180
- description: 'Background activities when idle',
181
- tools: [
182
- { name: 'start_fallback_activity', brief: 'Start background work' },
183
- { name: 'stop_fallback_activity', brief: 'Stop background work' },
184
- { name: 'get_activity_history', brief: 'Activity history' },
185
- { name: 'get_activity_schedules', brief: 'Activity schedules' },
186
- ],
187
- },
188
- bodies_of_work: {
189
- description: 'Group tasks into bodies of work',
190
- tools: [
191
- { name: 'create_body_of_work', brief: 'Create task group' },
192
- { name: 'update_body_of_work', brief: 'Update settings' },
193
- { name: 'get_body_of_work', brief: 'Get with tasks' },
194
- { name: 'get_bodies_of_work', brief: 'List bodies of work' },
195
- { name: 'delete_body_of_work', brief: 'Remove body of work' },
196
- { name: 'add_task_to_body_of_work', brief: 'Add task to group' },
197
- { name: 'remove_task_from_body_of_work', brief: 'Remove from group' },
198
- { name: 'activate_body_of_work', brief: 'Activate for work' },
199
- { name: 'add_task_dependency', brief: 'Add task dependency' },
200
- { name: 'remove_task_dependency', brief: 'Remove task dependency' },
201
- { name: 'get_task_dependencies', brief: 'List task dependencies' },
202
- { name: 'get_next_body_of_work_task', brief: 'Get next available task' },
203
- ],
204
- },
205
- sprints: {
206
- description: 'Time-bounded sprints with velocity tracking',
207
- tools: [
208
- { name: 'create_sprint', brief: 'Create new sprint' },
209
- { name: 'update_sprint', brief: 'Update sprint details' },
210
- { name: 'get_sprint', brief: 'Get sprint with tasks' },
211
- { name: 'get_sprints', brief: 'List project sprints' },
212
- { name: 'delete_sprint', brief: 'Delete sprint' },
213
- { name: 'start_sprint', brief: 'Start sprint' },
214
- { name: 'complete_sprint', brief: 'Complete sprint' },
215
- { name: 'add_task_to_sprint', brief: 'Add task to sprint' },
216
- { name: 'remove_task_from_sprint', brief: 'Remove from sprint' },
217
- { name: 'get_sprint_backlog', brief: 'Get available tasks (paginated)' },
218
- { name: 'get_sprint_velocity', brief: 'Velocity metrics' },
219
- ],
220
- },
221
- requests: {
222
- description: 'User request handling',
223
- tools: [
224
- { name: 'get_pending_requests', brief: 'Unhandled requests' },
225
- { name: 'acknowledge_request', brief: 'Mark handled' },
226
- { name: 'answer_question', brief: 'Answer user question' },
227
- ],
228
- },
229
- organizations: {
230
- description: 'Organization and team management',
231
- tools: [
232
- // REMOVED: list_organizations - use dashboard
233
- { name: 'create_organization', brief: 'Create new org' },
234
- { name: 'update_organization', brief: 'Update org settings' },
235
- { name: 'delete_organization', brief: 'Delete org' },
236
- // REMOVED: list_org_members - use dashboard
237
- { name: 'invite_member', brief: 'Invite by email' },
238
- { name: 'update_member_role', brief: 'Change member role' },
239
- { name: 'remove_member', brief: 'Remove from org' },
240
- { name: 'leave_organization', brief: 'Leave an org' },
241
- { name: 'share_project_with_org', brief: 'Share project' },
242
- { name: 'update_project_share', brief: 'Update share perms' },
243
- { name: 'unshare_project', brief: 'Remove share' },
244
- // REMOVED: list_project_shares - use dashboard
245
- ],
246
- },
247
- cost: {
248
- description: 'Cost monitoring and alerts',
249
- tools: [
250
- { name: 'get_cost_summary', brief: 'Cost by period (paginated)' },
251
- // REMOVED: get_cost_alerts - use dashboard
252
- { name: 'add_cost_alert', brief: 'Add threshold alert' },
253
- { name: 'update_cost_alert', brief: 'Update alert config' },
254
- { name: 'delete_cost_alert', brief: 'Remove alert' },
255
- // REMOVED: get_task_costs - use get_cost_summary
256
- // REMOVED: get_body_of_work_costs - use get_cost_summary
257
- // REMOVED: get_sprint_costs - use get_cost_summary
258
- ],
259
- },
260
- git_issues: {
261
- description: 'Git conflict and issue tracking',
262
- tools: [
263
- { name: 'add_git_issue', brief: 'Record git issue' },
264
- { name: 'resolve_git_issue', brief: 'Mark resolved' },
265
- { name: 'get_git_issues', brief: 'List git issues' },
266
- { name: 'delete_git_issue', brief: 'Delete git issue' },
267
- ],
268
- },
269
- knowledge: {
270
- description: 'Queryable knowledge base from project data',
271
- tools: [
272
- { name: 'query_knowledge_base', brief: 'Aggregated project knowledge in one call' },
273
- ],
274
- },
275
- discovery: {
276
- description: 'Tool discovery and documentation',
277
- tools: [
278
- { name: 'discover_tools', brief: 'List tools by category' },
279
- { name: 'get_tool_info', brief: 'Get detailed tool docs' },
280
- ],
281
- },
282
- subtasks: {
283
- description: 'Break tasks into smaller pieces',
284
- tools: [
285
- { name: 'add_subtask', brief: 'Add subtask to task' },
286
- { name: 'get_subtasks', brief: 'List task subtasks (paginated)' },
287
- ],
288
- },
289
- worktrees: {
290
- description: 'Git worktree management',
291
- tools: [
292
- { name: 'get_stale_worktrees', brief: 'Find orphaned worktrees' },
293
- { name: 'clear_worktree_path', brief: 'Clear worktree from task' },
294
- ],
295
- },
296
- roles: {
297
- description: 'Agent role management',
298
- tools: [
299
- { name: 'get_role_settings', brief: 'Get project role settings' },
300
- { name: 'update_role_settings', brief: 'Configure role behavior' },
301
- { name: 'set_session_role', brief: 'Set session role' },
302
- { name: 'get_agents_by_role', brief: 'List agents by role' },
303
- ],
304
- },
305
- file_locks: {
306
- description: 'File checkout/locking for multi-agent',
307
- tools: [
308
- { name: 'checkout_file', brief: 'Lock file for editing' },
309
- { name: 'checkin_file', brief: 'Release file lock' },
310
- { name: 'get_file_checkouts', brief: 'List file locks' },
311
- { name: 'get_file_checkouts_stats', brief: 'Lock statistics' },
312
- { name: 'abandon_checkout', brief: 'Force-release lock' },
313
- { name: 'is_file_available', brief: 'Check if file is free' },
314
- ],
315
- },
316
- connectors: {
317
- description: 'External integration connectors',
318
- tools: [
319
- { name: 'get_connectors', brief: 'List project connectors' },
320
- { name: 'get_connector', brief: 'Get connector details' },
321
- { name: 'add_connector', brief: 'Create new connector' },
322
- { name: 'update_connector', brief: 'Update connector config' },
323
- { name: 'delete_connector', brief: 'Remove connector' },
324
- { name: 'test_connector', brief: 'Send test event' },
325
- { name: 'get_connector_events', brief: 'Event history' },
326
- ],
327
- },
328
- cloud_agents: {
329
- description: 'Cloud agent management and cleanup',
330
- tools: [
331
- { name: 'update_agent_status', brief: 'Update agent dashboard status message' },
332
- { name: 'cleanup_stale_cloud_agents', brief: 'Clean up stale cloud agents' },
333
- { name: 'list_cloud_agents', brief: 'List cloud agents for project' },
334
- ],
335
- },
336
- chat: {
337
- description: 'Project-wide chat channel for agent and user communication',
338
- tools: [
339
- { name: 'send_project_message', brief: 'Send a message to the project chat' },
340
- { name: 'get_project_messages', brief: 'Read recent project chat messages' },
341
- { name: 'post_progress', brief: 'Post a structured progress update (info/milestone/blocker/question)' },
342
- ],
343
- },
344
- version: {
345
- description: 'MCP server version management and updates',
346
- tools: [
347
- { name: 'check_mcp_version', brief: 'Check for MCP server updates' },
348
- { name: 'update_mcp_server', brief: 'Self-update the MCP server' },
349
- ],
350
- },
351
- persona_templates: {
352
- description: 'Persona templates — behavioral archetypes that shape agent behavior',
353
- tools: [
354
- { name: 'get_persona_templates', brief: 'List available persona templates for a project' },
355
- ],
356
- },
357
- features: {
358
- description: 'Feature specs — flesh out ideas into full specs before breaking into tasks',
359
- tools: [
360
- { name: 'add_feature', brief: 'Create a draft feature spec' },
361
- { name: 'update_feature', brief: 'Update feature details or status' },
362
- { name: 'get_feature', brief: 'Get a single feature by ID' },
363
- { name: 'get_features', brief: 'List features for a project' },
364
- { name: 'delete_feature', brief: 'Delete a feature' },
365
- { name: 'link_idea_to_feature', brief: 'Link an idea to a feature' },
366
- ],
367
- },
368
- };
369
-
370
- export const discoverTools: Handler = async (args) => {
371
- const { category } = parseArgs(args, discoverToolsSchema);
372
-
373
- if (category) {
374
- // Return tools in specific category
375
- const cat = TOOL_CATEGORIES[category];
376
- if (!cat) {
377
- return {
378
- result: {
379
- error: `Unknown category: ${category}`,
380
- available: Object.keys(TOOL_CATEGORIES),
381
- },
382
- };
383
- }
384
- return {
385
- result: {
386
- category,
387
- description: cat.description,
388
- tools: cat.tools,
389
- },
390
- };
391
- }
392
-
393
- // Return all categories with tool counts
394
- const categories = Object.entries(TOOL_CATEGORIES).map(([name, cat]) => ({
395
- name,
396
- description: cat.description,
397
- tool_count: cat.tools.length,
398
- }));
399
-
400
- return {
401
- result: {
402
- categories,
403
- total_tools: categories.reduce((sum, c) => sum + c.tool_count, 0),
404
- usage: 'Call discover_tools(category) to list tools, get_tool_info(tool_name) for details',
405
- },
406
- };
407
- };
408
-
409
- export const getToolInfo: Handler = async (args) => {
410
- const { tool_name } = parseArgs(args, getToolInfoSchema);
411
-
412
- // Lazy-load tool documentation
413
- const toolDocs = await getToolDocs();
414
- const info = toolDocs[tool_name];
415
- if (!info) {
416
- return {
417
- result: {
418
- error: `Unknown tool: ${tool_name}`,
419
- hint: 'Use discover_tools() to list available tools',
420
- },
421
- };
422
- }
423
-
424
- return { result: { tool: tool_name, info } };
425
- };
426
-
427
- /**
428
- * Discovery handlers registry
429
- */
430
- export const discoveryHandlers: HandlerRegistry = {
431
- discover_tools: discoverTools,
432
- get_tool_info: getToolInfo,
433
- };
1
+ /**
2
+ * Discovery Handlers
3
+ *
4
+ * Handles tool discovery and documentation:
5
+ * - discover_tools
6
+ * - get_tool_info
7
+ *
8
+ * Note: Tool documentation is lazy-loaded from tool-docs.ts to save tokens.
9
+ * This saves ~8,000 tokens per schema load.
10
+ */
11
+
12
+ import type { Handler, HandlerRegistry } from './types.js';
13
+ import { parseArgs } from '../validators.js';
14
+
15
+ // Argument schemas for type-safe parsing
16
+ const discoverToolsSchema = {
17
+ category: { type: 'string' as const },
18
+ };
19
+
20
+ const getToolInfoSchema = {
21
+ tool_name: { type: 'string' as const, required: true as const },
22
+ };
23
+
24
+ // Lazy-loaded tool documentation cache
25
+ let toolInfoCache: Record<string, string> | null = null;
26
+
27
+ /**
28
+ * Lazy-load tool documentation.
29
+ * Only loads the TOOL_INFO module when get_tool_info is called.
30
+ */
31
+ async function getToolDocs(): Promise<Record<string, string>> {
32
+ if (toolInfoCache) {
33
+ return toolInfoCache;
34
+ }
35
+
36
+ const { TOOL_INFO } = await import('./tool-docs.js');
37
+ toolInfoCache = TOOL_INFO;
38
+ return toolInfoCache;
39
+ }
40
+
41
+ // Tool categories with brief descriptions (exported for documentation generation)
42
+ export const TOOL_CATEGORIES: Record<string, { description: string; tools: Array<{ name: string; brief: string }> }> = {
43
+ session: {
44
+ description: 'Session lifecycle and monitoring',
45
+ tools: [
46
+ { name: 'start_work_session', brief: 'Initialize session, get next task' },
47
+ { name: 'get_help', brief: 'Get workflow guidance' },
48
+ { name: 'get_token_usage', brief: 'View token stats' },
49
+ { name: 'report_token_usage', brief: 'Report actual Claude API usage' },
50
+ { name: 'heartbeat', brief: 'Maintain active status' },
51
+ { name: 'signal_idle', brief: 'Signal agent is idle' },
52
+ { name: 'end_work_session', brief: 'End session, release tasks' },
53
+ { name: 'confirm_agent_setup', brief: 'Mark agent setup as complete' },
54
+ ],
55
+ },
56
+ project: {
57
+ description: 'Project CRUD and configuration',
58
+ tools: [
59
+ { name: 'get_project_context', brief: 'Full project info' },
60
+ { name: 'get_project_summary', brief: 'Unified stats overview' },
61
+ { name: 'get_git_workflow', brief: 'Git branching config' },
62
+ { name: 'create_project', brief: 'Create new project' },
63
+ { name: 'update_project', brief: 'Modify project settings' },
64
+ { name: 'update_project_readme', brief: 'Sync README to dashboard' },
65
+ ],
66
+ },
67
+ tasks: {
68
+ description: 'Task management and tracking',
69
+ tools: [
70
+ { name: 'get_task', brief: 'Get single task by ID' },
71
+ { name: 'search_tasks', brief: 'Text search tasks' },
72
+ { name: 'get_tasks_by_priority', brief: 'Filter tasks by priority' },
73
+ { name: 'get_recent_tasks', brief: 'Get oldest/newest tasks' },
74
+ { name: 'get_task_stats', brief: 'Get aggregate task counts' },
75
+ { name: 'get_next_task', brief: 'Get highest priority task' },
76
+ { name: 'add_task', brief: 'Create new task' },
77
+ { name: 'update_task', brief: 'Update task status/progress' },
78
+ { name: 'complete_task', brief: 'Mark task done' },
79
+ { name: 'delete_task', brief: 'Remove a task' },
80
+ { name: 'cancel_task', brief: 'Cancel task with reason' },
81
+ { name: 'release_task', brief: 'Unclaim task to pending' },
82
+ { name: 'batch_update_tasks', brief: 'Update multiple tasks' },
83
+ { name: 'batch_complete_tasks', brief: 'Complete multiple tasks' },
84
+ { name: 'add_task_reference', brief: 'Add URL to task' },
85
+ { name: 'remove_task_reference', brief: 'Remove URL from task' },
86
+ ],
87
+ },
88
+ milestones: {
89
+ description: 'Task breakdown into steps',
90
+ tools: [
91
+ { name: 'add_milestone', brief: 'Add step to task' },
92
+ { name: 'update_milestone', brief: 'Update milestone' },
93
+ { name: 'complete_milestone', brief: 'Mark step done' },
94
+ { name: 'delete_milestone', brief: 'Remove milestone' },
95
+ { name: 'get_milestones', brief: 'List task milestones' },
96
+ ],
97
+ },
98
+ progress: {
99
+ description: 'Progress logging and activity',
100
+ tools: [
101
+ { name: 'log_progress', brief: 'Record progress update' },
102
+ { name: 'get_activity_feed', brief: 'Combined activity feed' },
103
+ ],
104
+ },
105
+ blockers: {
106
+ description: 'Blocker management',
107
+ tools: [
108
+ { name: 'add_blocker', brief: 'Record a blocker' },
109
+ { name: 'resolve_blocker', brief: 'Mark resolved' },
110
+ { name: 'get_blocker', brief: 'Get single blocker' },
111
+ { name: 'get_blockers', brief: 'List blockers' },
112
+ { name: 'get_blockers_stats', brief: 'Get blocker statistics' },
113
+ { name: 'delete_blocker', brief: 'Remove blocker' },
114
+ ],
115
+ },
116
+ decisions: {
117
+ description: 'Architectural decisions',
118
+ tools: [
119
+ { name: 'log_decision', brief: 'Record decision' },
120
+ { name: 'get_decision', brief: 'Get single decision' },
121
+ { name: 'get_decisions', brief: 'List decisions' },
122
+ { name: 'get_decisions_stats', brief: 'Get decision statistics' },
123
+ { name: 'delete_decision', brief: 'Remove decision' },
124
+ ],
125
+ },
126
+ ideas: {
127
+ description: 'Feature ideas tracking',
128
+ tools: [
129
+ { name: 'add_idea', brief: 'Record an idea' },
130
+ { name: 'update_idea', brief: 'Update idea status' },
131
+ { name: 'get_idea', brief: 'Get single idea' },
132
+ { name: 'get_ideas', brief: 'List ideas' },
133
+ { name: 'delete_idea', brief: 'Remove idea' },
134
+ { name: 'convert_idea_to_task', brief: 'Convert idea to task' },
135
+ ],
136
+ },
137
+ findings: {
138
+ description: 'Audit findings/knowledge base',
139
+ tools: [
140
+ { name: 'add_finding', brief: 'Record audit finding' },
141
+ { name: 'get_finding', brief: 'Get single finding' },
142
+ { name: 'get_findings', brief: 'List findings' },
143
+ { name: 'get_findings_stats', brief: 'Get findings statistics' },
144
+ { name: 'update_finding', brief: 'Update finding status' },
145
+ { name: 'delete_finding', brief: 'Remove finding' },
146
+ ],
147
+ },
148
+ validation: {
149
+ description: 'Cross-agent task validation',
150
+ tools: [
151
+ { name: 'get_tasks_awaiting_validation', brief: 'Unvalidated tasks' },
152
+ { name: 'claim_validation', brief: 'Claim task for review' },
153
+ { name: 'validate_task', brief: 'Approve/reject task' },
154
+ ],
155
+ },
156
+ deployment: {
157
+ description: 'Deployment coordination',
158
+ tools: [
159
+ { name: 'request_deployment', brief: 'Request deploy' },
160
+ { name: 'claim_deployment_validation', brief: 'Claim for validation' },
161
+ { name: 'report_validation', brief: 'Report build/test results' },
162
+ { name: 'check_deployment_status', brief: 'Get deploy status' },
163
+ { name: 'start_deployment', brief: 'Begin deployment' },
164
+ { name: 'complete_deployment', brief: 'Mark deploy done' },
165
+ { name: 'cancel_deployment', brief: 'Cancel deployment' },
166
+ { name: 'add_deployment_requirement', brief: 'Add pre-deploy step' },
167
+ { name: 'complete_deployment_requirement', brief: 'Mark step done' },
168
+ { name: 'get_deployment_requirements', brief: 'List pre-deploy steps' },
169
+ { name: 'get_deployment_requirements_stats', brief: 'Get requirements statistics' },
170
+ { name: 'reorder_deployment_requirements', brief: 'Reorder steps within a stage' },
171
+ { name: 'schedule_deployment', brief: 'Schedule future deployment' },
172
+ { name: 'get_scheduled_deployments', brief: 'List scheduled deployments' },
173
+ { name: 'update_scheduled_deployment', brief: 'Update schedule config' },
174
+ { name: 'delete_scheduled_deployment', brief: 'Delete schedule' },
175
+ { name: 'trigger_scheduled_deployment', brief: 'Manual trigger' },
176
+ { name: 'check_due_deployments', brief: 'Check due schedules' },
177
+ ],
178
+ },
179
+ fallback: {
180
+ description: 'Background activities when idle',
181
+ tools: [
182
+ { name: 'start_fallback_activity', brief: 'Start background work' },
183
+ { name: 'stop_fallback_activity', brief: 'Stop background work' },
184
+ { name: 'get_activity_history', brief: 'Activity history' },
185
+ { name: 'get_activity_schedules', brief: 'Activity schedules' },
186
+ ],
187
+ },
188
+ bodies_of_work: {
189
+ description: 'Group tasks into bodies of work',
190
+ tools: [
191
+ { name: 'create_body_of_work', brief: 'Create task group' },
192
+ { name: 'update_body_of_work', brief: 'Update settings' },
193
+ { name: 'get_body_of_work', brief: 'Get with tasks' },
194
+ { name: 'get_bodies_of_work', brief: 'List bodies of work' },
195
+ { name: 'delete_body_of_work', brief: 'Remove body of work' },
196
+ { name: 'add_task_to_body_of_work', brief: 'Add task to group' },
197
+ { name: 'remove_task_from_body_of_work', brief: 'Remove from group' },
198
+ { name: 'activate_body_of_work', brief: 'Activate for work' },
199
+ { name: 'add_task_dependency', brief: 'Add task dependency' },
200
+ { name: 'remove_task_dependency', brief: 'Remove task dependency' },
201
+ { name: 'get_task_dependencies', brief: 'List task dependencies' },
202
+ { name: 'get_next_body_of_work_task', brief: 'Get next available task' },
203
+ ],
204
+ },
205
+ sprints: {
206
+ description: 'Time-bounded sprints with velocity tracking',
207
+ tools: [
208
+ { name: 'create_sprint', brief: 'Create new sprint' },
209
+ { name: 'update_sprint', brief: 'Update sprint details' },
210
+ { name: 'get_sprint', brief: 'Get sprint with tasks' },
211
+ { name: 'get_sprints', brief: 'List project sprints' },
212
+ { name: 'delete_sprint', brief: 'Delete sprint' },
213
+ { name: 'start_sprint', brief: 'Start sprint' },
214
+ { name: 'complete_sprint', brief: 'Complete sprint' },
215
+ { name: 'add_task_to_sprint', brief: 'Add task to sprint' },
216
+ { name: 'remove_task_from_sprint', brief: 'Remove from sprint' },
217
+ { name: 'get_sprint_backlog', brief: 'Get available tasks (paginated)' },
218
+ { name: 'get_sprint_velocity', brief: 'Velocity metrics' },
219
+ ],
220
+ },
221
+ requests: {
222
+ description: 'User request handling',
223
+ tools: [
224
+ { name: 'get_pending_requests', brief: 'Unhandled requests' },
225
+ { name: 'acknowledge_request', brief: 'Mark handled' },
226
+ { name: 'answer_question', brief: 'Answer user question' },
227
+ ],
228
+ },
229
+ organizations: {
230
+ description: 'Organization and team management',
231
+ tools: [
232
+ // REMOVED: list_organizations - use dashboard
233
+ { name: 'create_organization', brief: 'Create new org' },
234
+ { name: 'update_organization', brief: 'Update org settings' },
235
+ { name: 'delete_organization', brief: 'Delete org' },
236
+ // REMOVED: list_org_members - use dashboard
237
+ { name: 'invite_member', brief: 'Invite by email' },
238
+ { name: 'update_member_role', brief: 'Change member role' },
239
+ { name: 'remove_member', brief: 'Remove from org' },
240
+ { name: 'leave_organization', brief: 'Leave an org' },
241
+ { name: 'share_project_with_org', brief: 'Share project' },
242
+ { name: 'update_project_share', brief: 'Update share perms' },
243
+ { name: 'unshare_project', brief: 'Remove share' },
244
+ // REMOVED: list_project_shares - use dashboard
245
+ ],
246
+ },
247
+ cost: {
248
+ description: 'Cost monitoring and alerts',
249
+ tools: [
250
+ { name: 'get_cost_summary', brief: 'Cost by period (paginated)' },
251
+ // REMOVED: get_cost_alerts - use dashboard
252
+ { name: 'add_cost_alert', brief: 'Add threshold alert' },
253
+ { name: 'update_cost_alert', brief: 'Update alert config' },
254
+ { name: 'delete_cost_alert', brief: 'Remove alert' },
255
+ // REMOVED: get_task_costs - use get_cost_summary
256
+ // REMOVED: get_body_of_work_costs - use get_cost_summary
257
+ // REMOVED: get_sprint_costs - use get_cost_summary
258
+ ],
259
+ },
260
+ git_issues: {
261
+ description: 'Git conflict and issue tracking',
262
+ tools: [
263
+ { name: 'add_git_issue', brief: 'Record git issue' },
264
+ { name: 'resolve_git_issue', brief: 'Mark resolved' },
265
+ { name: 'get_git_issues', brief: 'List git issues' },
266
+ { name: 'delete_git_issue', brief: 'Delete git issue' },
267
+ ],
268
+ },
269
+ knowledge: {
270
+ description: 'Queryable knowledge base from project data',
271
+ tools: [
272
+ { name: 'query_knowledge_base', brief: 'Aggregated project knowledge in one call' },
273
+ ],
274
+ },
275
+ discovery: {
276
+ description: 'Tool discovery and documentation',
277
+ tools: [
278
+ { name: 'discover_tools', brief: 'List tools by category' },
279
+ { name: 'get_tool_info', brief: 'Get detailed tool docs' },
280
+ ],
281
+ },
282
+ subtasks: {
283
+ description: 'Break tasks into smaller pieces',
284
+ tools: [
285
+ { name: 'add_subtask', brief: 'Add subtask to task' },
286
+ { name: 'get_subtasks', brief: 'List task subtasks (paginated)' },
287
+ ],
288
+ },
289
+ worktrees: {
290
+ description: 'Git worktree management',
291
+ tools: [
292
+ { name: 'get_stale_worktrees', brief: 'Find orphaned worktrees' },
293
+ { name: 'clear_worktree_path', brief: 'Clear worktree from task' },
294
+ ],
295
+ },
296
+ roles: {
297
+ description: 'Agent role management',
298
+ tools: [
299
+ { name: 'get_role_settings', brief: 'Get project role settings' },
300
+ { name: 'update_role_settings', brief: 'Configure role behavior' },
301
+ { name: 'set_session_role', brief: 'Set session role' },
302
+ { name: 'get_agents_by_role', brief: 'List agents by role' },
303
+ ],
304
+ },
305
+ file_locks: {
306
+ description: 'File checkout/locking for multi-agent',
307
+ tools: [
308
+ { name: 'checkout_file', brief: 'Lock file for editing' },
309
+ { name: 'checkin_file', brief: 'Release file lock' },
310
+ { name: 'get_file_checkouts', brief: 'List file locks' },
311
+ { name: 'get_file_checkouts_stats', brief: 'Lock statistics' },
312
+ { name: 'abandon_checkout', brief: 'Force-release lock' },
313
+ { name: 'is_file_available', brief: 'Check if file is free' },
314
+ ],
315
+ },
316
+ connectors: {
317
+ description: 'External integration connectors',
318
+ tools: [
319
+ { name: 'get_connectors', brief: 'List project connectors' },
320
+ { name: 'get_connector', brief: 'Get connector details' },
321
+ { name: 'add_connector', brief: 'Create new connector' },
322
+ { name: 'update_connector', brief: 'Update connector config' },
323
+ { name: 'delete_connector', brief: 'Remove connector' },
324
+ { name: 'test_connector', brief: 'Send test event' },
325
+ { name: 'get_connector_events', brief: 'Event history' },
326
+ ],
327
+ },
328
+ cloud_agents: {
329
+ description: 'Cloud agent management and cleanup',
330
+ tools: [
331
+ { name: 'update_agent_status', brief: 'Update agent dashboard status message' },
332
+ { name: 'cleanup_stale_cloud_agents', brief: 'Clean up stale cloud agents' },
333
+ { name: 'list_cloud_agents', brief: 'List cloud agents for project' },
334
+ ],
335
+ },
336
+ chat: {
337
+ description: 'Project-wide chat channel for agent and user communication',
338
+ tools: [
339
+ { name: 'send_project_message', brief: 'Send a message to the project chat' },
340
+ { name: 'get_project_messages', brief: 'Read recent project chat messages' },
341
+ { name: 'post_progress', brief: 'Post a structured progress update (info/milestone/blocker/question)' },
342
+ ],
343
+ },
344
+ version: {
345
+ description: 'MCP server version management and updates',
346
+ tools: [
347
+ { name: 'check_mcp_version', brief: 'Check for MCP server updates' },
348
+ { name: 'update_mcp_server', brief: 'Self-update the MCP server' },
349
+ ],
350
+ },
351
+ persona_templates: {
352
+ description: 'Persona templates — behavioral archetypes that shape agent behavior',
353
+ tools: [
354
+ { name: 'get_persona_templates', brief: 'List available persona templates for a project' },
355
+ ],
356
+ },
357
+ features: {
358
+ description: 'Feature specs — flesh out ideas into full specs before breaking into tasks',
359
+ tools: [
360
+ { name: 'add_feature', brief: 'Create a draft feature spec' },
361
+ { name: 'update_feature', brief: 'Update feature details or status' },
362
+ { name: 'get_feature', brief: 'Get a single feature by ID' },
363
+ { name: 'get_features', brief: 'List features for a project' },
364
+ { name: 'delete_feature', brief: 'Delete a feature' },
365
+ { name: 'link_idea_to_feature', brief: 'Link an idea to a feature' },
366
+ ],
367
+ },
368
+ };
369
+
370
+ export const discoverTools: Handler = async (args) => {
371
+ const { category } = parseArgs(args, discoverToolsSchema);
372
+
373
+ if (category) {
374
+ // Return tools in specific category
375
+ const cat = TOOL_CATEGORIES[category];
376
+ if (!cat) {
377
+ return {
378
+ result: {
379
+ error: `Unknown category: ${category}`,
380
+ available: Object.keys(TOOL_CATEGORIES),
381
+ },
382
+ };
383
+ }
384
+ return {
385
+ result: {
386
+ category,
387
+ description: cat.description,
388
+ tools: cat.tools,
389
+ },
390
+ };
391
+ }
392
+
393
+ // Return all categories with tool counts
394
+ const categories = Object.entries(TOOL_CATEGORIES).map(([name, cat]) => ({
395
+ name,
396
+ description: cat.description,
397
+ tool_count: cat.tools.length,
398
+ }));
399
+
400
+ return {
401
+ result: {
402
+ categories,
403
+ total_tools: categories.reduce((sum, c) => sum + c.tool_count, 0),
404
+ usage: 'Call discover_tools(category) to list tools, get_tool_info(tool_name) for details',
405
+ },
406
+ };
407
+ };
408
+
409
+ export const getToolInfo: Handler = async (args) => {
410
+ const { tool_name } = parseArgs(args, getToolInfoSchema);
411
+
412
+ // Lazy-load tool documentation
413
+ const toolDocs = await getToolDocs();
414
+ const info = toolDocs[tool_name];
415
+ if (!info) {
416
+ return {
417
+ result: {
418
+ error: `Unknown tool: ${tool_name}`,
419
+ hint: 'Use discover_tools() to list available tools',
420
+ },
421
+ };
422
+ }
423
+
424
+ return { result: { tool: tool_name, info } };
425
+ };
426
+
427
+ /**
428
+ * Discovery handlers registry
429
+ */
430
+ export const discoveryHandlers: HandlerRegistry = {
431
+ discover_tools: discoverTools,
432
+ get_tool_info: getToolInfo,
433
+ };