@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.
- package/CHANGELOG.md +84 -84
- package/README.md +194 -194
- package/dist/api-client/tasks.d.ts +1 -0
- package/dist/cli-init.js +21 -21
- package/dist/cli.js +26 -26
- package/dist/handlers/tasks.js +7 -1
- package/dist/handlers/tool-docs.js +1216 -1216
- package/dist/index.js +73 -73
- package/dist/templates/agent-guidelines.d.ts +1 -1
- package/dist/templates/agent-guidelines.js +205 -205
- package/dist/templates/help-content.js +1621 -1621
- package/dist/tools/bodies-of-work.js +6 -6
- package/dist/tools/cloud-agents.js +22 -22
- package/dist/tools/milestones.js +2 -2
- package/dist/tools/requests.js +1 -1
- package/dist/tools/session.js +11 -11
- package/dist/tools/sprints.js +9 -9
- package/dist/tools/tasks.js +43 -35
- package/dist/tools/worktrees.js +14 -14
- package/dist/utils.js +11 -11
- package/docs/TOOLS.md +2687 -2685
- package/package.json +53 -53
- package/scripts/generate-docs.ts +212 -212
- package/scripts/version-bump.ts +203 -203
- package/src/api-client/blockers.ts +86 -86
- package/src/api-client/bodies-of-work.ts +194 -194
- package/src/api-client/chat.ts +50 -50
- package/src/api-client/connectors.ts +152 -152
- package/src/api-client/cost.ts +185 -185
- package/src/api-client/decisions.ts +87 -87
- package/src/api-client/deployment.ts +313 -313
- package/src/api-client/discovery.ts +81 -81
- package/src/api-client/fallback.ts +52 -52
- package/src/api-client/file-checkouts.ts +115 -115
- package/src/api-client/findings.ts +100 -100
- package/src/api-client/git-issues.ts +88 -88
- package/src/api-client/ideas.ts +112 -112
- package/src/api-client/index.ts +592 -592
- package/src/api-client/milestones.ts +83 -83
- package/src/api-client/organizations.ts +185 -185
- package/src/api-client/progress.ts +94 -94
- package/src/api-client/project.ts +181 -181
- package/src/api-client/requests.ts +54 -54
- package/src/api-client/session.ts +220 -220
- package/src/api-client/sprints.ts +227 -227
- package/src/api-client/subtasks.ts +57 -57
- package/src/api-client/tasks.ts +451 -450
- package/src/api-client/types.ts +32 -32
- package/src/api-client/validation.ts +60 -60
- package/src/api-client/worktrees.ts +53 -53
- package/src/api-client.test.ts +847 -847
- package/src/api-client.ts +2728 -2728
- package/src/cli-init.ts +558 -558
- package/src/cli.test.ts +284 -284
- package/src/cli.ts +204 -204
- package/src/handlers/__test-setup__.ts +240 -240
- package/src/handlers/__test-utils__.ts +89 -89
- package/src/handlers/blockers.test.ts +468 -468
- package/src/handlers/blockers.ts +172 -172
- package/src/handlers/bodies-of-work.test.ts +704 -704
- package/src/handlers/bodies-of-work.ts +526 -526
- package/src/handlers/chat.test.ts +185 -185
- package/src/handlers/chat.ts +101 -101
- package/src/handlers/cloud-agents.test.ts +438 -438
- package/src/handlers/cloud-agents.ts +156 -156
- package/src/handlers/connectors.test.ts +834 -834
- package/src/handlers/connectors.ts +229 -229
- package/src/handlers/cost.test.ts +462 -462
- package/src/handlers/cost.ts +285 -285
- package/src/handlers/decisions.test.ts +382 -382
- package/src/handlers/decisions.ts +153 -153
- package/src/handlers/deployment.test.ts +551 -551
- package/src/handlers/deployment.ts +570 -570
- package/src/handlers/discovery.test.ts +206 -206
- package/src/handlers/discovery.ts +433 -433
- package/src/handlers/fallback.test.ts +537 -537
- package/src/handlers/fallback.ts +194 -194
- package/src/handlers/file-checkouts.test.ts +750 -750
- package/src/handlers/file-checkouts.ts +185 -185
- package/src/handlers/findings.test.ts +633 -633
- package/src/handlers/findings.ts +239 -239
- package/src/handlers/git-issues.test.ts +631 -631
- package/src/handlers/git-issues.ts +136 -136
- package/src/handlers/ideas.test.ts +644 -644
- package/src/handlers/ideas.ts +207 -207
- package/src/handlers/index.ts +93 -93
- package/src/handlers/milestones.test.ts +475 -475
- package/src/handlers/milestones.ts +180 -180
- package/src/handlers/organizations.test.ts +826 -826
- package/src/handlers/organizations.ts +315 -315
- package/src/handlers/progress.test.ts +269 -269
- package/src/handlers/progress.ts +77 -77
- package/src/handlers/project.test.ts +546 -546
- package/src/handlers/project.ts +245 -245
- package/src/handlers/requests.test.ts +303 -303
- package/src/handlers/requests.ts +99 -99
- package/src/handlers/roles.test.ts +305 -305
- package/src/handlers/roles.ts +219 -219
- package/src/handlers/session.test.ts +998 -998
- package/src/handlers/session.ts +1105 -1105
- package/src/handlers/sprints.test.ts +732 -732
- package/src/handlers/sprints.ts +537 -537
- package/src/handlers/tasks.test.ts +931 -931
- package/src/handlers/tasks.ts +1144 -1137
- package/src/handlers/tool-categories.test.ts +66 -66
- package/src/handlers/tool-docs.test.ts +511 -511
- package/src/handlers/tool-docs.ts +1595 -1595
- package/src/handlers/types.test.ts +259 -259
- package/src/handlers/types.ts +176 -176
- package/src/handlers/validation.test.ts +582 -582
- package/src/handlers/validation.ts +164 -164
- package/src/handlers/version.ts +63 -63
- package/src/index.test.ts +674 -674
- package/src/index.ts +884 -884
- package/src/setup.test.ts +243 -243
- package/src/setup.ts +410 -410
- package/src/templates/agent-guidelines.ts +233 -233
- package/src/templates/help-content.ts +1751 -1751
- package/src/token-tracking.test.ts +463 -463
- package/src/token-tracking.ts +167 -167
- package/src/tools/blockers.ts +122 -122
- package/src/tools/bodies-of-work.ts +283 -283
- package/src/tools/chat.ts +72 -72
- package/src/tools/cloud-agents.ts +101 -101
- package/src/tools/connectors.ts +191 -191
- package/src/tools/cost.ts +111 -111
- package/src/tools/decisions.ts +111 -111
- package/src/tools/deployment.ts +455 -455
- package/src/tools/discovery.ts +76 -76
- package/src/tools/fallback.ts +111 -111
- package/src/tools/features.ts +154 -154
- package/src/tools/file-checkouts.ts +145 -145
- package/src/tools/findings.ts +101 -101
- package/src/tools/git-issues.ts +130 -130
- package/src/tools/ideas.ts +162 -162
- package/src/tools/index.ts +145 -145
- package/src/tools/milestones.ts +118 -118
- package/src/tools/organizations.ts +224 -224
- package/src/tools/persona-templates.ts +25 -25
- package/src/tools/progress.ts +73 -73
- package/src/tools/project.ts +210 -210
- package/src/tools/requests.ts +68 -68
- package/src/tools/roles.ts +112 -112
- package/src/tools/session.ts +181 -181
- package/src/tools/sprints.ts +298 -298
- package/src/tools/tasks.ts +583 -575
- package/src/tools/tools.test.ts +222 -222
- package/src/tools/types.ts +9 -9
- package/src/tools/validation.ts +75 -75
- package/src/tools/version.ts +34 -34
- package/src/tools/worktrees.ts +66 -66
- package/src/tools.test.ts +416 -416
- package/src/utils.test.ts +1014 -1014
- package/src/utils.ts +586 -586
- package/src/validators.test.ts +223 -223
- package/src/validators.ts +249 -249
- package/src/version.ts +162 -162
- package/tsconfig.json +16 -16
- package/vitest.config.ts +14 -14
package/src/tools/roles.ts
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Role Tool Definitions
|
|
3
|
-
*
|
|
4
|
-
* Tools for managing agent roles:
|
|
5
|
-
* - get_role_settings
|
|
6
|
-
* - update_role_settings
|
|
7
|
-
* - set_session_role
|
|
8
|
-
* - get_agents_by_role
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type { Tool } from './types.js';
|
|
12
|
-
|
|
13
|
-
export const roleTools: Tool[] = [
|
|
14
|
-
{
|
|
15
|
-
name: 'get_role_settings',
|
|
16
|
-
description: 'Get role configuration for a project. Shows available roles and their settings.',
|
|
17
|
-
inputSchema: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {
|
|
20
|
-
project_id: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
description: 'Project UUID',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
required: ['project_id'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'update_role_settings',
|
|
30
|
-
description: 'Update role settings for a project. Configure which roles are enabled and their behavior.',
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: 'object',
|
|
33
|
-
properties: {
|
|
34
|
-
project_id: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Project UUID',
|
|
37
|
-
},
|
|
38
|
-
role: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'Role to configure (e.g., "developer", "validator", "deployer"). Custom roles accepted.',
|
|
41
|
-
},
|
|
42
|
-
enabled: {
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
description: 'Enable or disable this role',
|
|
45
|
-
},
|
|
46
|
-
display_name: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'Custom display name for this role',
|
|
49
|
-
},
|
|
50
|
-
description: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
description: 'Description of what this role does',
|
|
53
|
-
},
|
|
54
|
-
priority_filter: {
|
|
55
|
-
type: 'array',
|
|
56
|
-
items: { type: 'number' },
|
|
57
|
-
description: 'Only show tasks with these priorities (1-5)',
|
|
58
|
-
},
|
|
59
|
-
fallback_activities: {
|
|
60
|
-
type: 'array',
|
|
61
|
-
items: { type: 'string' },
|
|
62
|
-
description: 'Preferred fallback activities for this role',
|
|
63
|
-
},
|
|
64
|
-
auto_assign_validation: {
|
|
65
|
-
type: 'boolean',
|
|
66
|
-
description: 'Auto-assign validation tasks to agents with this role',
|
|
67
|
-
},
|
|
68
|
-
auto_assign_deployment: {
|
|
69
|
-
type: 'boolean',
|
|
70
|
-
description: 'Auto-assign deployment tasks to agents with this role',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
required: ['project_id', 'role'],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'set_session_role',
|
|
78
|
-
description: 'Set the role for your current session. Changes task filtering and fallback activity suggestions.',
|
|
79
|
-
inputSchema: {
|
|
80
|
-
type: 'object',
|
|
81
|
-
properties: {
|
|
82
|
-
role: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: 'Role to assign to this session (e.g., "developer", "validator", "deployer"). Custom roles accepted.',
|
|
85
|
-
},
|
|
86
|
-
role_config: {
|
|
87
|
-
type: 'object',
|
|
88
|
-
description: 'Custom configuration for specialist role (optional)',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
required: ['role'],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'get_agents_by_role',
|
|
96
|
-
description: 'Get active agents grouped by their assigned roles. See who is working on what.',
|
|
97
|
-
inputSchema: {
|
|
98
|
-
type: 'object',
|
|
99
|
-
properties: {
|
|
100
|
-
project_id: {
|
|
101
|
-
type: 'string',
|
|
102
|
-
description: 'Project UUID',
|
|
103
|
-
},
|
|
104
|
-
counts_only: {
|
|
105
|
-
type: 'boolean',
|
|
106
|
-
description: 'When true (default), returns only counts per role to save tokens. Set to false for full agent details.',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
required: ['project_id'],
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
];
|
|
1
|
+
/**
|
|
2
|
+
* Role Tool Definitions
|
|
3
|
+
*
|
|
4
|
+
* Tools for managing agent roles:
|
|
5
|
+
* - get_role_settings
|
|
6
|
+
* - update_role_settings
|
|
7
|
+
* - set_session_role
|
|
8
|
+
* - get_agents_by_role
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { Tool } from './types.js';
|
|
12
|
+
|
|
13
|
+
export const roleTools: Tool[] = [
|
|
14
|
+
{
|
|
15
|
+
name: 'get_role_settings',
|
|
16
|
+
description: 'Get role configuration for a project. Shows available roles and their settings.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
project_id: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Project UUID',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['project_id'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'update_role_settings',
|
|
30
|
+
description: 'Update role settings for a project. Configure which roles are enabled and their behavior.',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
project_id: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Project UUID',
|
|
37
|
+
},
|
|
38
|
+
role: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'Role to configure (e.g., "developer", "validator", "deployer"). Custom roles accepted.',
|
|
41
|
+
},
|
|
42
|
+
enabled: {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
description: 'Enable or disable this role',
|
|
45
|
+
},
|
|
46
|
+
display_name: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Custom display name for this role',
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'Description of what this role does',
|
|
53
|
+
},
|
|
54
|
+
priority_filter: {
|
|
55
|
+
type: 'array',
|
|
56
|
+
items: { type: 'number' },
|
|
57
|
+
description: 'Only show tasks with these priorities (1-5)',
|
|
58
|
+
},
|
|
59
|
+
fallback_activities: {
|
|
60
|
+
type: 'array',
|
|
61
|
+
items: { type: 'string' },
|
|
62
|
+
description: 'Preferred fallback activities for this role',
|
|
63
|
+
},
|
|
64
|
+
auto_assign_validation: {
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
description: 'Auto-assign validation tasks to agents with this role',
|
|
67
|
+
},
|
|
68
|
+
auto_assign_deployment: {
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
description: 'Auto-assign deployment tasks to agents with this role',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
required: ['project_id', 'role'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'set_session_role',
|
|
78
|
+
description: 'Set the role for your current session. Changes task filtering and fallback activity suggestions.',
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
role: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Role to assign to this session (e.g., "developer", "validator", "deployer"). Custom roles accepted.',
|
|
85
|
+
},
|
|
86
|
+
role_config: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
description: 'Custom configuration for specialist role (optional)',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ['role'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'get_agents_by_role',
|
|
96
|
+
description: 'Get active agents grouped by their assigned roles. See who is working on what.',
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
project_id: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Project UUID',
|
|
103
|
+
},
|
|
104
|
+
counts_only: {
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
description: 'When true (default), returns only counts per role to save tokens. Set to false for full agent details.',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
required: ['project_id'],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
];
|
package/src/tools/session.ts
CHANGED
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Tool Definitions
|
|
3
|
-
*
|
|
4
|
-
* Tools for managing agent work sessions:
|
|
5
|
-
* - start_work_session
|
|
6
|
-
* - confirm_agent_setup
|
|
7
|
-
* - get_help
|
|
8
|
-
* - get_token_usage
|
|
9
|
-
* - report_token_usage
|
|
10
|
-
* - heartbeat
|
|
11
|
-
* - end_work_session
|
|
12
|
-
* - signal_idle
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
16
|
-
|
|
17
|
-
export const sessionTools: Tool[] = [
|
|
18
|
-
{
|
|
19
|
-
name: 'start_work_session',
|
|
20
|
-
description: `CALL THIS FIRST when beginning work on a project.
|
|
21
|
-
Returns session info, persona, role, and next_task. Start the next_task IMMEDIATELY without asking the user.
|
|
22
|
-
|
|
23
|
-
IMPORTANT: If the user gives you direct work that isn't tracked as a task (e.g., "add feature X", "fix bug Y"), you MUST call add_task() first to create a task before starting work. This ensures all work is tracked and visible on the dashboard.
|
|
24
|
-
|
|
25
|
-
Use mode:'full' for complete context, mode:'lite' (default) for minimal tokens.`,
|
|
26
|
-
inputSchema: {
|
|
27
|
-
type: 'object',
|
|
28
|
-
properties: {
|
|
29
|
-
project_id: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
description: 'Project UUID',
|
|
32
|
-
},
|
|
33
|
-
git_url: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: 'Git repository URL. Used to find project if project_id not provided.',
|
|
36
|
-
},
|
|
37
|
-
mode: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
enum: ['lite', 'full'],
|
|
40
|
-
description: 'Response mode: lite (default, minimal tokens) or full (complete context)',
|
|
41
|
-
},
|
|
42
|
-
model: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Model being used for cost tracking. E.g., "opus", "sonnet", "haiku" for Claude, "gemini" for Gemini, "gpt-4o" for OpenAI.',
|
|
45
|
-
},
|
|
46
|
-
role: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'Agent role (e.g., "developer", "validator", "deployer", "reviewer", "maintainer"). Custom roles accepted.',
|
|
49
|
-
},
|
|
50
|
-
hostname: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
description: 'Machine hostname for worktree tracking. Pass os.hostname() to filter stale worktrees to only those created on this machine.',
|
|
53
|
-
},
|
|
54
|
-
agent_type: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
description: 'Agent type (e.g., "claude", "gemini", "cursor", "windsurf"). Custom agent types accepted.',
|
|
57
|
-
},
|
|
58
|
-
agent_name: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
description: 'Explicit agent name (for cloud/remote agents). If provided, uses this name instead of selecting from persona pool. Cloud agents should pass their spawner-assigned name.',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'confirm_agent_setup',
|
|
67
|
-
description: `Confirm that agent setup is complete for this project. Call this after creating your agent's configuration file (e.g., .claude/CLAUDE.md, .gemini/GEMINI.md).
|
|
68
|
-
|
|
69
|
-
This marks your agent type as fully onboarded to the project, so you won't receive setup instructions again.`,
|
|
70
|
-
inputSchema: {
|
|
71
|
-
type: 'object',
|
|
72
|
-
properties: {
|
|
73
|
-
project_id: {
|
|
74
|
-
type: 'string',
|
|
75
|
-
description: 'Project UUID',
|
|
76
|
-
},
|
|
77
|
-
agent_type: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'Agent type that completed setup (e.g., "claude", "gemini", "cursor"). Custom agent types accepted.',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
required: ['project_id', 'agent_type'],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'get_help',
|
|
87
|
-
description: 'Get guidance on a specific topic. Use when unsure about workflows.',
|
|
88
|
-
inputSchema: {
|
|
89
|
-
type: 'object',
|
|
90
|
-
properties: {
|
|
91
|
-
topic: {
|
|
92
|
-
type: 'string',
|
|
93
|
-
enum: ['getting_started', 'tasks', 'validation', 'deployment', 'git', 'blockers', 'milestones', 'fallback', 'session', 'tokens', 'roles', 'knowledge', 'topics'],
|
|
94
|
-
description: 'Help topic. Use "topics" to list all available.',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
required: ['topic'],
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'get_token_usage',
|
|
102
|
-
description: 'Get token usage stats for this session. Monitor efficiency.',
|
|
103
|
-
inputSchema: {
|
|
104
|
-
type: 'object',
|
|
105
|
-
properties: {},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'report_token_usage',
|
|
110
|
-
description: `Report actual Claude API token usage for accurate cost tracking.
|
|
111
|
-
|
|
112
|
-
IMPORTANT: MCP can only estimate tokens from tool I/O (~1-5% of actual usage). Call this tool after each API response to report actual usage from the Claude API response headers.
|
|
113
|
-
|
|
114
|
-
The Claude API response includes 'usage.input_tokens' and 'usage.output_tokens' - pass those values here for accurate cost attribution.`,
|
|
115
|
-
inputSchema: {
|
|
116
|
-
type: 'object',
|
|
117
|
-
properties: {
|
|
118
|
-
input_tokens: {
|
|
119
|
-
type: 'number',
|
|
120
|
-
description: 'Input tokens from Claude API response (usage.input_tokens)',
|
|
121
|
-
},
|
|
122
|
-
output_tokens: {
|
|
123
|
-
type: 'number',
|
|
124
|
-
description: 'Output tokens from Claude API response (usage.output_tokens)',
|
|
125
|
-
},
|
|
126
|
-
model: {
|
|
127
|
-
type: 'string',
|
|
128
|
-
description: 'Model used for this API call (optional, uses session model if not provided)',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
required: ['input_tokens', 'output_tokens'],
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: 'heartbeat',
|
|
136
|
-
description: `Send heartbeat to maintain 'active' status. Call every 30-60 seconds.`,
|
|
137
|
-
inputSchema: {
|
|
138
|
-
type: 'object',
|
|
139
|
-
properties: {
|
|
140
|
-
session_id: {
|
|
141
|
-
type: 'string',
|
|
142
|
-
description: 'Session ID from start_work_session (optional, uses current session if not provided)',
|
|
143
|
-
},
|
|
144
|
-
current_worktree_path: {
|
|
145
|
-
type: ['string', 'null'],
|
|
146
|
-
description: 'Report your current git worktree path (e.g., "../project-task-abc123"). Set to null to clear.',
|
|
147
|
-
},
|
|
148
|
-
hostname: {
|
|
149
|
-
type: 'string',
|
|
150
|
-
description: 'Machine hostname (os.hostname()). Updates session hostname for worktree tracking.',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'end_work_session',
|
|
157
|
-
description: `End session and release claimed tasks. Returns session summary.`,
|
|
158
|
-
inputSchema: {
|
|
159
|
-
type: 'object',
|
|
160
|
-
properties: {
|
|
161
|
-
session_id: {
|
|
162
|
-
type: 'string',
|
|
163
|
-
description: 'Session ID to end (optional, uses current session if not provided)',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: 'signal_idle',
|
|
170
|
-
description: `Signal that agent is idle (no more tasks). Call this when complete_task returns no next_task or when there's no work available. This provides real-time visibility on the dashboard instead of waiting for heartbeat timeout.`,
|
|
171
|
-
inputSchema: {
|
|
172
|
-
type: 'object',
|
|
173
|
-
properties: {
|
|
174
|
-
session_id: {
|
|
175
|
-
type: 'string',
|
|
176
|
-
description: 'Session ID (optional, uses current session if not provided)',
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
];
|
|
1
|
+
/**
|
|
2
|
+
* Session Tool Definitions
|
|
3
|
+
*
|
|
4
|
+
* Tools for managing agent work sessions:
|
|
5
|
+
* - start_work_session
|
|
6
|
+
* - confirm_agent_setup
|
|
7
|
+
* - get_help
|
|
8
|
+
* - get_token_usage
|
|
9
|
+
* - report_token_usage
|
|
10
|
+
* - heartbeat
|
|
11
|
+
* - end_work_session
|
|
12
|
+
* - signal_idle
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
16
|
+
|
|
17
|
+
export const sessionTools: Tool[] = [
|
|
18
|
+
{
|
|
19
|
+
name: 'start_work_session',
|
|
20
|
+
description: `CALL THIS FIRST when beginning work on a project.
|
|
21
|
+
Returns session info, persona, role, and next_task. Start the next_task IMMEDIATELY without asking the user.
|
|
22
|
+
|
|
23
|
+
IMPORTANT: If the user gives you direct work that isn't tracked as a task (e.g., "add feature X", "fix bug Y"), you MUST call add_task() first to create a task before starting work. This ensures all work is tracked and visible on the dashboard.
|
|
24
|
+
|
|
25
|
+
Use mode:'full' for complete context, mode:'lite' (default) for minimal tokens.`,
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
project_id: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Project UUID',
|
|
32
|
+
},
|
|
33
|
+
git_url: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Git repository URL. Used to find project if project_id not provided.',
|
|
36
|
+
},
|
|
37
|
+
mode: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
enum: ['lite', 'full'],
|
|
40
|
+
description: 'Response mode: lite (default, minimal tokens) or full (complete context)',
|
|
41
|
+
},
|
|
42
|
+
model: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'Model being used for cost tracking. E.g., "opus", "sonnet", "haiku" for Claude, "gemini" for Gemini, "gpt-4o" for OpenAI.',
|
|
45
|
+
},
|
|
46
|
+
role: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Agent role (e.g., "developer", "validator", "deployer", "reviewer", "maintainer"). Custom roles accepted.',
|
|
49
|
+
},
|
|
50
|
+
hostname: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'Machine hostname for worktree tracking. Pass os.hostname() to filter stale worktrees to only those created on this machine.',
|
|
53
|
+
},
|
|
54
|
+
agent_type: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'Agent type (e.g., "claude", "gemini", "cursor", "windsurf"). Custom agent types accepted.',
|
|
57
|
+
},
|
|
58
|
+
agent_name: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Explicit agent name (for cloud/remote agents). If provided, uses this name instead of selecting from persona pool. Cloud agents should pass their spawner-assigned name.',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'confirm_agent_setup',
|
|
67
|
+
description: `Confirm that agent setup is complete for this project. Call this after creating your agent's configuration file (e.g., .claude/CLAUDE.md, .gemini/GEMINI.md).
|
|
68
|
+
|
|
69
|
+
This marks your agent type as fully onboarded to the project, so you won't receive setup instructions again.`,
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
project_id: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'Project UUID',
|
|
76
|
+
},
|
|
77
|
+
agent_type: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'Agent type that completed setup (e.g., "claude", "gemini", "cursor"). Custom agent types accepted.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
required: ['project_id', 'agent_type'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'get_help',
|
|
87
|
+
description: 'Get guidance on a specific topic. Use when unsure about workflows.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
topic: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
enum: ['getting_started', 'tasks', 'validation', 'deployment', 'git', 'blockers', 'milestones', 'fallback', 'session', 'tokens', 'roles', 'knowledge', 'topics'],
|
|
94
|
+
description: 'Help topic. Use "topics" to list all available.',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
required: ['topic'],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'get_token_usage',
|
|
102
|
+
description: 'Get token usage stats for this session. Monitor efficiency.',
|
|
103
|
+
inputSchema: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
properties: {},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'report_token_usage',
|
|
110
|
+
description: `Report actual Claude API token usage for accurate cost tracking.
|
|
111
|
+
|
|
112
|
+
IMPORTANT: MCP can only estimate tokens from tool I/O (~1-5% of actual usage). Call this tool after each API response to report actual usage from the Claude API response headers.
|
|
113
|
+
|
|
114
|
+
The Claude API response includes 'usage.input_tokens' and 'usage.output_tokens' - pass those values here for accurate cost attribution.`,
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
properties: {
|
|
118
|
+
input_tokens: {
|
|
119
|
+
type: 'number',
|
|
120
|
+
description: 'Input tokens from Claude API response (usage.input_tokens)',
|
|
121
|
+
},
|
|
122
|
+
output_tokens: {
|
|
123
|
+
type: 'number',
|
|
124
|
+
description: 'Output tokens from Claude API response (usage.output_tokens)',
|
|
125
|
+
},
|
|
126
|
+
model: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
description: 'Model used for this API call (optional, uses session model if not provided)',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
required: ['input_tokens', 'output_tokens'],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'heartbeat',
|
|
136
|
+
description: `Send heartbeat to maintain 'active' status. Call every 30-60 seconds.`,
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
session_id: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: 'Session ID from start_work_session (optional, uses current session if not provided)',
|
|
143
|
+
},
|
|
144
|
+
current_worktree_path: {
|
|
145
|
+
type: ['string', 'null'],
|
|
146
|
+
description: 'Report your current git worktree path (e.g., "../project-task-abc123"). Set to null to clear.',
|
|
147
|
+
},
|
|
148
|
+
hostname: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
description: 'Machine hostname (os.hostname()). Updates session hostname for worktree tracking.',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'end_work_session',
|
|
157
|
+
description: `End session and release claimed tasks. Returns session summary.`,
|
|
158
|
+
inputSchema: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
properties: {
|
|
161
|
+
session_id: {
|
|
162
|
+
type: 'string',
|
|
163
|
+
description: 'Session ID to end (optional, uses current session if not provided)',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'signal_idle',
|
|
170
|
+
description: `Signal that agent is idle (no more tasks). Call this when complete_task returns no next_task or when there's no work available. This provides real-time visibility on the dashboard instead of waiting for heartbeat timeout.`,
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
properties: {
|
|
174
|
+
session_id: {
|
|
175
|
+
type: 'string',
|
|
176
|
+
description: 'Session ID (optional, uses current session if not provided)',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
];
|