@dobbyai/mcp-external 1.0.1 → 1.0.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.
- package/dist/__tests__/tools/services.test.d.ts +2 -0
- package/dist/__tests__/tools/services.test.d.ts.map +1 -0
- package/dist/__tests__/tools/services.test.js +223 -0
- package/dist/__tests__/tools/services.test.js.map +1 -0
- package/dist/lib/dobby-client.d.ts +9 -0
- package/dist/lib/dobby-client.d.ts.map +1 -1
- package/dist/lib/dobby-client.js +37 -0
- package/dist/lib/dobby-client.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +27 -0
- package/dist/resources/index.js.map +1 -1
- package/dist/tools/crew-builder.d.ts +165 -0
- package/dist/tools/crew-builder.d.ts.map +1 -0
- package/dist/tools/crew-builder.js +306 -0
- package/dist/tools/crew-builder.js.map +1 -0
- package/dist/tools/crewai.d.ts +140 -0
- package/dist/tools/crewai.d.ts.map +1 -0
- package/dist/tools/crewai.js +226 -0
- package/dist/tools/crewai.js.map +1 -0
- package/dist/tools/index.d.ts +207 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +49 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp-tools.d.ts +90 -0
- package/dist/tools/mcp-tools.d.ts.map +1 -0
- package/dist/tools/mcp-tools.js +203 -0
- package/dist/tools/mcp-tools.js.map +1 -0
- package/dist/tools/services.d.ts +38 -0
- package/dist/tools/services.d.ts.map +1 -0
- package/dist/tools/services.js +166 -0
- package/dist/tools/services.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crew Builder Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for creating and running CrewAI crews from YAML configurations
|
|
5
|
+
* through the Dobby gateway proxy (managed service: crewai-local).
|
|
6
|
+
*
|
|
7
|
+
* These tools work with the Crew AI Service (mcp/crew-ai/) which runs
|
|
8
|
+
* as an internal Docker container. All requests are proxied through
|
|
9
|
+
* the gateway at /api/v1/gateway/agents/proxy with provider_id='crewai-local'.
|
|
10
|
+
*
|
|
11
|
+
* Tools:
|
|
12
|
+
* crew_validate — Validate YAML configs without running
|
|
13
|
+
* crew_kickoff — Create crew from YAML and start execution
|
|
14
|
+
* crew_status — Check run status and results
|
|
15
|
+
* crew_list — List recent crew runs
|
|
16
|
+
*/
|
|
17
|
+
// ============================================
|
|
18
|
+
// Tool Definitions
|
|
19
|
+
// ============================================
|
|
20
|
+
export const crewBuilderTools = {
|
|
21
|
+
crew_validate: {
|
|
22
|
+
name: 'crew_validate',
|
|
23
|
+
description: 'Validate CrewAI YAML configurations (agents and tasks) without running them. ' +
|
|
24
|
+
'Use this to check for errors before starting a kickoff. ' +
|
|
25
|
+
'Returns validation errors or confirms the configuration is valid.',
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
agents_yaml: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'YAML content defining agents. Each agent needs: role, goal, backstory. ' +
|
|
32
|
+
'Example:\n' +
|
|
33
|
+
'researcher:\n' +
|
|
34
|
+
' role: Research Analyst\n' +
|
|
35
|
+
' goal: Find information about {topic}\n' +
|
|
36
|
+
' backstory: You are an expert researcher.',
|
|
37
|
+
},
|
|
38
|
+
tasks_yaml: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'YAML content defining tasks. Each task needs: description, expected_output, agent. ' +
|
|
41
|
+
'Example:\n' +
|
|
42
|
+
'research_task:\n' +
|
|
43
|
+
' description: Research {topic}\n' +
|
|
44
|
+
' expected_output: A detailed report\n' +
|
|
45
|
+
' agent: researcher',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ['agents_yaml', 'tasks_yaml'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
crew_kickoff: {
|
|
52
|
+
name: 'crew_kickoff',
|
|
53
|
+
description: 'Create a CrewAI crew from YAML configurations and start execution. ' +
|
|
54
|
+
'Agents and tasks are defined in YAML with {placeholder} variable substitution. ' +
|
|
55
|
+
'Returns a run_id to track progress with crew_status. ' +
|
|
56
|
+
'The crew runs asynchronously — check status to get results.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
agents_yaml: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'YAML content defining agents (role, goal, backstory per agent)',
|
|
63
|
+
},
|
|
64
|
+
tasks_yaml: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
description: 'YAML content defining tasks (description, expected_output, agent per task)',
|
|
67
|
+
},
|
|
68
|
+
variables: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
description: 'Key-value pairs to substitute {placeholders} in YAML. ' +
|
|
71
|
+
'E.g., {"topic": "AI agents"} replaces all {topic} occurrences.',
|
|
72
|
+
additionalProperties: { type: 'string' },
|
|
73
|
+
},
|
|
74
|
+
process_type: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
enum: ['sequential', 'hierarchical'],
|
|
77
|
+
description: 'Crew process type. Sequential runs tasks in order, hierarchical uses a manager agent. Default: sequential.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
required: ['agents_yaml', 'tasks_yaml'],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
crew_status: {
|
|
84
|
+
name: 'crew_status',
|
|
85
|
+
description: 'Check the status of a local CrewAI crew execution. ' +
|
|
86
|
+
'Returns the state (pending/running/completed/failed), agent outputs, ' +
|
|
87
|
+
'result when complete, or error message if failed.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
run_id: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'The run ID returned from crew_kickoff.',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ['run_id'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
crew_list: {
|
|
100
|
+
name: 'crew_list',
|
|
101
|
+
description: 'List recent local CrewAI crew runs with their status, timing, and summary info.',
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
properties: {
|
|
105
|
+
limit: {
|
|
106
|
+
type: 'number',
|
|
107
|
+
description: 'Maximum number of runs to return (default: 10).',
|
|
108
|
+
},
|
|
109
|
+
status_filter: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
enum: ['running', 'completed', 'failed', 'all'],
|
|
112
|
+
description: 'Filter by run status (default: all).',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
async function callCrewBuilderProxy(client, payload) {
|
|
119
|
+
const url = `${client.apiUrl}/api/v1/gateway/agents/proxy`;
|
|
120
|
+
const response = await fetch(url, {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
headers: {
|
|
123
|
+
'Content-Type': 'application/json',
|
|
124
|
+
Authorization: `Bearer ${client.apiKey}`,
|
|
125
|
+
...(client.tenantId ? { 'X-Tenant-Id': client.tenantId } : {}),
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
...payload,
|
|
129
|
+
provider_id: 'crewai-local',
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
const errBody = await response.json().catch(() => ({
|
|
134
|
+
error: `Gateway proxy returned ${response.status}`,
|
|
135
|
+
}));
|
|
136
|
+
throw new Error(errBody.error ||
|
|
137
|
+
errBody.detail ||
|
|
138
|
+
`Gateway proxy error: HTTP ${response.status}`);
|
|
139
|
+
}
|
|
140
|
+
return response.json();
|
|
141
|
+
}
|
|
142
|
+
// ============================================
|
|
143
|
+
// Tool Handlers
|
|
144
|
+
// ============================================
|
|
145
|
+
export async function handleCrewValidate(client, args) {
|
|
146
|
+
try {
|
|
147
|
+
const data = await callCrewBuilderProxy(client, {
|
|
148
|
+
action: 'validate',
|
|
149
|
+
provider_id: 'crewai-local',
|
|
150
|
+
agents_yaml: args.agents_yaml,
|
|
151
|
+
tasks_yaml: args.tasks_yaml,
|
|
152
|
+
});
|
|
153
|
+
const resp = data.response || {};
|
|
154
|
+
let text = `# Crew YAML Validation\n\n`;
|
|
155
|
+
if (resp.valid) {
|
|
156
|
+
text += `✅ **Valid** — Configuration is ready to run.\n\n`;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
text += `❌ **Invalid** — Found ${resp.errors?.length || 0} error(s):\n\n`;
|
|
160
|
+
for (const error of resp.errors || []) {
|
|
161
|
+
text += `- ${error}\n`;
|
|
162
|
+
}
|
|
163
|
+
text += `\n`;
|
|
164
|
+
}
|
|
165
|
+
if (resp.agents?.length > 0) {
|
|
166
|
+
text += `## Agents (${resp.agents.length})\n\n`;
|
|
167
|
+
for (const agent of resp.agents) {
|
|
168
|
+
text += `- **${agent.name}** — ${agent.role} (${agent.goal})\n`;
|
|
169
|
+
}
|
|
170
|
+
text += `\n`;
|
|
171
|
+
}
|
|
172
|
+
if (resp.tasks?.length > 0) {
|
|
173
|
+
text += `## Tasks (${resp.tasks.length})\n\n`;
|
|
174
|
+
for (const task of resp.tasks) {
|
|
175
|
+
text += `- **${task.name}** → agent: \`${task.agent}\` — ${task.description}\n`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return { content: [{ type: 'text', text }] };
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
return {
|
|
182
|
+
content: [
|
|
183
|
+
{ type: 'text', text: `Crew validation failed: ${error.message}` },
|
|
184
|
+
],
|
|
185
|
+
isError: true,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
export async function handleCrewKickoff(client, args) {
|
|
190
|
+
try {
|
|
191
|
+
const data = await callCrewBuilderProxy(client, {
|
|
192
|
+
action: 'local_kickoff',
|
|
193
|
+
provider_id: 'crewai-local',
|
|
194
|
+
agents_yaml: args.agents_yaml,
|
|
195
|
+
tasks_yaml: args.tasks_yaml,
|
|
196
|
+
variables: args.variables || {},
|
|
197
|
+
process_type: args.process_type || 'sequential',
|
|
198
|
+
});
|
|
199
|
+
const resp = data.response || {};
|
|
200
|
+
let text = `# Crew Kickoff Started\n\n`;
|
|
201
|
+
text += `- **Run ID:** \`${resp.run_id}\`\n`;
|
|
202
|
+
text += `- **Status:** ${resp.status}\n`;
|
|
203
|
+
text += `- **Agents:** ${resp.agent_count}\n`;
|
|
204
|
+
text += `- **Tasks:** ${resp.task_count}\n`;
|
|
205
|
+
text += `- **Process:** ${resp.process_type}\n`;
|
|
206
|
+
text += `- **Latency:** ${data.latency_ms}ms\n\n`;
|
|
207
|
+
text += `Use \`crew_status\` with run_id \`${resp.run_id}\` to check progress.`;
|
|
208
|
+
return { content: [{ type: 'text', text }] };
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
return {
|
|
212
|
+
content: [
|
|
213
|
+
{ type: 'text', text: `Crew kickoff failed: ${error.message}` },
|
|
214
|
+
],
|
|
215
|
+
isError: true,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export async function handleCrewStatus(client, args) {
|
|
220
|
+
try {
|
|
221
|
+
const data = await callCrewBuilderProxy(client, {
|
|
222
|
+
action: 'local_status',
|
|
223
|
+
provider_id: 'crewai-local',
|
|
224
|
+
run_id: args.run_id,
|
|
225
|
+
});
|
|
226
|
+
const resp = data.response || {};
|
|
227
|
+
let text = `# Crew Run Status\n\n`;
|
|
228
|
+
text += `- **Run ID:** \`${resp.run_id}\`\n`;
|
|
229
|
+
text += `- **Status:** ${resp.status}\n`;
|
|
230
|
+
text += `- **Process:** ${resp.process_type}\n`;
|
|
231
|
+
text += `- **Agents:** ${resp.agent_count}\n`;
|
|
232
|
+
text += `- **Tasks:** ${resp.task_count}\n`;
|
|
233
|
+
if (resp.started_at) {
|
|
234
|
+
text += `- **Started:** ${resp.started_at}\n`;
|
|
235
|
+
}
|
|
236
|
+
if (resp.completed_at) {
|
|
237
|
+
text += `- **Completed:** ${resp.completed_at}\n`;
|
|
238
|
+
}
|
|
239
|
+
if (resp.duration_ms != null) {
|
|
240
|
+
text += `- **Duration:** ${resp.duration_ms}ms\n`;
|
|
241
|
+
}
|
|
242
|
+
if (resp.error_message) {
|
|
243
|
+
text += `\n## Error\n\n\`\`\`\n${resp.error_message}\n\`\`\`\n`;
|
|
244
|
+
}
|
|
245
|
+
if (resp.agent_outputs?.length > 0) {
|
|
246
|
+
text += `\n## Agent Outputs\n\n`;
|
|
247
|
+
for (const output of resp.agent_outputs) {
|
|
248
|
+
text += `### ${output.task || 'Task'}\n\n${output.output}\n\n`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (resp.result) {
|
|
252
|
+
text += `\n## Final Result\n\n${resp.result}\n`;
|
|
253
|
+
}
|
|
254
|
+
return { content: [{ type: 'text', text }] };
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
return {
|
|
258
|
+
content: [
|
|
259
|
+
{ type: 'text', text: `Failed to get crew status: ${error.message}` },
|
|
260
|
+
],
|
|
261
|
+
isError: true,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
export async function handleCrewList(client, args) {
|
|
266
|
+
try {
|
|
267
|
+
const data = await callCrewBuilderProxy(client, {
|
|
268
|
+
action: 'list_runs',
|
|
269
|
+
provider_id: 'crewai-local',
|
|
270
|
+
limit: args.limit || 10,
|
|
271
|
+
status: args.status_filter,
|
|
272
|
+
});
|
|
273
|
+
const resp = data.response || {};
|
|
274
|
+
const runs = resp.runs || [];
|
|
275
|
+
let text = `# Crew Runs (${runs.length})\n\n`;
|
|
276
|
+
if (runs.length === 0) {
|
|
277
|
+
text += `_No crew runs found._\n`;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
for (const run of runs) {
|
|
281
|
+
const statusIcon = run.status === 'completed' ? '✅' :
|
|
282
|
+
run.status === 'running' ? '🔄' :
|
|
283
|
+
run.status === 'failed' ? '❌' : '⏳';
|
|
284
|
+
text += `- ${statusIcon} **${run.run_id}** [${run.status}] — `;
|
|
285
|
+
text += `${run.agent_count} agents, ${run.task_count} tasks`;
|
|
286
|
+
if (run.duration_ms != null) {
|
|
287
|
+
text += ` (${run.duration_ms}ms)`;
|
|
288
|
+
}
|
|
289
|
+
if (run.has_error) {
|
|
290
|
+
text += ` ⚠️`;
|
|
291
|
+
}
|
|
292
|
+
text += `\n`;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return { content: [{ type: 'text', text }] };
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
return {
|
|
299
|
+
content: [
|
|
300
|
+
{ type: 'text', text: `Failed to list crew runs: ${error.message}` },
|
|
301
|
+
],
|
|
302
|
+
isError: true,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=crew-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crew-builder.js","sourceRoot":"","sources":["../../src/tools/crew-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,+CAA+C;AAC/C,mBAAmB;AACnB,+CAA+C;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE;QACb,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,+EAA+E;YAC/E,0DAA0D;YAC1D,mEAAmE;QACrE,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,yEAAyE;wBACzE,YAAY;wBACZ,eAAe;wBACf,4BAA4B;wBAC5B,0CAA0C;wBAC1C,4CAA4C;iBAC/C;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,qFAAqF;wBACrF,YAAY;wBACZ,kBA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,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,6BAA6B,KAAK,CAAC,OAAO,EAAE,EAAE;aAC9E;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrewAI Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for interacting with CrewAI agents through the Dobby gateway proxy.
|
|
5
|
+
* All calls go through /api/v1/gateway/agents/proxy which handles:
|
|
6
|
+
* - credential decryption
|
|
7
|
+
* - connection lookup
|
|
8
|
+
* - request forwarding
|
|
9
|
+
*/
|
|
10
|
+
import { DobbyClient } from '../lib/dobby-client.js';
|
|
11
|
+
export declare const crewaiTools: {
|
|
12
|
+
crewai_health: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object";
|
|
17
|
+
properties: {
|
|
18
|
+
connection_id: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
crewai_inputs: {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object";
|
|
30
|
+
properties: {
|
|
31
|
+
connection_id: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
crewai_kickoff: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object";
|
|
43
|
+
properties: {
|
|
44
|
+
inputs: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
additionalProperties: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
connection_id: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
required: string[];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
crewai_status: {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: "object";
|
|
64
|
+
properties: {
|
|
65
|
+
kickoff_id: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
connection_id: {
|
|
70
|
+
type: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
required: string[];
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export declare function handleCrewAIHealth(client: DobbyClient, args: {
|
|
79
|
+
connection_id?: string;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
content: {
|
|
82
|
+
type: "text";
|
|
83
|
+
text: string;
|
|
84
|
+
}[];
|
|
85
|
+
isError?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
content: {
|
|
88
|
+
type: "text";
|
|
89
|
+
text: string;
|
|
90
|
+
}[];
|
|
91
|
+
isError: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
export declare function handleCrewAIInputs(client: DobbyClient, args: {
|
|
94
|
+
connection_id?: string;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
content: {
|
|
97
|
+
type: "text";
|
|
98
|
+
text: string;
|
|
99
|
+
}[];
|
|
100
|
+
isError?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
content: {
|
|
103
|
+
type: "text";
|
|
104
|
+
text: string;
|
|
105
|
+
}[];
|
|
106
|
+
isError: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
export declare function handleCrewAIKickoff(client: DobbyClient, args: {
|
|
109
|
+
inputs: Record<string, string>;
|
|
110
|
+
connection_id?: string;
|
|
111
|
+
}): Promise<{
|
|
112
|
+
content: {
|
|
113
|
+
type: "text";
|
|
114
|
+
text: string;
|
|
115
|
+
}[];
|
|
116
|
+
isError?: undefined;
|
|
117
|
+
} | {
|
|
118
|
+
content: {
|
|
119
|
+
type: "text";
|
|
120
|
+
text: string;
|
|
121
|
+
}[];
|
|
122
|
+
isError: boolean;
|
|
123
|
+
}>;
|
|
124
|
+
export declare function handleCrewAIStatus(client: DobbyClient, args: {
|
|
125
|
+
kickoff_id: string;
|
|
126
|
+
connection_id?: string;
|
|
127
|
+
}): Promise<{
|
|
128
|
+
content: {
|
|
129
|
+
type: "text";
|
|
130
|
+
text: string;
|
|
131
|
+
}[];
|
|
132
|
+
isError?: undefined;
|
|
133
|
+
} | {
|
|
134
|
+
content: {
|
|
135
|
+
type: "text";
|
|
136
|
+
text: string;
|
|
137
|
+
}[];
|
|
138
|
+
isError: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
//# sourceMappingURL=crewai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crewai.d.ts","sourceRoot":"","sources":["../../src/tools/crewai.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EvB,CAAC;AAkDF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GAyBjC;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GAgCjC;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GA4BjE;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GA+CrD"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrewAI Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for interacting with CrewAI agents through the Dobby gateway proxy.
|
|
5
|
+
* All calls go through /api/v1/gateway/agents/proxy which handles:
|
|
6
|
+
* - credential decryption
|
|
7
|
+
* - connection lookup
|
|
8
|
+
* - request forwarding
|
|
9
|
+
*/
|
|
10
|
+
// ============================================
|
|
11
|
+
// Tool Definitions
|
|
12
|
+
// ============================================
|
|
13
|
+
export const crewaiTools = {
|
|
14
|
+
crewai_health: {
|
|
15
|
+
name: 'crewai_health',
|
|
16
|
+
description: 'Check the health status of the connected CrewAI agent. Returns the agent status and connection info.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
connection_id: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Optional: specific connection ID. If omitted, uses the first active CrewAI connection.',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
crewai_inputs: {
|
|
28
|
+
name: 'crewai_inputs',
|
|
29
|
+
description: 'Get the required input fields for the CrewAI crew. Returns the list of input parameter names needed to start a kickoff.',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
connection_id: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Optional: specific connection ID. If omitted, uses the first active CrewAI connection.',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
crewai_kickoff: {
|
|
41
|
+
name: 'crewai_kickoff',
|
|
42
|
+
description: 'Start a CrewAI crew execution (kickoff). Provide the required inputs and the crew will begin processing. Returns a kickoff_id to track the status.',
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
inputs: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
description: 'The input parameters for the crew. Use crewai_inputs first to see which fields are required.',
|
|
49
|
+
additionalProperties: { type: 'string' },
|
|
50
|
+
},
|
|
51
|
+
connection_id: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Optional: specific connection ID. If omitted, uses the first active CrewAI connection.',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
required: ['inputs'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
crewai_status: {
|
|
60
|
+
name: 'crewai_status',
|
|
61
|
+
description: 'Check the status of a CrewAI crew execution. Provide the kickoff_id from a previous crewai_kickoff call. Returns the state, result, and execution details.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
kickoff_id: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'The kickoff ID returned from crewai_kickoff.',
|
|
68
|
+
},
|
|
69
|
+
connection_id: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: 'Optional: specific connection ID. If omitted, uses the first active CrewAI connection.',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ['kickoff_id'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
async function callGatewayProxy(client, payload) {
|
|
79
|
+
const url = `${client.apiUrl}/api/v1/gateway/agents/proxy`;
|
|
80
|
+
const response = await fetch(url, {
|
|
81
|
+
method: 'POST',
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-Type': 'application/json',
|
|
84
|
+
Authorization: `Bearer ${client.apiKey}`,
|
|
85
|
+
...(client.tenantId ? { 'X-Tenant-Id': client.tenantId } : {}),
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify({
|
|
88
|
+
...payload,
|
|
89
|
+
provider_id: payload.provider_id || 'crewai',
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
const errBody = await response.json().catch(() => ({
|
|
94
|
+
error: `Gateway proxy returned ${response.status}`,
|
|
95
|
+
}));
|
|
96
|
+
throw new Error(errBody.error ||
|
|
97
|
+
`Gateway proxy error: HTTP ${response.status}`);
|
|
98
|
+
}
|
|
99
|
+
return response.json();
|
|
100
|
+
}
|
|
101
|
+
// ============================================
|
|
102
|
+
// Tool Handlers
|
|
103
|
+
// ============================================
|
|
104
|
+
export async function handleCrewAIHealth(client, args) {
|
|
105
|
+
try {
|
|
106
|
+
const data = await callGatewayProxy(client, {
|
|
107
|
+
action: 'health',
|
|
108
|
+
connection_id: args.connection_id,
|
|
109
|
+
});
|
|
110
|
+
const conn = data.connection || {};
|
|
111
|
+
let text = `# CrewAI Health Check\n\n`;
|
|
112
|
+
text += `- **Status:** ${data.response?.status || 'unknown'}\n`;
|
|
113
|
+
text += `- **Connection:** ${conn.display_name || conn.connection_id}\n`;
|
|
114
|
+
text += `- **Provider:** ${conn.provider_id}\n`;
|
|
115
|
+
text += `- **Connection Status:** ${conn.status}\n`;
|
|
116
|
+
text += `- **Latency:** ${data.latency_ms}ms\n`;
|
|
117
|
+
return { content: [{ type: 'text', text }] };
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{ type: 'text', text: `CrewAI health check failed: ${error.message}` },
|
|
123
|
+
],
|
|
124
|
+
isError: true,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export async function handleCrewAIInputs(client, args) {
|
|
129
|
+
try {
|
|
130
|
+
const data = await callGatewayProxy(client, {
|
|
131
|
+
action: 'inputs',
|
|
132
|
+
connection_id: args.connection_id,
|
|
133
|
+
});
|
|
134
|
+
const inputs = data.response?.inputs || [];
|
|
135
|
+
const conn = data.connection || {};
|
|
136
|
+
let text = `# CrewAI Required Inputs\n\n`;
|
|
137
|
+
text += `**Crew:** ${conn.display_name || 'CrewAI'}\n\n`;
|
|
138
|
+
if (inputs.length > 0) {
|
|
139
|
+
text += `The following inputs are required to start a kickoff:\n\n`;
|
|
140
|
+
for (const input of inputs) {
|
|
141
|
+
text += `- \`${input}\`\n`;
|
|
142
|
+
}
|
|
143
|
+
text += `\nUse \`crewai_kickoff\` with these inputs to start the crew.`;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
text += `No inputs required. You can call \`crewai_kickoff\` with an empty inputs object.`;
|
|
147
|
+
}
|
|
148
|
+
return { content: [{ type: 'text', text }] };
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
return {
|
|
152
|
+
content: [
|
|
153
|
+
{ type: 'text', text: `Failed to get CrewAI inputs: ${error.message}` },
|
|
154
|
+
],
|
|
155
|
+
isError: true,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export async function handleCrewAIKickoff(client, args) {
|
|
160
|
+
try {
|
|
161
|
+
const data = await callGatewayProxy(client, {
|
|
162
|
+
action: 'kickoff',
|
|
163
|
+
inputs: args.inputs,
|
|
164
|
+
connection_id: args.connection_id,
|
|
165
|
+
});
|
|
166
|
+
const kickoffId = data.response?.kickoff_id;
|
|
167
|
+
const conn = data.connection || {};
|
|
168
|
+
let text = `# CrewAI Kickoff Started\n\n`;
|
|
169
|
+
text += `- **Crew:** ${conn.display_name || 'CrewAI'}\n`;
|
|
170
|
+
text += `- **Kickoff ID:** \`${kickoffId}\`\n`;
|
|
171
|
+
text += `- **Inputs:** ${JSON.stringify(args.inputs)}\n`;
|
|
172
|
+
text += `- **Latency:** ${data.latency_ms}ms\n\n`;
|
|
173
|
+
text += `Use \`crewai_status\` with kickoff_id \`${kickoffId}\` to check progress.`;
|
|
174
|
+
return { content: [{ type: 'text', text }] };
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{ type: 'text', text: `CrewAI kickoff failed: ${error.message}` },
|
|
180
|
+
],
|
|
181
|
+
isError: true,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
export async function handleCrewAIStatus(client, args) {
|
|
186
|
+
try {
|
|
187
|
+
const data = await callGatewayProxy(client, {
|
|
188
|
+
action: 'status',
|
|
189
|
+
kickoff_id: args.kickoff_id,
|
|
190
|
+
connection_id: args.connection_id,
|
|
191
|
+
});
|
|
192
|
+
const resp = data.response || {};
|
|
193
|
+
const conn = data.connection || {};
|
|
194
|
+
let text = `# CrewAI Execution Status\n\n`;
|
|
195
|
+
text += `- **Crew:** ${conn.display_name || 'CrewAI'}\n`;
|
|
196
|
+
text += `- **Kickoff ID:** \`${args.kickoff_id}\`\n`;
|
|
197
|
+
text += `- **State:** ${resp.state || 'unknown'}\n`;
|
|
198
|
+
text += `- **Status:** ${resp.status || 'unknown'}\n`;
|
|
199
|
+
if (resp.last_executed_task) {
|
|
200
|
+
text += `- **Last Task:** ${resp.last_executed_task}\n`;
|
|
201
|
+
}
|
|
202
|
+
if (resp.last_step) {
|
|
203
|
+
text += `- **Last Step:** ${resp.last_step}\n`;
|
|
204
|
+
}
|
|
205
|
+
text += `- **Latency:** ${data.latency_ms}ms\n`;
|
|
206
|
+
if (resp.result) {
|
|
207
|
+
text += `\n## Result\n\n${resp.result}\n`;
|
|
208
|
+
}
|
|
209
|
+
if (resp.result_json) {
|
|
210
|
+
text += `\n## Result (JSON)\n\n\`\`\`json\n${JSON.stringify(resp.result_json, null, 2)}\n\`\`\`\n`;
|
|
211
|
+
}
|
|
212
|
+
return { content: [{ type: 'text', text }] };
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: 'text',
|
|
219
|
+
text: `Failed to get CrewAI status: ${error.message}`,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
isError: true,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=crewai.js.map
|