@dobbyai/mcp-external 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +527 -0
- package/dist/connectors/claude-desktop.d.ts +26 -0
- package/dist/connectors/claude-desktop.d.ts.map +1 -0
- package/dist/connectors/claude-desktop.js +133 -0
- package/dist/connectors/claude-desktop.js.map +1 -0
- package/dist/connectors/cursor.d.ts +25 -0
- package/dist/connectors/cursor.d.ts.map +1 -0
- package/dist/connectors/cursor.js +115 -0
- package/dist/connectors/cursor.js.map +1 -0
- package/dist/connectors/index.d.ts +11 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +11 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/setup.d.ts +12 -0
- package/dist/connectors/setup.d.ts.map +1 -0
- package/dist/connectors/setup.js +230 -0
- package/dist/connectors/setup.js.map +1 -0
- package/dist/connectors/vscode.d.ts +25 -0
- package/dist/connectors/vscode.d.ts.map +1 -0
- package/dist/connectors/vscode.js +63 -0
- package/dist/connectors/vscode.js.map +1 -0
- package/dist/connectors/windsurf.d.ts +25 -0
- package/dist/connectors/windsurf.d.ts.map +1 -0
- package/dist/connectors/windsurf.js +115 -0
- package/dist/connectors/windsurf.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dobby-client.d.ts +195 -0
- package/dist/lib/dobby-client.d.ts.map +1 -0
- package/dist/lib/dobby-client.js +219 -0
- package/dist/lib/dobby-client.js.map +1 -0
- package/dist/prompts/index.d.ts +25 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +208 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +27 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +182 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/tools/approvals.d.ts +104 -0
- package/dist/tools/approvals.d.ts.map +1 -0
- package/dist/tools/approvals.js +164 -0
- package/dist/tools/approvals.js.map +1 -0
- package/dist/tools/index.d.ts +260 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +215 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/messages.d.ts +68 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +105 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/tasks.d.ts +180 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +344 -0
- package/dist/tools/tasks.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all tool definitions and handlers.
|
|
5
|
+
* Gateway integration: Auth check + audit logging via gateway MCP endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export * from './tasks.js';
|
|
8
|
+
export * from './messages.js';
|
|
9
|
+
export * from './approvals.js';
|
|
10
|
+
import { DobbyClient } from '../lib/dobby-client.js';
|
|
11
|
+
export declare const allTools: {
|
|
12
|
+
get_pending_approvals: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object";
|
|
17
|
+
properties: {};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
approve_task: {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object";
|
|
25
|
+
properties: {
|
|
26
|
+
approval_id: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
note: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
required: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
reject_task: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object";
|
|
43
|
+
properties: {
|
|
44
|
+
approval_id: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
reason: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
required: string[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
request_changes: {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: "object";
|
|
61
|
+
properties: {
|
|
62
|
+
approval_id: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
changes: {
|
|
67
|
+
type: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
required: string[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
get_messages: {
|
|
75
|
+
name: string;
|
|
76
|
+
description: string;
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: "object";
|
|
79
|
+
properties: {
|
|
80
|
+
task_id: {
|
|
81
|
+
type: string;
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
limit: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
required: string[];
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
send_message: {
|
|
93
|
+
name: string;
|
|
94
|
+
description: string;
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object";
|
|
97
|
+
properties: {
|
|
98
|
+
task_id: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
content: {
|
|
103
|
+
type: string;
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
sender_name: {
|
|
107
|
+
type: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
required: string[];
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
create_task: {
|
|
115
|
+
name: string;
|
|
116
|
+
description: string;
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object";
|
|
119
|
+
properties: {
|
|
120
|
+
title: {
|
|
121
|
+
type: string;
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
description: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
};
|
|
128
|
+
priority: {
|
|
129
|
+
type: string;
|
|
130
|
+
enum: string[];
|
|
131
|
+
description: string;
|
|
132
|
+
};
|
|
133
|
+
link_to_task_id: {
|
|
134
|
+
type: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
required: string[];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
list_tasks: {
|
|
142
|
+
name: string;
|
|
143
|
+
description: string;
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object";
|
|
146
|
+
properties: {
|
|
147
|
+
status: {
|
|
148
|
+
type: string;
|
|
149
|
+
enum: string[];
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
priority: {
|
|
153
|
+
type: string;
|
|
154
|
+
enum: string[];
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
limit: {
|
|
158
|
+
type: string;
|
|
159
|
+
description: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
get_task: {
|
|
165
|
+
name: string;
|
|
166
|
+
description: string;
|
|
167
|
+
inputSchema: {
|
|
168
|
+
type: "object";
|
|
169
|
+
properties: {
|
|
170
|
+
task_id: {
|
|
171
|
+
type: string;
|
|
172
|
+
description: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
required: string[];
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
update_task: {
|
|
179
|
+
name: string;
|
|
180
|
+
description: string;
|
|
181
|
+
inputSchema: {
|
|
182
|
+
type: "object";
|
|
183
|
+
properties: {
|
|
184
|
+
task_id: {
|
|
185
|
+
type: string;
|
|
186
|
+
description: string;
|
|
187
|
+
};
|
|
188
|
+
status: {
|
|
189
|
+
type: string;
|
|
190
|
+
enum: string[];
|
|
191
|
+
description: string;
|
|
192
|
+
};
|
|
193
|
+
priority: {
|
|
194
|
+
type: string;
|
|
195
|
+
enum: string[];
|
|
196
|
+
description: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
required: string[];
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
get_task_timeline: {
|
|
203
|
+
name: string;
|
|
204
|
+
description: string;
|
|
205
|
+
inputSchema: {
|
|
206
|
+
type: "object";
|
|
207
|
+
properties: {
|
|
208
|
+
task_id: {
|
|
209
|
+
type: string;
|
|
210
|
+
description: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
required: string[];
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
cancel_task: {
|
|
217
|
+
name: string;
|
|
218
|
+
description: string;
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: "object";
|
|
221
|
+
properties: {
|
|
222
|
+
task_id: {
|
|
223
|
+
type: string;
|
|
224
|
+
description: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
required: string[];
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
export type ToolName = keyof typeof allTools;
|
|
232
|
+
export interface GatewayAuthResult {
|
|
233
|
+
allowed: boolean;
|
|
234
|
+
request_id?: string;
|
|
235
|
+
org_id?: string;
|
|
236
|
+
tenant_id?: string;
|
|
237
|
+
actor?: {
|
|
238
|
+
actor_type: string;
|
|
239
|
+
actor_id: string;
|
|
240
|
+
on_behalf_of?: string;
|
|
241
|
+
};
|
|
242
|
+
scope?: string;
|
|
243
|
+
region?: string;
|
|
244
|
+
error?: string;
|
|
245
|
+
}
|
|
246
|
+
export interface ToolContext {
|
|
247
|
+
client: DobbyClient;
|
|
248
|
+
userId: string;
|
|
249
|
+
userName: string;
|
|
250
|
+
/** Gateway API key for auth. If not provided, gateway auth is skipped. */
|
|
251
|
+
gatewayKey?: string;
|
|
252
|
+
/** Gateway API base URL. Defaults to client's apiUrl. */
|
|
253
|
+
gatewayUrl?: string;
|
|
254
|
+
/** Tenant ID for gateway context */
|
|
255
|
+
tenantId?: string;
|
|
256
|
+
/** Region for regional logging */
|
|
257
|
+
region?: string;
|
|
258
|
+
}
|
|
259
|
+
export declare function handleToolCall(toolName: string, args: Record<string, unknown>, context: ToolContext): Promise<any>;
|
|
260
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAK/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,QAAQ,CAAC;AAM7C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAmGD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,gBAgJrB"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all tool definitions and handlers.
|
|
5
|
+
* Gateway integration: Auth check + audit logging via gateway MCP endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export * from './tasks.js';
|
|
8
|
+
export * from './messages.js';
|
|
9
|
+
export * from './approvals.js';
|
|
10
|
+
import { taskTools, handleCreateTask, handleListTasks, handleGetTask, handleUpdateTask, handleGetTaskTimeline, handleCancelTask } from './tasks.js';
|
|
11
|
+
import { messageTools, handleGetMessages, handleSendMessage } from './messages.js';
|
|
12
|
+
import { approvalTools, handleGetPendingApprovals, handleApproveTask, handleRejectTask, handleRequestChanges } from './approvals.js';
|
|
13
|
+
// ============================================
|
|
14
|
+
// All Tools
|
|
15
|
+
// ============================================
|
|
16
|
+
export const allTools = {
|
|
17
|
+
...taskTools,
|
|
18
|
+
...messageTools,
|
|
19
|
+
...approvalTools,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Check gateway auth for an MCP tool call.
|
|
23
|
+
* Returns auth result from gateway. If no gatewayKey is configured, returns allowed.
|
|
24
|
+
*/
|
|
25
|
+
async function checkGatewayAuth(toolName, mcpServer, context) {
|
|
26
|
+
if (!context.gatewayKey || !context.gatewayUrl) {
|
|
27
|
+
// No gateway configured — allow (backwards compatible)
|
|
28
|
+
return { allowed: true };
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const response = await fetch(`${context.gatewayUrl}/api/v1/gateway/mcp/tools`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'Authorization': `Bearer ${context.gatewayKey}`,
|
|
36
|
+
...(context.tenantId ? { 'X-Tenant-Id': context.tenantId } : {}),
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
tool_name: toolName,
|
|
40
|
+
mcp_server: mcpServer,
|
|
41
|
+
region: context.region,
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
const errBody = await response.json().catch(() => ({ error: 'Gateway auth failed' }));
|
|
46
|
+
return {
|
|
47
|
+
allowed: false,
|
|
48
|
+
error: errBody.error || `Gateway returned ${response.status}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return await response.json();
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
55
|
+
console.error('[MCP Gateway] Auth check failed:', errMsg);
|
|
56
|
+
// Fail open with warning if gateway is unreachable
|
|
57
|
+
return { allowed: true };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Log tool call result to gateway.
|
|
62
|
+
* Non-blocking — errors are logged but don't affect tool result.
|
|
63
|
+
*/
|
|
64
|
+
async function logToolCallToGateway(toolCall, authResult, context, eventType = 'mcp.tool.call') {
|
|
65
|
+
if (!context.gatewayKey || !context.gatewayUrl)
|
|
66
|
+
return;
|
|
67
|
+
try {
|
|
68
|
+
await fetch(`${context.gatewayUrl}/api/v1/gateway/mcp/tools`, {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
headers: {
|
|
71
|
+
'Content-Type': 'application/json',
|
|
72
|
+
'Authorization': `Bearer ${context.gatewayKey}`,
|
|
73
|
+
...(context.tenantId ? { 'X-Tenant-Id': context.tenantId } : {}),
|
|
74
|
+
},
|
|
75
|
+
body: JSON.stringify({
|
|
76
|
+
action: 'log',
|
|
77
|
+
tool_call: toolCall,
|
|
78
|
+
event_type: eventType,
|
|
79
|
+
actor_type: authResult.actor?.actor_type || 'human',
|
|
80
|
+
actor_id: authResult.actor?.actor_id || context.userId,
|
|
81
|
+
on_behalf_of: authResult.actor?.on_behalf_of || undefined,
|
|
82
|
+
org_id: authResult.org_id || '',
|
|
83
|
+
region: context.region,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('[MCP Gateway] Log failed:', error.message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const MCP_SERVER_NAME = 'mcp-dobby-external';
|
|
92
|
+
export async function handleToolCall(toolName, args, context) {
|
|
93
|
+
const { client, userId, userName } = context;
|
|
94
|
+
const startTime = new Date();
|
|
95
|
+
// 1. Gateway auth check (if configured)
|
|
96
|
+
const authResult = await checkGatewayAuth(toolName, MCP_SERVER_NAME, context);
|
|
97
|
+
if (!authResult.allowed) {
|
|
98
|
+
// Log denial to gateway (non-blocking)
|
|
99
|
+
logToolCallToGateway({
|
|
100
|
+
tenant_id: context.tenantId || '',
|
|
101
|
+
agent_id: 'mcp-external',
|
|
102
|
+
task_id: args.task_id || '',
|
|
103
|
+
mcp_server: MCP_SERVER_NAME,
|
|
104
|
+
tool_name: toolName,
|
|
105
|
+
tool_input: args,
|
|
106
|
+
status: 'error',
|
|
107
|
+
error_message: authResult.error || 'Gateway auth denied',
|
|
108
|
+
started_at: startTime.toISOString(),
|
|
109
|
+
completed_at: new Date().toISOString(),
|
|
110
|
+
}, authResult, context, 'mcp.tool.denied');
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: `Tool call denied: ${authResult.error || 'Insufficient permissions'}`,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
isError: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// 2. Execute tool
|
|
122
|
+
let result;
|
|
123
|
+
let toolError;
|
|
124
|
+
let toolStatus = 'success';
|
|
125
|
+
try {
|
|
126
|
+
switch (toolName) {
|
|
127
|
+
// Task tools
|
|
128
|
+
case 'create_task':
|
|
129
|
+
result = await handleCreateTask(client, args);
|
|
130
|
+
break;
|
|
131
|
+
case 'list_tasks':
|
|
132
|
+
result = await handleListTasks(client, args);
|
|
133
|
+
break;
|
|
134
|
+
case 'get_task':
|
|
135
|
+
result = await handleGetTask(client, args);
|
|
136
|
+
break;
|
|
137
|
+
case 'update_task':
|
|
138
|
+
result = await handleUpdateTask(client, args);
|
|
139
|
+
break;
|
|
140
|
+
case 'get_task_timeline':
|
|
141
|
+
result = await handleGetTaskTimeline(client, args);
|
|
142
|
+
break;
|
|
143
|
+
case 'cancel_task':
|
|
144
|
+
result = await handleCancelTask(client, args);
|
|
145
|
+
break;
|
|
146
|
+
// Message tools
|
|
147
|
+
case 'get_messages':
|
|
148
|
+
result = await handleGetMessages(client, args, userId);
|
|
149
|
+
break;
|
|
150
|
+
case 'send_message':
|
|
151
|
+
result = await handleSendMessage(client, args, userId, userName);
|
|
152
|
+
break;
|
|
153
|
+
// Approval tools
|
|
154
|
+
case 'get_pending_approvals':
|
|
155
|
+
result = await handleGetPendingApprovals(client);
|
|
156
|
+
break;
|
|
157
|
+
case 'approve_task':
|
|
158
|
+
result = await handleApproveTask(client, args);
|
|
159
|
+
break;
|
|
160
|
+
case 'reject_task':
|
|
161
|
+
result = await handleRejectTask(client, args);
|
|
162
|
+
break;
|
|
163
|
+
case 'request_changes':
|
|
164
|
+
result = await handleRequestChanges(client, args);
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
result = {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: 'text',
|
|
171
|
+
text: `Unknown tool: ${toolName}`,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
isError: true,
|
|
175
|
+
};
|
|
176
|
+
toolStatus = 'error';
|
|
177
|
+
toolError = `Unknown tool: ${toolName}`;
|
|
178
|
+
}
|
|
179
|
+
if (result?.isError) {
|
|
180
|
+
toolStatus = 'error';
|
|
181
|
+
toolError = result.content?.[0]?.text || 'Tool returned error';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
toolStatus = 'error';
|
|
186
|
+
toolError = error.message;
|
|
187
|
+
result = {
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: 'text',
|
|
191
|
+
text: `Tool error: ${error.message}`,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
isError: true,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const endTime = new Date();
|
|
198
|
+
// 3. Log result to gateway (non-blocking)
|
|
199
|
+
logToolCallToGateway({
|
|
200
|
+
tenant_id: context.tenantId || '',
|
|
201
|
+
agent_id: 'mcp-external',
|
|
202
|
+
task_id: args.task_id || '',
|
|
203
|
+
mcp_server: MCP_SERVER_NAME,
|
|
204
|
+
tool_name: toolName,
|
|
205
|
+
tool_input: args,
|
|
206
|
+
tool_output: result?.content ? { content: result.content } : undefined,
|
|
207
|
+
status: toolStatus,
|
|
208
|
+
error_message: toolError,
|
|
209
|
+
duration_ms: endTime.getTime() - startTime.getTime(),
|
|
210
|
+
started_at: startTime.toISOString(),
|
|
211
|
+
completed_at: endTime.toISOString(),
|
|
212
|
+
}, authResult, context, 'mcp.tool.call');
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpJ,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGrI,+CAA+C;AAC/C,YAAY;AACZ,+CAA+C;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,SAAS;IACZ,GAAG,YAAY;IACf,GAAG,aAAa;CACjB,CAAC;AAyCF;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAC7B,QAAgB,EAChB,SAAiB,EACjB,OAAoB;IAEpB,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC/C,uDAAuD;QACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,2BAA2B,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,OAAO,CAA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,qBAAqB,CAAC;QACjE,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,UAAU,GAAG,OAAO,CAAC;QACrB,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;QAC1B,MAAM,GAAG;YACP,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,eAAe,KAAK,CAAC,OAAO,EAAE;iBACrC;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;IAE3B,0CAA0C;IAC1C,oBAAoB,CAClB;QACE,SAAS,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;QACjC,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAG,IAAY,CAAC,OAAO,IAAI,EAAE;QACpC,UAAU,EAAE,eAAe;QAC3B,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,IAA2B;QACvC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;QACtE,MAAM,EAAE,UAAU;QAClB,aAAa,EAAE,SAAS;QACxB,WAAW,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE;QACpD,UAAU,EAAE,SAAS,CAAC,WAAW,EAAE;QACnC,YAAY,EAAE,OAAO,CAAC,WAAW,EAAE;KACpC,EACD,UAAU,EACV,OAAO,EACP,eAAe,CAChB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation/Message Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for interacting with task conversations.
|
|
5
|
+
*/
|
|
6
|
+
import { DobbyClient } from '../lib/dobby-client.js';
|
|
7
|
+
export declare const messageTools: {
|
|
8
|
+
get_messages: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
task_id: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
limit: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
required: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
send_message: {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: "object";
|
|
31
|
+
properties: {
|
|
32
|
+
task_id: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
content: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
sender_name: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
required: string[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function handleGetMessages(client: DobbyClient, args: {
|
|
50
|
+
task_id: string;
|
|
51
|
+
limit?: number;
|
|
52
|
+
}, userId: string): Promise<{
|
|
53
|
+
content: {
|
|
54
|
+
type: "text";
|
|
55
|
+
text: string;
|
|
56
|
+
}[];
|
|
57
|
+
}>;
|
|
58
|
+
export declare function handleSendMessage(client: DobbyClient, args: {
|
|
59
|
+
task_id: string;
|
|
60
|
+
content: string;
|
|
61
|
+
sender_name?: string;
|
|
62
|
+
}, userId: string, userName: string): Promise<{
|
|
63
|
+
content: {
|
|
64
|
+
type: "text";
|
|
65
|
+
text: string;
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
68
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CxB,CAAC;AAMF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,MAAM,EAAE,MAAM;;;;;GAuCf;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM;;;;;GAgBjB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation/Message Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for interacting with task conversations.
|
|
5
|
+
*/
|
|
6
|
+
// ============================================
|
|
7
|
+
// Tool Definitions
|
|
8
|
+
// ============================================
|
|
9
|
+
export const messageTools = {
|
|
10
|
+
// Get conversation messages
|
|
11
|
+
get_messages: {
|
|
12
|
+
name: 'get_messages',
|
|
13
|
+
description: 'Get the conversation messages for a task',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
task_id: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The task ID to get messages for',
|
|
20
|
+
},
|
|
21
|
+
limit: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'Maximum number of messages to return (default: 50)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ['task_id'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
// Send a message
|
|
30
|
+
send_message: {
|
|
31
|
+
name: 'send_message',
|
|
32
|
+
description: 'Send a message to a task conversation',
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
task_id: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'The task ID to send the message to',
|
|
39
|
+
},
|
|
40
|
+
content: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The message content',
|
|
43
|
+
},
|
|
44
|
+
sender_name: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Your name (will be shown in the conversation)',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ['task_id', 'content'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// ============================================
|
|
54
|
+
// Tool Handlers
|
|
55
|
+
// ============================================
|
|
56
|
+
export async function handleGetMessages(client, args, userId) {
|
|
57
|
+
const messages = await client.getMessages(args.task_id, {
|
|
58
|
+
limit: args.limit || 50,
|
|
59
|
+
});
|
|
60
|
+
if (messages.length === 0) {
|
|
61
|
+
return {
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: `No messages yet in task ${args.task_id}`,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const formattedMessages = messages
|
|
71
|
+
.map((msg) => {
|
|
72
|
+
const senderEmoji = {
|
|
73
|
+
user: '👤',
|
|
74
|
+
agent: '🤖',
|
|
75
|
+
system: '⚙️',
|
|
76
|
+
}[msg.sender.type] || '💬';
|
|
77
|
+
const time = new Date(msg.created_at).toLocaleTimeString();
|
|
78
|
+
return `${senderEmoji} **${msg.sender.name}** (${time}):\n${msg.message.content}`;
|
|
79
|
+
})
|
|
80
|
+
.join('\n\n---\n\n');
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'text',
|
|
85
|
+
text: `# Conversation for Task ${args.task_id}\n\n${formattedMessages}`,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export async function handleSendMessage(client, args, userId, userName) {
|
|
91
|
+
const message = await client.sendMessage(args.task_id, {
|
|
92
|
+
content: args.content,
|
|
93
|
+
sender_id: userId,
|
|
94
|
+
sender_name: args.sender_name || userName || 'User',
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
content: [
|
|
98
|
+
{
|
|
99
|
+
type: 'text',
|
|
100
|
+
text: `✅ Message sent to task ${args.task_id}:\n\n"${args.content}"`,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,+CAA+C;AAC/C,mBAAmB;AACnB,+CAA+C;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,4BAA4B;IAC5B,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,0CAA0C;QACvD,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iCAAiC;iBAC/C;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oDAAoD;iBAClE;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IAED,iBAAiB;IACjB,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,uCAAuC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oCAAoC;iBAClD;gBAC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