wolfpack-mcp 1.0.46 → 1.0.48
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/agentBuilderTools.js +754 -0
- package/dist/client.js +154 -0
- package/dist/index.js +238 -51
- package/package.json +1 -1
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent builder MCP tool definitions and handlers.
|
|
3
|
+
* Registered only when the API key has the `agent_builder` capability.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const AGENT_BUILDER_TOOLS = [
|
|
7
|
+
// ─── Group 1: Agent CRUD ─────────────────────────────────────────────────
|
|
8
|
+
{
|
|
9
|
+
name: 'list_agents',
|
|
10
|
+
description: 'List all agents in the organisation. Returns name, status, template, and assigned projects.',
|
|
11
|
+
inputSchema: { type: 'object', properties: {} },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'get_agent',
|
|
15
|
+
description: 'Get full details for an agent including config, instructions, LLM model, and linked skills.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
20
|
+
},
|
|
21
|
+
required: ['agent_id'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'create_agent',
|
|
26
|
+
description: 'Create a new agent from a template. Use list_agent_templates to see available templates.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
template_id: { type: 'string', description: 'Template ID to create the agent from' },
|
|
31
|
+
name: { type: 'string', description: 'Display name for the agent' },
|
|
32
|
+
config: { type: 'object', description: 'Optional agent-specific configuration' },
|
|
33
|
+
},
|
|
34
|
+
required: ['template_id', 'name'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'update_agent',
|
|
39
|
+
description: "Update an agent's config, instructions, or LLM model. Omit fields to leave them unchanged.",
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
44
|
+
name: { type: 'string', description: 'Updated display name' },
|
|
45
|
+
instructions: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Agent-specific instructions (supplements template instructions). Set to null to clear.',
|
|
48
|
+
},
|
|
49
|
+
llm_provider: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'LLM provider ID (e.g. "anthropic"). Set to null for default.',
|
|
52
|
+
},
|
|
53
|
+
llm_model: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'LLM model ID (e.g. "claude-sonnet-4-6"). Set to null for family auto-select.',
|
|
56
|
+
},
|
|
57
|
+
llm_family: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'LLM model family (e.g. "sonnet"). Agent auto-upgrades to latest in family.',
|
|
60
|
+
},
|
|
61
|
+
scheduling_enabled: { type: 'boolean', description: 'Whether scheduled tasks are enabled' },
|
|
62
|
+
},
|
|
63
|
+
required: ['agent_id'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
// ─── Group 2: Project Assignment ─────────────────────────────────────────
|
|
67
|
+
{
|
|
68
|
+
name: 'list_agent_projects',
|
|
69
|
+
description: 'List projects assigned to an agent.',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
74
|
+
},
|
|
75
|
+
required: ['agent_id'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'assign_agent_to_project',
|
|
80
|
+
description: 'Assign an agent to a project by slug.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
85
|
+
project_slug: { type: 'string', description: 'Project slug to assign the agent to' },
|
|
86
|
+
},
|
|
87
|
+
required: ['agent_id', 'project_slug'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'remove_agent_from_project',
|
|
92
|
+
description: 'Remove an agent from a project.',
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
97
|
+
project_slug: { type: 'string', description: 'Project slug to remove the agent from' },
|
|
98
|
+
},
|
|
99
|
+
required: ['agent_id', 'project_slug'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
// ─── Group 3: Sessions ────────────────────────────────────────────────────
|
|
103
|
+
{
|
|
104
|
+
name: 'list_agent_sessions',
|
|
105
|
+
description: 'List sessions for an agent. Filter by status: running, stopped, failed.',
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
110
|
+
status: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
enum: ['pending', 'starting', 'running', 'stopping', 'stopped', 'failed'],
|
|
113
|
+
description: 'Filter by session status',
|
|
114
|
+
},
|
|
115
|
+
limit: { type: 'number', description: 'Maximum sessions to return' },
|
|
116
|
+
offset: { type: 'number', description: 'Sessions to skip for pagination' },
|
|
117
|
+
},
|
|
118
|
+
required: ['agent_id'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'get_agent_session',
|
|
123
|
+
description: 'Get session metadata and recent events (last 20). Does NOT include full conversation — use get_agent_session_conversation for that.',
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
properties: {
|
|
127
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
128
|
+
session_id: { type: 'string', description: 'Session ID' },
|
|
129
|
+
},
|
|
130
|
+
required: ['agent_id', 'session_id'],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'get_agent_session_conversation',
|
|
135
|
+
description: 'Get the full conversation history for a session (paginated). Can be large for long-running sessions.',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
140
|
+
session_id: { type: 'string', description: 'Session ID' },
|
|
141
|
+
limit: { type: 'number', description: 'Turns to return' },
|
|
142
|
+
offset: { type: 'number', description: 'Turns to skip' },
|
|
143
|
+
},
|
|
144
|
+
required: ['agent_id', 'session_id'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'run_agent',
|
|
149
|
+
description: 'Queue an ad-hoc session with an inline prompt. This is async — it returns a queue entry ID immediately. ' +
|
|
150
|
+
'Use list_agent_queue or list_agent_sessions to track progress.',
|
|
151
|
+
inputSchema: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
155
|
+
prompt: { type: 'string', description: 'What the agent should do' },
|
|
156
|
+
project_slug: { type: 'string', description: 'Project to scope the session to (optional)' },
|
|
157
|
+
},
|
|
158
|
+
required: ['agent_id', 'prompt'],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'stop_agent_session',
|
|
163
|
+
description: 'Stop a running agent session.',
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
168
|
+
session_id: { type: 'string', description: 'Session ID to stop' },
|
|
169
|
+
},
|
|
170
|
+
required: ['agent_id', 'session_id'],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'resume_agent_session',
|
|
175
|
+
description: 'Resume a completed session with a follow-up prompt. The agent continues with full prior context.',
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
180
|
+
session_id: { type: 'string', description: 'Completed session ID to resume' },
|
|
181
|
+
prompt: { type: 'string', description: 'Follow-up prompt for the agent' },
|
|
182
|
+
},
|
|
183
|
+
required: ['agent_id', 'session_id', 'prompt'],
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
// ─── Group 4: Tasks & Queue ───────────────────────────────────────────────
|
|
187
|
+
{
|
|
188
|
+
name: 'list_agent_tasks',
|
|
189
|
+
description: 'List defined tasks for an agent.',
|
|
190
|
+
inputSchema: {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
194
|
+
},
|
|
195
|
+
required: ['agent_id'],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'get_agent_task',
|
|
200
|
+
description: 'Get details of a specific agent task.',
|
|
201
|
+
inputSchema: {
|
|
202
|
+
type: 'object',
|
|
203
|
+
properties: {
|
|
204
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
205
|
+
task_id: { type: 'string', description: 'Task ID' },
|
|
206
|
+
},
|
|
207
|
+
required: ['agent_id', 'task_id'],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'create_agent_task',
|
|
212
|
+
description: 'Create a new task for an agent.',
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: {
|
|
216
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
217
|
+
name: { type: 'string', description: 'Task name' },
|
|
218
|
+
prompt: { type: 'string', description: 'What the agent should do when this task runs' },
|
|
219
|
+
scheduled_enabled: {
|
|
220
|
+
type: 'boolean',
|
|
221
|
+
description: 'Whether this task is included in scheduled runs (default false)',
|
|
222
|
+
},
|
|
223
|
+
sort_order: {
|
|
224
|
+
type: 'number',
|
|
225
|
+
description: 'Order within scheduled batch (lower = first)',
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
required: ['agent_id', 'name', 'prompt'],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'update_agent_task',
|
|
233
|
+
description: "Update a task's prompt or schedule settings.",
|
|
234
|
+
inputSchema: {
|
|
235
|
+
type: 'object',
|
|
236
|
+
properties: {
|
|
237
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
238
|
+
task_id: { type: 'string', description: 'Task ID' },
|
|
239
|
+
name: { type: 'string', description: 'Updated task name' },
|
|
240
|
+
prompt: { type: 'string', description: 'Updated prompt' },
|
|
241
|
+
scheduled_enabled: { type: 'boolean', description: 'Include in scheduled runs' },
|
|
242
|
+
sort_order: { type: 'number', description: 'Order within scheduled batch' },
|
|
243
|
+
is_active: { type: 'boolean', description: 'Whether this task is active' },
|
|
244
|
+
},
|
|
245
|
+
required: ['agent_id', 'task_id'],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'run_agent_task',
|
|
250
|
+
description: 'Queue a saved task for immediate execution. Async — returns a queue entry ID. ' +
|
|
251
|
+
'Use list_agent_queue to track progress.',
|
|
252
|
+
inputSchema: {
|
|
253
|
+
type: 'object',
|
|
254
|
+
properties: {
|
|
255
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
256
|
+
task_id: { type: 'string', description: 'Task ID to run' },
|
|
257
|
+
project_slug: { type: 'string', description: 'Project to scope the session to (optional)' },
|
|
258
|
+
},
|
|
259
|
+
required: ['agent_id', 'task_id'],
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'list_agent_queue',
|
|
264
|
+
description: 'List queue entries for an agent. Use this to track progress after run_agent or run_agent_task.',
|
|
265
|
+
inputSchema: {
|
|
266
|
+
type: 'object',
|
|
267
|
+
properties: {
|
|
268
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
269
|
+
status: {
|
|
270
|
+
type: 'string',
|
|
271
|
+
enum: ['queued', 'running', 'completed', 'failed', 'cancelled'],
|
|
272
|
+
description: 'Filter by queue entry status',
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
required: ['agent_id'],
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: 'cancel_queue_entry',
|
|
280
|
+
description: 'Cancel a queued (not yet running) queue entry.',
|
|
281
|
+
inputSchema: {
|
|
282
|
+
type: 'object',
|
|
283
|
+
properties: {
|
|
284
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
285
|
+
entry_id: { type: 'string', description: 'Queue entry ID to cancel' },
|
|
286
|
+
},
|
|
287
|
+
required: ['agent_id', 'entry_id'],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
// ─── Group 5: Skills (authoring) ─────────────────────────────────────────
|
|
291
|
+
{
|
|
292
|
+
name: 'create_skill',
|
|
293
|
+
description: 'Create a new org-level skill. Skills are reusable capability packs agents can load on demand.',
|
|
294
|
+
inputSchema: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
name: {
|
|
298
|
+
type: 'string',
|
|
299
|
+
description: 'Skill name (lowercase letters, numbers, hyphens only, e.g. "deploy-app")',
|
|
300
|
+
},
|
|
301
|
+
description: {
|
|
302
|
+
type: 'string',
|
|
303
|
+
description: 'What the skill does and when to use it (max 1024 chars)',
|
|
304
|
+
},
|
|
305
|
+
content: {
|
|
306
|
+
type: 'string',
|
|
307
|
+
description: 'Instruction body in markdown',
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
required: ['name', 'description', 'content'],
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'update_skill',
|
|
315
|
+
description: "Update a skill's instructions or description.",
|
|
316
|
+
inputSchema: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
properties: {
|
|
319
|
+
skill_id: { type: 'string', description: 'Skill ID (UUID)' },
|
|
320
|
+
name: { type: 'string', description: 'Updated skill name' },
|
|
321
|
+
description: { type: 'string', description: 'Updated description' },
|
|
322
|
+
content: { type: 'string', description: 'Updated instruction body' },
|
|
323
|
+
},
|
|
324
|
+
required: ['skill_id'],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'create_skill_resource',
|
|
329
|
+
description: 'Add a text resource to a skill (script, reference, or asset).',
|
|
330
|
+
inputSchema: {
|
|
331
|
+
type: 'object',
|
|
332
|
+
properties: {
|
|
333
|
+
skill_id: { type: 'string', description: 'Skill ID (UUID)' },
|
|
334
|
+
type: {
|
|
335
|
+
type: 'string',
|
|
336
|
+
enum: ['script', 'reference', 'asset'],
|
|
337
|
+
description: 'Resource type',
|
|
338
|
+
},
|
|
339
|
+
name: { type: 'string', description: 'Resource filename' },
|
|
340
|
+
content: { type: 'string', description: 'Resource text content' },
|
|
341
|
+
mime_type: { type: 'string', description: 'MIME type (optional)' },
|
|
342
|
+
},
|
|
343
|
+
required: ['skill_id', 'type', 'name', 'content'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'update_skill_resource',
|
|
348
|
+
description: "Update a skill resource's content.",
|
|
349
|
+
inputSchema: {
|
|
350
|
+
type: 'object',
|
|
351
|
+
properties: {
|
|
352
|
+
skill_id: { type: 'string', description: 'Skill ID (UUID)' },
|
|
353
|
+
resource_id: { type: 'string', description: 'Resource ID (UUID)' },
|
|
354
|
+
name: { type: 'string', description: 'Updated filename' },
|
|
355
|
+
content: { type: 'string', description: 'Updated text content' },
|
|
356
|
+
mime_type: { type: 'string', description: 'Updated MIME type' },
|
|
357
|
+
},
|
|
358
|
+
required: ['skill_id', 'resource_id'],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: 'set_agent_skills',
|
|
363
|
+
description: 'Replace the full set of skills assigned to an agent. ' +
|
|
364
|
+
'Use list_skills to find skill IDs, then pass all desired skill IDs here.',
|
|
365
|
+
inputSchema: {
|
|
366
|
+
type: 'object',
|
|
367
|
+
properties: {
|
|
368
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
369
|
+
skill_ids: {
|
|
370
|
+
type: 'array',
|
|
371
|
+
items: { type: 'string' },
|
|
372
|
+
description: 'Array of skill IDs to assign (replaces all current assignments)',
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
required: ['agent_id', 'skill_ids'],
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
// ─── Group 6: Secrets ─────────────────────────────────────────────────────
|
|
379
|
+
{
|
|
380
|
+
name: 'list_agent_secrets',
|
|
381
|
+
description: 'List secret names for an agent. Values are never returned.',
|
|
382
|
+
inputSchema: {
|
|
383
|
+
type: 'object',
|
|
384
|
+
properties: {
|
|
385
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
386
|
+
},
|
|
387
|
+
required: ['agent_id'],
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: 'set_agent_secret',
|
|
392
|
+
description: 'Create or update a secret for an agent. ' +
|
|
393
|
+
'Name must be uppercase letters, digits, and underscores (e.g. MY_API_KEY).',
|
|
394
|
+
inputSchema: {
|
|
395
|
+
type: 'object',
|
|
396
|
+
properties: {
|
|
397
|
+
agent_id: { type: 'string', description: 'Agent profile ID' },
|
|
398
|
+
name: { type: 'string', description: 'Secret name (e.g. MY_API_KEY)' },
|
|
399
|
+
value: { type: 'string', description: 'Secret value (encrypted at rest)' },
|
|
400
|
+
},
|
|
401
|
+
required: ['agent_id', 'name', 'value'],
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
// ─── Group 7: Discovery ───────────────────────────────────────────────────
|
|
405
|
+
{
|
|
406
|
+
name: 'list_agent_templates',
|
|
407
|
+
description: 'List agent templates available to the organisation. Use template IDs when calling create_agent.',
|
|
408
|
+
inputSchema: { type: 'object', properties: {} },
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: 'list_llm_models',
|
|
412
|
+
description: 'List LLM providers and models available to the organisation. ' +
|
|
413
|
+
'Use provider and model IDs when calling create_agent or update_agent.',
|
|
414
|
+
inputSchema: { type: 'object', properties: {} },
|
|
415
|
+
},
|
|
416
|
+
];
|
|
417
|
+
// Zod schemas for argument parsing
|
|
418
|
+
const AgentIdSchema = z.object({ agent_id: z.string() });
|
|
419
|
+
const AgentSessionSchema = z.object({ agent_id: z.string(), session_id: z.string() });
|
|
420
|
+
const AgentTaskSchema = z.object({ agent_id: z.string(), task_id: z.string() });
|
|
421
|
+
const SkillIdSchema = z.object({ skill_id: z.string() });
|
|
422
|
+
export async function handleAgentBuilderTool(name, args, client) {
|
|
423
|
+
const text = (t) => JSON.stringify(t, null, 2);
|
|
424
|
+
switch (name) {
|
|
425
|
+
// ─── Agent CRUD ────────────────────────────────────────────────────────
|
|
426
|
+
case 'list_agents': {
|
|
427
|
+
const agents = await client.listAgents();
|
|
428
|
+
return { content: [{ type: 'text', text: text(agents) }] };
|
|
429
|
+
}
|
|
430
|
+
case 'get_agent': {
|
|
431
|
+
const { agent_id } = AgentIdSchema.parse(args);
|
|
432
|
+
const agent = await client.getAgent(agent_id);
|
|
433
|
+
if (!agent)
|
|
434
|
+
return { content: [{ type: 'text', text: 'Agent not found' }] };
|
|
435
|
+
return { content: [{ type: 'text', text: text(agent) }] };
|
|
436
|
+
}
|
|
437
|
+
case 'create_agent': {
|
|
438
|
+
const parsed = z
|
|
439
|
+
.object({
|
|
440
|
+
template_id: z.string(),
|
|
441
|
+
name: z.string(),
|
|
442
|
+
config: z.record(z.unknown()).optional(),
|
|
443
|
+
})
|
|
444
|
+
.parse(args);
|
|
445
|
+
const agent = await client.createAgent({
|
|
446
|
+
templateId: parsed.template_id,
|
|
447
|
+
name: parsed.name,
|
|
448
|
+
config: parsed.config,
|
|
449
|
+
});
|
|
450
|
+
return {
|
|
451
|
+
content: [
|
|
452
|
+
{
|
|
453
|
+
type: 'text',
|
|
454
|
+
text: `Created agent "${agent.user?.comment || agent.userId}"\n\n${text(agent)}`,
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
case 'update_agent': {
|
|
460
|
+
const parsed = z
|
|
461
|
+
.object({
|
|
462
|
+
agent_id: z.string(),
|
|
463
|
+
name: z.string().optional(),
|
|
464
|
+
instructions: z.string().nullable().optional(),
|
|
465
|
+
llm_provider: z.string().nullable().optional(),
|
|
466
|
+
llm_model: z.string().nullable().optional(),
|
|
467
|
+
llm_family: z.string().nullable().optional(),
|
|
468
|
+
scheduling_enabled: z.boolean().optional(),
|
|
469
|
+
})
|
|
470
|
+
.parse(args);
|
|
471
|
+
const { agent_id, ...rest } = parsed;
|
|
472
|
+
const fields = {};
|
|
473
|
+
if (rest.name !== undefined)
|
|
474
|
+
fields.name = rest.name;
|
|
475
|
+
if (rest.instructions !== undefined)
|
|
476
|
+
fields.instructions = rest.instructions;
|
|
477
|
+
if (rest.llm_provider !== undefined)
|
|
478
|
+
fields.llmProvider = rest.llm_provider;
|
|
479
|
+
if (rest.llm_model !== undefined)
|
|
480
|
+
fields.llmModel = rest.llm_model;
|
|
481
|
+
if (rest.llm_family !== undefined)
|
|
482
|
+
fields.llmFamily = rest.llm_family;
|
|
483
|
+
if (rest.scheduling_enabled !== undefined)
|
|
484
|
+
fields.schedulingEnabled = rest.scheduling_enabled;
|
|
485
|
+
const agent = await client.updateAgent(agent_id, fields);
|
|
486
|
+
return { content: [{ type: 'text', text: `Updated agent\n\n${text(agent)}` }] };
|
|
487
|
+
}
|
|
488
|
+
// ─── Project Assignment ─────────────────────────────────────────────────
|
|
489
|
+
case 'list_agent_projects': {
|
|
490
|
+
const { agent_id } = AgentIdSchema.parse(args);
|
|
491
|
+
const projects = await client.listAgentProjects(agent_id);
|
|
492
|
+
return { content: [{ type: 'text', text: text(projects) }] };
|
|
493
|
+
}
|
|
494
|
+
case 'assign_agent_to_project': {
|
|
495
|
+
const parsed = z.object({ agent_id: z.string(), project_slug: z.string() }).parse(args);
|
|
496
|
+
await client.assignAgentToProject(parsed.agent_id, parsed.project_slug);
|
|
497
|
+
return {
|
|
498
|
+
content: [{ type: 'text', text: `Assigned agent to project "${parsed.project_slug}"` }],
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
case 'remove_agent_from_project': {
|
|
502
|
+
const parsed = z.object({ agent_id: z.string(), project_slug: z.string() }).parse(args);
|
|
503
|
+
await client.removeAgentFromProject(parsed.agent_id, parsed.project_slug);
|
|
504
|
+
return {
|
|
505
|
+
content: [{ type: 'text', text: `Removed agent from project "${parsed.project_slug}"` }],
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
// ─── Sessions ───────────────────────────────────────────────────────────
|
|
509
|
+
case 'list_agent_sessions': {
|
|
510
|
+
const parsed = z
|
|
511
|
+
.object({
|
|
512
|
+
agent_id: z.string(),
|
|
513
|
+
status: z.string().optional(),
|
|
514
|
+
limit: z.number().optional(),
|
|
515
|
+
offset: z.number().optional(),
|
|
516
|
+
})
|
|
517
|
+
.parse(args);
|
|
518
|
+
const sessions = await client.listAgentSessions(parsed.agent_id, {
|
|
519
|
+
status: parsed.status,
|
|
520
|
+
limit: parsed.limit,
|
|
521
|
+
offset: parsed.offset,
|
|
522
|
+
});
|
|
523
|
+
return { content: [{ type: 'text', text: text(sessions) }] };
|
|
524
|
+
}
|
|
525
|
+
case 'get_agent_session': {
|
|
526
|
+
const { agent_id, session_id } = AgentSessionSchema.parse(args);
|
|
527
|
+
const session = await client.getAgentSession(agent_id, session_id);
|
|
528
|
+
if (!session)
|
|
529
|
+
return { content: [{ type: 'text', text: 'Session not found' }] };
|
|
530
|
+
return { content: [{ type: 'text', text: text(session) }] };
|
|
531
|
+
}
|
|
532
|
+
case 'get_agent_session_conversation': {
|
|
533
|
+
const parsed = z
|
|
534
|
+
.object({
|
|
535
|
+
agent_id: z.string(),
|
|
536
|
+
session_id: z.string(),
|
|
537
|
+
limit: z.number().optional(),
|
|
538
|
+
offset: z.number().optional(),
|
|
539
|
+
})
|
|
540
|
+
.parse(args);
|
|
541
|
+
const conv = await client.getAgentSessionConversation(parsed.agent_id, parsed.session_id, {
|
|
542
|
+
limit: parsed.limit,
|
|
543
|
+
offset: parsed.offset,
|
|
544
|
+
});
|
|
545
|
+
return { content: [{ type: 'text', text: text(conv) }] };
|
|
546
|
+
}
|
|
547
|
+
case 'run_agent': {
|
|
548
|
+
const parsed = z
|
|
549
|
+
.object({ agent_id: z.string(), prompt: z.string(), project_slug: z.string().optional() })
|
|
550
|
+
.parse(args);
|
|
551
|
+
const result = await client.runAgent(parsed.agent_id, parsed.prompt, parsed.project_slug);
|
|
552
|
+
return {
|
|
553
|
+
content: [
|
|
554
|
+
{
|
|
555
|
+
type: 'text',
|
|
556
|
+
text: `Queued session (entry ID: ${result.entryId}, position: ${result.position}, executing: ${result.executing})\n\nUse list_agent_queue or list_agent_sessions to track progress.`,
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
case 'stop_agent_session': {
|
|
562
|
+
const { agent_id, session_id } = AgentSessionSchema.parse(args);
|
|
563
|
+
const session = await client.stopAgentSession(agent_id, session_id);
|
|
564
|
+
return {
|
|
565
|
+
content: [
|
|
566
|
+
{ type: 'text', text: `Stopped session (status: ${session.status})\n\n${text(session)}` },
|
|
567
|
+
],
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
case 'resume_agent_session': {
|
|
571
|
+
const parsed = z
|
|
572
|
+
.object({ agent_id: z.string(), session_id: z.string(), prompt: z.string() })
|
|
573
|
+
.parse(args);
|
|
574
|
+
const session = await client.resumeAgentSession(parsed.agent_id, parsed.session_id, parsed.prompt);
|
|
575
|
+
return { content: [{ type: 'text', text: `Resumed session\n\n${text(session)}` }] };
|
|
576
|
+
}
|
|
577
|
+
// ─── Tasks ──────────────────────────────────────────────────────────────
|
|
578
|
+
case 'list_agent_tasks': {
|
|
579
|
+
const { agent_id } = AgentIdSchema.parse(args);
|
|
580
|
+
const tasks = await client.listAgentTasks(agent_id);
|
|
581
|
+
return { content: [{ type: 'text', text: text(tasks) }] };
|
|
582
|
+
}
|
|
583
|
+
case 'get_agent_task': {
|
|
584
|
+
const { agent_id, task_id } = AgentTaskSchema.parse(args);
|
|
585
|
+
const task = await client.getAgentTask(agent_id, task_id);
|
|
586
|
+
if (!task)
|
|
587
|
+
return { content: [{ type: 'text', text: 'Task not found' }] };
|
|
588
|
+
return { content: [{ type: 'text', text: text(task) }] };
|
|
589
|
+
}
|
|
590
|
+
case 'create_agent_task': {
|
|
591
|
+
const parsed = z
|
|
592
|
+
.object({
|
|
593
|
+
agent_id: z.string(),
|
|
594
|
+
name: z.string(),
|
|
595
|
+
prompt: z.string(),
|
|
596
|
+
scheduled_enabled: z.boolean().optional(),
|
|
597
|
+
sort_order: z.number().optional(),
|
|
598
|
+
})
|
|
599
|
+
.parse(args);
|
|
600
|
+
const task = await client.createAgentTask(parsed.agent_id, {
|
|
601
|
+
name: parsed.name,
|
|
602
|
+
prompt: parsed.prompt,
|
|
603
|
+
scheduledEnabled: parsed.scheduled_enabled,
|
|
604
|
+
sortOrder: parsed.sort_order,
|
|
605
|
+
});
|
|
606
|
+
return { content: [{ type: 'text', text: `Created task "${task.name}"\n\n${text(task)}` }] };
|
|
607
|
+
}
|
|
608
|
+
case 'update_agent_task': {
|
|
609
|
+
const parsed = z
|
|
610
|
+
.object({
|
|
611
|
+
agent_id: z.string(),
|
|
612
|
+
task_id: z.string(),
|
|
613
|
+
name: z.string().optional(),
|
|
614
|
+
prompt: z.string().optional(),
|
|
615
|
+
scheduled_enabled: z.boolean().optional(),
|
|
616
|
+
sort_order: z.number().optional(),
|
|
617
|
+
is_active: z.boolean().optional(),
|
|
618
|
+
})
|
|
619
|
+
.parse(args);
|
|
620
|
+
const fields = {};
|
|
621
|
+
if (parsed.name !== undefined)
|
|
622
|
+
fields.name = parsed.name;
|
|
623
|
+
if (parsed.prompt !== undefined)
|
|
624
|
+
fields.prompt = parsed.prompt;
|
|
625
|
+
if (parsed.scheduled_enabled !== undefined)
|
|
626
|
+
fields.scheduledEnabled = parsed.scheduled_enabled;
|
|
627
|
+
if (parsed.sort_order !== undefined)
|
|
628
|
+
fields.sortOrder = parsed.sort_order;
|
|
629
|
+
if (parsed.is_active !== undefined)
|
|
630
|
+
fields.isActive = parsed.is_active;
|
|
631
|
+
const task = await client.updateAgentTask(parsed.agent_id, parsed.task_id, fields);
|
|
632
|
+
return { content: [{ type: 'text', text: `Updated task\n\n${text(task)}` }] };
|
|
633
|
+
}
|
|
634
|
+
case 'run_agent_task': {
|
|
635
|
+
const parsed = z
|
|
636
|
+
.object({ agent_id: z.string(), task_id: z.string(), project_slug: z.string().optional() })
|
|
637
|
+
.parse(args);
|
|
638
|
+
const result = await client.runAgentTask(parsed.agent_id, parsed.task_id, parsed.project_slug);
|
|
639
|
+
return {
|
|
640
|
+
content: [
|
|
641
|
+
{
|
|
642
|
+
type: 'text',
|
|
643
|
+
text: `Queued task (entry ID: ${result.entryId}, position: ${result.position}, executing: ${result.executing})\n\nUse list_agent_queue to track progress.`,
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
case 'list_agent_queue': {
|
|
649
|
+
const parsed = z.object({ agent_id: z.string(), status: z.string().optional() }).parse(args);
|
|
650
|
+
const entries = await client.listAgentQueue(parsed.agent_id, parsed.status);
|
|
651
|
+
return { content: [{ type: 'text', text: text(entries) }] };
|
|
652
|
+
}
|
|
653
|
+
case 'cancel_queue_entry': {
|
|
654
|
+
const parsed = z.object({ agent_id: z.string(), entry_id: z.string() }).parse(args);
|
|
655
|
+
await client.cancelQueueEntry(parsed.agent_id, parsed.entry_id);
|
|
656
|
+
return { content: [{ type: 'text', text: `Cancelled queue entry ${parsed.entry_id}` }] };
|
|
657
|
+
}
|
|
658
|
+
// ─── Skills ─────────────────────────────────────────────────────────────
|
|
659
|
+
case 'create_skill': {
|
|
660
|
+
const parsed = z
|
|
661
|
+
.object({ name: z.string(), description: z.string(), content: z.string() })
|
|
662
|
+
.parse(args);
|
|
663
|
+
const skill = await client.createSkill(parsed);
|
|
664
|
+
return {
|
|
665
|
+
content: [{ type: 'text', text: `Created skill "${parsed.name}"\n\n${text(skill)}` }],
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
case 'update_skill': {
|
|
669
|
+
const parsed = z
|
|
670
|
+
.object({
|
|
671
|
+
skill_id: z.string(),
|
|
672
|
+
name: z.string().optional(),
|
|
673
|
+
description: z.string().optional(),
|
|
674
|
+
content: z.string().optional(),
|
|
675
|
+
})
|
|
676
|
+
.parse(args);
|
|
677
|
+
const { skill_id, ...fields } = parsed;
|
|
678
|
+
const skill = await client.updateSkill(skill_id, fields);
|
|
679
|
+
return { content: [{ type: 'text', text: `Updated skill\n\n${text(skill)}` }] };
|
|
680
|
+
}
|
|
681
|
+
case 'create_skill_resource': {
|
|
682
|
+
const parsed = z
|
|
683
|
+
.object({
|
|
684
|
+
skill_id: z.string(),
|
|
685
|
+
type: z.enum(['script', 'reference', 'asset']),
|
|
686
|
+
name: z.string(),
|
|
687
|
+
content: z.string(),
|
|
688
|
+
mime_type: z.string().optional(),
|
|
689
|
+
})
|
|
690
|
+
.parse(args);
|
|
691
|
+
const { skill_id, mime_type, ...rest } = parsed;
|
|
692
|
+
const resource = await client.createSkillResource(skill_id, { ...rest, mimeType: mime_type });
|
|
693
|
+
return {
|
|
694
|
+
content: [{ type: 'text', text: `Created resource "${parsed.name}"\n\n${text(resource)}` }],
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
case 'update_skill_resource': {
|
|
698
|
+
const parsed = z
|
|
699
|
+
.object({
|
|
700
|
+
skill_id: z.string(),
|
|
701
|
+
resource_id: z.string(),
|
|
702
|
+
name: z.string().optional(),
|
|
703
|
+
content: z.string().optional(),
|
|
704
|
+
mime_type: z.string().optional(),
|
|
705
|
+
})
|
|
706
|
+
.parse(args);
|
|
707
|
+
const { skill_id, resource_id, mime_type, ...rest } = parsed;
|
|
708
|
+
const resource = await client.updateSkillResource(skill_id, resource_id, {
|
|
709
|
+
...rest,
|
|
710
|
+
mimeType: mime_type,
|
|
711
|
+
});
|
|
712
|
+
return { content: [{ type: 'text', text: `Updated resource\n\n${text(resource)}` }] };
|
|
713
|
+
}
|
|
714
|
+
case 'set_agent_skills': {
|
|
715
|
+
const parsed = z.object({ agent_id: z.string(), skill_ids: z.array(z.string()) }).parse(args);
|
|
716
|
+
await client.setAgentSkills(parsed.agent_id, parsed.skill_ids);
|
|
717
|
+
return {
|
|
718
|
+
content: [
|
|
719
|
+
{
|
|
720
|
+
type: 'text',
|
|
721
|
+
text: `Set ${parsed.skill_ids.length} skill(s) on agent ${parsed.agent_id}`,
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
// ─── Secrets ─────────────────────────────────────────────────────────────
|
|
727
|
+
case 'list_agent_secrets': {
|
|
728
|
+
const { agent_id } = AgentIdSchema.parse(args);
|
|
729
|
+
const secrets = await client.listAgentSecrets(agent_id);
|
|
730
|
+
return { content: [{ type: 'text', text: text(secrets) }] };
|
|
731
|
+
}
|
|
732
|
+
case 'set_agent_secret': {
|
|
733
|
+
const parsed = z
|
|
734
|
+
.object({ agent_id: z.string(), name: z.string(), value: z.string() })
|
|
735
|
+
.parse(args);
|
|
736
|
+
const secret = await client.setAgentSecret(parsed.agent_id, parsed.name, parsed.value);
|
|
737
|
+
return { content: [{ type: 'text', text: `Set secret "${secret.name}"` }] };
|
|
738
|
+
}
|
|
739
|
+
// ─── Discovery ────────────────────────────────────────────────────────────
|
|
740
|
+
case 'list_agent_templates': {
|
|
741
|
+
const templates = await client.listAgentTemplates();
|
|
742
|
+
return { content: [{ type: 'text', text: text(templates) }] };
|
|
743
|
+
}
|
|
744
|
+
case 'list_llm_models': {
|
|
745
|
+
const models = await client.listLlmModels();
|
|
746
|
+
return { content: [{ type: 'text', text: text(models) }] };
|
|
747
|
+
}
|
|
748
|
+
default:
|
|
749
|
+
return {
|
|
750
|
+
content: [{ type: 'text', text: `Unknown agent builder tool: ${name}` }],
|
|
751
|
+
isError: true,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
}
|