wolfpack-mcp 1.0.52 → 1.0.53
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 +19 -0
- package/dist/agentBuilderTools.js +178 -70
- package/dist/agentSelfTools.js +124 -0
- package/dist/client.js +175 -66
- package/dist/config.js +4 -0
- package/dist/index.js +37 -7
- package/dist/procedureTools.js +208 -0
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure MCP tool definitions and handlers.
|
|
3
|
+
* Enables agents to list, view, create, update, and delete procedures.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const PROCEDURE_TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'list_procedures',
|
|
9
|
+
description: 'List procedures in a project. Returns name, status, version, tags, and case count. ' +
|
|
10
|
+
'Use get_procedure to see the full workflow definition.',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
project_slug: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Project slug (required for multi-project users)',
|
|
17
|
+
},
|
|
18
|
+
search: { type: 'string', description: 'Search in name and description' },
|
|
19
|
+
active_only: { type: 'boolean', description: 'Only return active procedures' },
|
|
20
|
+
limit: { type: 'number', description: 'Maximum procedures to return' },
|
|
21
|
+
offset: { type: 'number', description: 'Procedures to skip for pagination' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'get_procedure',
|
|
27
|
+
description: 'Get full details of a procedure including its workflow definition (nodes and edges). ' +
|
|
28
|
+
'The definition uses a graph format: nodes have id, type (start/end/activity/decision/loop/parallel/wait), ' +
|
|
29
|
+
'position, and data; edges connect nodes via source/target IDs. ' +
|
|
30
|
+
'Accepts UUID or refId (requires project_slug for refId).',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
procedure_id: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Procedure UUID or refId number',
|
|
37
|
+
},
|
|
38
|
+
project_slug: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'Project slug (required when using refId)',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ['procedure_id'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'create_procedure',
|
|
48
|
+
description: 'Create a new procedure. If no definition is provided, creates a default start→end workflow. ' +
|
|
49
|
+
'The definition is a graph with nodes and edges. Node types: start, end, activity, decision, loop, parallel, wait. ' +
|
|
50
|
+
'Each node needs id, type, position ({x, y}), and data (type-specific config). ' +
|
|
51
|
+
'Edges connect nodes: {id, source, target}. The procedure starts as inactive (isActive=false).',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
name: { type: 'string', description: 'Procedure name (unique per project)' },
|
|
56
|
+
description: { type: 'string', description: 'Short description' },
|
|
57
|
+
definition: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
description: 'Workflow definition: { nodes: [{id, type, position: {x, y}, data: {...}}], edges: [{id, source, target}] }',
|
|
60
|
+
},
|
|
61
|
+
tags: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: { type: 'string' },
|
|
64
|
+
description: 'Tags for categorization',
|
|
65
|
+
},
|
|
66
|
+
project_slug: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'Project slug (required for multi-project users)',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['name'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'update_procedure',
|
|
76
|
+
description: 'Update a procedure. Only provide the fields you want to change. ' +
|
|
77
|
+
'Updating the definition auto-increments the version number. ' +
|
|
78
|
+
'Set isActive to true/false to activate/deactivate the procedure. ' +
|
|
79
|
+
'Accepts UUID or refId (requires project_slug for refId).',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
procedure_id: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'Procedure UUID or refId number',
|
|
86
|
+
},
|
|
87
|
+
name: { type: 'string', description: 'Updated name' },
|
|
88
|
+
description: {
|
|
89
|
+
type: ['string', 'null'],
|
|
90
|
+
description: 'Updated description (null to clear)',
|
|
91
|
+
},
|
|
92
|
+
information: {
|
|
93
|
+
type: ['string', 'null'],
|
|
94
|
+
description: 'Extended documentation/guide (null to clear)',
|
|
95
|
+
},
|
|
96
|
+
definition: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
description: 'Updated workflow definition: { nodes: [...], edges: [...] }. Changes increment version.',
|
|
99
|
+
},
|
|
100
|
+
is_active: { type: 'boolean', description: 'Activate or deactivate the procedure' },
|
|
101
|
+
tags: {
|
|
102
|
+
type: 'array',
|
|
103
|
+
items: { type: 'string' },
|
|
104
|
+
description: 'Updated tags (replaces existing)',
|
|
105
|
+
},
|
|
106
|
+
project_slug: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
description: 'Project slug (required when using refId)',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
required: ['procedure_id'],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
export async function handleProcedureTool(name, args, client) {
|
|
116
|
+
const text = (t) => JSON.stringify(t, null, 2);
|
|
117
|
+
switch (name) {
|
|
118
|
+
case 'list_procedures': {
|
|
119
|
+
const parsed = z
|
|
120
|
+
.object({
|
|
121
|
+
project_slug: z.string().optional(),
|
|
122
|
+
search: z.string().optional(),
|
|
123
|
+
active_only: z.preprocess((v) => (typeof v === 'string' ? v === 'true' : v), z.boolean().optional()),
|
|
124
|
+
limit: z.coerce.number().optional(),
|
|
125
|
+
offset: z.coerce.number().optional(),
|
|
126
|
+
})
|
|
127
|
+
.parse(args);
|
|
128
|
+
const result = await client.listProcedures({
|
|
129
|
+
teamSlug: parsed.project_slug,
|
|
130
|
+
search: parsed.search,
|
|
131
|
+
activeOnly: parsed.active_only,
|
|
132
|
+
limit: parsed.limit,
|
|
133
|
+
offset: parsed.offset,
|
|
134
|
+
});
|
|
135
|
+
return { content: [{ type: 'text', text: text(result) }] };
|
|
136
|
+
}
|
|
137
|
+
case 'get_procedure': {
|
|
138
|
+
const parsed = z
|
|
139
|
+
.object({
|
|
140
|
+
procedure_id: z.string(),
|
|
141
|
+
project_slug: z.string().optional(),
|
|
142
|
+
})
|
|
143
|
+
.parse(args);
|
|
144
|
+
const procedure = await client.getProcedure(parsed.procedure_id, parsed.project_slug);
|
|
145
|
+
if (!procedure)
|
|
146
|
+
return { content: [{ type: 'text', text: 'Procedure not found' }] };
|
|
147
|
+
return { content: [{ type: 'text', text: text(procedure) }] };
|
|
148
|
+
}
|
|
149
|
+
case 'create_procedure': {
|
|
150
|
+
const parsed = z
|
|
151
|
+
.object({
|
|
152
|
+
name: z.string(),
|
|
153
|
+
description: z.string().optional(),
|
|
154
|
+
definition: z.preprocess((v) => (typeof v === 'string' ? JSON.parse(v) : v), z.any().optional()),
|
|
155
|
+
tags: z.array(z.string()).optional(),
|
|
156
|
+
project_slug: z.string().optional(),
|
|
157
|
+
})
|
|
158
|
+
.parse(args);
|
|
159
|
+
const procedure = await client.createProcedure({
|
|
160
|
+
name: parsed.name,
|
|
161
|
+
description: parsed.description,
|
|
162
|
+
definition: parsed.definition,
|
|
163
|
+
tags: parsed.tags,
|
|
164
|
+
teamSlug: parsed.project_slug,
|
|
165
|
+
});
|
|
166
|
+
return {
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: 'text',
|
|
170
|
+
text: `Created procedure "${procedure.name}" (refId: ${procedure.refId})\n\n${text(procedure)}`,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
case 'update_procedure': {
|
|
176
|
+
const parsed = z
|
|
177
|
+
.object({
|
|
178
|
+
procedure_id: z.string(),
|
|
179
|
+
name: z.string().optional(),
|
|
180
|
+
description: z.string().nullable().optional(),
|
|
181
|
+
information: z.string().nullable().optional(),
|
|
182
|
+
definition: z.preprocess((v) => (typeof v === 'string' ? JSON.parse(v) : v), z.any().optional()),
|
|
183
|
+
is_active: z.preprocess((v) => (typeof v === 'string' ? v === 'true' : v), z.boolean().optional()),
|
|
184
|
+
tags: z.array(z.string()).optional(),
|
|
185
|
+
project_slug: z.string().optional(),
|
|
186
|
+
})
|
|
187
|
+
.parse(args);
|
|
188
|
+
const { procedure_id, project_slug, is_active, ...rest } = parsed;
|
|
189
|
+
const data = { ...rest };
|
|
190
|
+
if (is_active !== undefined)
|
|
191
|
+
data.isActive = is_active;
|
|
192
|
+
const procedure = await client.updateProcedure(procedure_id, data, project_slug);
|
|
193
|
+
return {
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: 'text',
|
|
197
|
+
text: `Updated procedure "${procedure.name}" (v${procedure.version})\n\n${text(procedure)}`,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
default:
|
|
203
|
+
return {
|
|
204
|
+
content: [{ type: 'text', text: `Unknown procedure tool: ${name}` }],
|
|
205
|
+
isError: true,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|