wolfpack-mcp 1.0.99 → 1.0.101
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/agentObserveTools.js +157 -0
- package/dist/agentObserveTools.test.js +99 -0
- package/dist/agentSelfTools.js +6 -2
- package/dist/client.js +45 -4
- package/dist/index.js +15 -1740
- package/dist/procedureTools.js +4 -268
- package/dist/toolCatalogue.js +2156 -0
- package/dist/toolCatalogue.test.js +96 -0
- package/package.json +1 -1
package/dist/procedureTools.js
CHANGED
|
@@ -1,274 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Procedure MCP tool definitions
|
|
3
|
-
*
|
|
2
|
+
* Procedure MCP tool handlers. The tool definitions are declared once, for both
|
|
3
|
+
* transports, in `toolCatalogue.ts`.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
const FORM_FIELD_ITEM_SCHEMA = {
|
|
7
|
-
type: 'object',
|
|
8
|
-
properties: {
|
|
9
|
-
name: { type: 'string' },
|
|
10
|
-
label: { type: 'string' },
|
|
11
|
-
type: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
enum: ['text', 'number', 'boolean', 'choice', 'date', 'json'],
|
|
14
|
-
},
|
|
15
|
-
required: { type: 'boolean' },
|
|
16
|
-
options: {
|
|
17
|
-
type: 'array',
|
|
18
|
-
items: {
|
|
19
|
-
type: 'object',
|
|
20
|
-
properties: {
|
|
21
|
-
value: { type: 'string' },
|
|
22
|
-
label: { type: 'string' },
|
|
23
|
-
},
|
|
24
|
-
required: ['value', 'label'],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
multiline: { type: 'boolean' },
|
|
28
|
-
},
|
|
29
|
-
required: ['name', 'label', 'type', 'required'],
|
|
30
|
-
};
|
|
31
|
-
const DEFINITION_DESCRIPTION = 'Workflow definition: { nodes: [{id, type, position: {x, y}, data: {...}}], edges: [{id, source, target}] }. ' +
|
|
32
|
-
'An activity node needs data.activityType (task, createWorkItem, sendNotification, httpRequest, createCase, ' +
|
|
33
|
-
'setVariable, createPage, createJournalEntry, llmPrompt, jsonata, agentTask, runContainer), data.label, and ' +
|
|
34
|
-
"data.config holding that type's settings — the step body belongs in data.config.description, not data.description. " +
|
|
35
|
-
'Use activityType "task" for a step a person just reads and ticks off.';
|
|
36
|
-
export const PROCEDURE_TOOLS = [
|
|
37
|
-
{
|
|
38
|
-
name: 'list_procedures',
|
|
39
|
-
description: 'List procedures in a project. Returns name, status, version, tags, case count, and hasForm ' +
|
|
40
|
-
'(true when the procedure declares an input form that must be provided at start_case time). ' +
|
|
41
|
-
'Use get_procedure to see the full workflow definition and form schema.',
|
|
42
|
-
inputSchema: {
|
|
43
|
-
type: 'object',
|
|
44
|
-
properties: {
|
|
45
|
-
project_slug: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Project slug (required for multi-project users)',
|
|
48
|
-
},
|
|
49
|
-
search: { type: 'string', description: 'Search in name and description' },
|
|
50
|
-
active_only: { type: 'boolean', description: 'Only return active procedures' },
|
|
51
|
-
limit: { type: 'number', description: 'Maximum procedures to return' },
|
|
52
|
-
offset: { type: 'number', description: 'Procedures to skip for pagination' },
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'get_procedure',
|
|
58
|
-
description: 'Get full details of a procedure including its workflow definition (nodes and edges) and its ' +
|
|
59
|
-
'optional input form (formDefinition). The definition uses a graph format: nodes have id, type ' +
|
|
60
|
-
'(start/end/activity/decision/loop/parallel/wait), position, and data; edges connect nodes via ' +
|
|
61
|
-
'source/target IDs. The formDefinition lists input fields (name, label, type, required, options, ' +
|
|
62
|
-
'multiline) validated at start_case time — inspect it before calling start_case so you know which ' +
|
|
63
|
-
'form_values to supply. Accepts UUID or refId (requires project_slug for refId).',
|
|
64
|
-
inputSchema: {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: {
|
|
67
|
-
procedure_id: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
description: 'Procedure UUID or refId number',
|
|
70
|
-
},
|
|
71
|
-
project_slug: {
|
|
72
|
-
type: 'string',
|
|
73
|
-
description: 'Project slug (required when using refId)',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
required: ['procedure_id'],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'create_procedure',
|
|
81
|
-
description: 'Create a new procedure. If no definition is provided, creates a default start→end workflow. ' +
|
|
82
|
-
'The definition is a graph with nodes and edges. Node types: start, end, activity, decision, loop, parallel, wait. ' +
|
|
83
|
-
'Each node needs id, type, position ({x, y}), and data (type-specific config). ' +
|
|
84
|
-
'Edges connect nodes: {id, source, target}. Optionally provide form_definition to declare inputs ' +
|
|
85
|
-
'collected each time the procedure is started. The procedure starts as inactive (isActive=false).',
|
|
86
|
-
inputSchema: {
|
|
87
|
-
type: 'object',
|
|
88
|
-
properties: {
|
|
89
|
-
name: { type: 'string', description: 'Procedure name (unique per project)' },
|
|
90
|
-
description: { type: 'string', description: 'Short description' },
|
|
91
|
-
definition: {
|
|
92
|
-
type: 'object',
|
|
93
|
-
description: DEFINITION_DESCRIPTION,
|
|
94
|
-
},
|
|
95
|
-
form_definition: {
|
|
96
|
-
type: ['array', 'null'],
|
|
97
|
-
description: 'Input form: array of {name, label, type, required, options?, multiline?}. Types: text, number, boolean, choice, date, json. Required fields must be supplied when start_case runs. Scheduled runs ignore the form.',
|
|
98
|
-
items: FORM_FIELD_ITEM_SCHEMA,
|
|
99
|
-
},
|
|
100
|
-
tags: {
|
|
101
|
-
type: 'array',
|
|
102
|
-
items: { type: 'string' },
|
|
103
|
-
description: 'Tags for categorization',
|
|
104
|
-
},
|
|
105
|
-
project_slug: {
|
|
106
|
-
type: 'string',
|
|
107
|
-
description: 'Project slug (required for multi-project users)',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
required: ['name'],
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: 'update_procedure',
|
|
115
|
-
description: 'Update a procedure. Only provide the fields you want to change. ' +
|
|
116
|
-
'Updating the definition auto-increments the version number. ' +
|
|
117
|
-
'Set isActive to true/false to activate/deactivate the procedure. ' +
|
|
118
|
-
'Pass form_definition to replace the input form (or null to remove it). ' +
|
|
119
|
-
'Accepts UUID or refId (requires project_slug for refId).',
|
|
120
|
-
inputSchema: {
|
|
121
|
-
type: 'object',
|
|
122
|
-
properties: {
|
|
123
|
-
procedure_id: {
|
|
124
|
-
type: 'string',
|
|
125
|
-
description: 'Procedure UUID or refId number',
|
|
126
|
-
},
|
|
127
|
-
name: { type: 'string', description: 'Updated name' },
|
|
128
|
-
description: {
|
|
129
|
-
type: ['string', 'null'],
|
|
130
|
-
description: 'Updated description (null to clear)',
|
|
131
|
-
},
|
|
132
|
-
information: {
|
|
133
|
-
type: ['string', 'null'],
|
|
134
|
-
description: 'Extended documentation/guide (null to clear)',
|
|
135
|
-
},
|
|
136
|
-
definition: {
|
|
137
|
-
type: 'object',
|
|
138
|
-
description: `Updated definition — changes increment version. ${DEFINITION_DESCRIPTION}`,
|
|
139
|
-
},
|
|
140
|
-
form_definition: {
|
|
141
|
-
type: ['array', 'null'],
|
|
142
|
-
description: 'Replace the input form. Same shape as create_procedure.form_definition. Pass null to remove the form entirely.',
|
|
143
|
-
items: FORM_FIELD_ITEM_SCHEMA,
|
|
144
|
-
},
|
|
145
|
-
is_active: { type: 'boolean', description: 'Activate or deactivate the procedure' },
|
|
146
|
-
tags: {
|
|
147
|
-
type: 'array',
|
|
148
|
-
items: { type: 'string' },
|
|
149
|
-
description: 'Updated tags (replaces existing)',
|
|
150
|
-
},
|
|
151
|
-
project_slug: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
description: 'Project slug (required when using refId)',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
required: ['procedure_id'],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: 'start_case',
|
|
161
|
-
description: 'Start a new case by running an active procedure. If the procedure has a form_definition ' +
|
|
162
|
-
'(see get_procedure), supply form_values: an object keyed by each field.name. Required fields ' +
|
|
163
|
-
'must be present; values are type-checked and unknown keys are dropped server-side. Returns the ' +
|
|
164
|
-
'caseId and refId of the new case. Scheduled procedures cannot be started this way — they fire ' +
|
|
165
|
-
'on their schedule.',
|
|
166
|
-
inputSchema: {
|
|
167
|
-
type: 'object',
|
|
168
|
-
properties: {
|
|
169
|
-
procedure_id: {
|
|
170
|
-
type: 'string',
|
|
171
|
-
description: 'Procedure UUID or refId number',
|
|
172
|
-
},
|
|
173
|
-
title: {
|
|
174
|
-
type: 'string',
|
|
175
|
-
description: 'Case title (defaults to the procedure name)',
|
|
176
|
-
},
|
|
177
|
-
priority: {
|
|
178
|
-
type: 'number',
|
|
179
|
-
description: 'Priority: 0 (none), 1 (low), 2 (medium), 3 (high), 4 (urgent)',
|
|
180
|
-
},
|
|
181
|
-
additional_information: {
|
|
182
|
-
type: 'string',
|
|
183
|
-
description: 'Free-text context displayed on the case detail page',
|
|
184
|
-
},
|
|
185
|
-
form_values: {
|
|
186
|
-
type: 'object',
|
|
187
|
-
description: "Input values keyed by field name, matching the procedure's form_definition. Validated server-side: missing required fields → 400; wrong types → 400; unknown keys silently dropped.",
|
|
188
|
-
additionalProperties: true,
|
|
189
|
-
},
|
|
190
|
-
project_slug: {
|
|
191
|
-
type: 'string',
|
|
192
|
-
description: 'Project slug (required when using refId)',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
required: ['procedure_id'],
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'list_cases',
|
|
200
|
-
description: 'List cases, newest first, optionally filtered to one procedure and/or one status ' +
|
|
201
|
-
'(running, paused, completed, failed, cancelled). Each case shows the procedure version it ' +
|
|
202
|
-
'runs and `behind: true` when the procedure has since been edited — a running case that is ' +
|
|
203
|
-
'behind can be moved on with upgrade_case.',
|
|
204
|
-
inputSchema: {
|
|
205
|
-
type: 'object',
|
|
206
|
-
properties: {
|
|
207
|
-
procedure_id: {
|
|
208
|
-
type: 'string',
|
|
209
|
-
description: 'Only cases of this procedure (UUID or refId number)',
|
|
210
|
-
},
|
|
211
|
-
status: {
|
|
212
|
-
type: 'string',
|
|
213
|
-
description: 'Only cases in this status, e.g. "running"',
|
|
214
|
-
},
|
|
215
|
-
project_slug: {
|
|
216
|
-
type: 'string',
|
|
217
|
-
description: 'Project slug (required when using a refId, or with access to several projects)',
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: 'upgrade_case',
|
|
224
|
-
description: 'Move a running (or paused) case onto the latest version of its procedure. The case resumes ' +
|
|
225
|
-
'at the node it is waiting at, keeping its variables and earlier activity outputs; nothing ' +
|
|
226
|
-
'before that node runs again. Refused — with the reason — when the case is not running, is ' +
|
|
227
|
-
'already on the current version, or its current node id is not in the new version — then pass ' +
|
|
228
|
-
'resume_node_id to choose the node of the new version it should continue from (see ' +
|
|
229
|
-
'get_procedure for the node ids), or cancel the case and start the procedure again from the ' +
|
|
230
|
-
'work item.',
|
|
231
|
-
inputSchema: {
|
|
232
|
-
type: 'object',
|
|
233
|
-
properties: {
|
|
234
|
-
case_id: {
|
|
235
|
-
type: 'string',
|
|
236
|
-
description: 'Case UUID or refId number',
|
|
237
|
-
},
|
|
238
|
-
resume_node_id: {
|
|
239
|
-
type: 'string',
|
|
240
|
-
description: 'Node id of the new version to resume at. Defaults to the node the case is waiting at; ' +
|
|
241
|
-
'required when that node no longer exists in the new version.',
|
|
242
|
-
},
|
|
243
|
-
project_slug: {
|
|
244
|
-
type: 'string',
|
|
245
|
-
description: 'Project slug (required when using refId)',
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
required: ['case_id'],
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: 'upgrade_procedure_cases',
|
|
253
|
-
description: 'Upgrade every running case of a procedure that is still on an older version onto the ' +
|
|
254
|
-
'current one (see upgrade_case). Cases are upgraded one at a time; the result lists the cases ' +
|
|
255
|
-
'upgraded and, for each case skipped, why.',
|
|
256
|
-
inputSchema: {
|
|
257
|
-
type: 'object',
|
|
258
|
-
properties: {
|
|
259
|
-
procedure_id: {
|
|
260
|
-
type: 'string',
|
|
261
|
-
description: 'Procedure UUID or refId number',
|
|
262
|
-
},
|
|
263
|
-
project_slug: {
|
|
264
|
-
type: 'string',
|
|
265
|
-
description: 'Project slug (required when using refId)',
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
required: ['procedure_id'],
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
];
|
|
272
6
|
export async function handleProcedureTool(name, args, client) {
|
|
273
7
|
const text = (t) => JSON.stringify(t, null, 2);
|
|
274
8
|
switch (name) {
|
|
@@ -369,6 +103,7 @@ export async function handleProcedureTool(name, args, client) {
|
|
|
369
103
|
priority: z.coerce.number().optional(),
|
|
370
104
|
additional_information: z.string().optional(),
|
|
371
105
|
form_values: z.preprocess((v) => (typeof v === 'string' ? JSON.parse(v) : v), z.record(z.unknown()).optional()),
|
|
106
|
+
work_item_id: z.string().optional(),
|
|
372
107
|
project_slug: z.string().optional(),
|
|
373
108
|
})
|
|
374
109
|
.parse(args);
|
|
@@ -377,6 +112,7 @@ export async function handleProcedureTool(name, args, client) {
|
|
|
377
112
|
priority: parsed.priority,
|
|
378
113
|
additionalInformation: parsed.additional_information,
|
|
379
114
|
formValues: parsed.form_values,
|
|
115
|
+
workItemId: parsed.work_item_id,
|
|
380
116
|
teamSlug: parsed.project_slug,
|
|
381
117
|
});
|
|
382
118
|
return {
|