@workover/mcp 0.20.0 → 0.23.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/journeys.mjs ADDED
@@ -0,0 +1,409 @@
1
+ // Contacts journeys from a terminal (Contacts CRM step 5, WO-1752): `workover contacts journeys ...`
2
+ // and the MCP server's `workover_journeys_*` tools.
3
+ //
4
+ // THE SAME FILE ships in @workover/cli (apps/cli/journeys.mjs) and @workover/mcp
5
+ // (apps/mcp/journeys.mjs), because the two packages are published separately and neither may depend
6
+ // on the other. `apps/mcp/journeys.test.mjs` fails when the copies differ.
7
+ //
8
+ // A journey moves people through steps (waits and emails) after a trigger: they entered a segment,
9
+ // did an event, or an attribute of theirs changed. It exits when they leave the trigger segment (or
10
+ // match an exit condition) and converts on a goal within N days. A draft does nothing; publishing
11
+ // makes it live, `new_only` (only people who meet the trigger from now on) or `everyone_now` (a
12
+ // segment's members enter at once too). A live journey changes only its name: pause it first.
13
+ //
14
+ // Publishing starts email to real people, so it is two steps here: `publish` without `--yes` (and
15
+ // the MCP tool without `confirm: true`) answers the impact only ("N people are in the segment now;
16
+ // they will not enter"), and only the second call publishes. Workspace server keys cannot publish.
17
+ // Nothing sends anywhere until SES is live; locally email is captured to files.
18
+ //
19
+ // Every call goes to a route opened to tokens holding the `contacts` scope (`workover login
20
+ // --contacts`). Reading is any teammate's; changing is the owners' and admins'.
21
+
22
+ import { readFileSync } from 'node:fs';
23
+
24
+ import { apiError, resolveWorkspace } from './site-setup.mjs';
25
+
26
+ export const RUN_STATUSES = ['active', 'waiting', 'completed', 'exited', 'converted', 'failed'];
27
+ export const AT_PUBLISH = ['new_only', 'everyone_now'];
28
+
29
+ const base = (ws) => `/workspace/${encodeURIComponent(ws.id)}`;
30
+ const plural = (n, one, many) => `${Number(n ?? 0).toLocaleString('en-US')} ${n === 1 ? one : many}`;
31
+
32
+ /** The shape a journey file holds, for help texts and the MCP tools. */
33
+ export const JOURNEY_HELP =
34
+ 'A journey is JSON: {"name": "Welcome", "trigger": {"type": "segment", "segmentId": 12} | {"type": "event", "name": "order.completed", "where": [{"key": "total", "op": "gt", "value": 50}]} | {"type": "attribute", "key": "role", "change": "set" | "changed" | "to", "value": "member"}, "steps": [{"type": "wait", "minutes": 60}, {"type": "email", "fromAddressId": 3, "topicKey": "account", "subject": "Hi {{first_name|there}}", "body": "Plain text or simple Markdown"} (or "blocks": an email designed in blocks, in place of "body"; `workover email blocks` lists them)], "exit": {"leavesTriggerSegment": true, "when": <segment definition> | null}, "goal": {"type": "event", "name": "workspace.created", "withinDays": 7, "exit": true} | null, "entry": {"reentry": "never" | "after_days" | "always", "reentryDays": 30, "atPublish": "new_only" | "everyone_now"}}. Merge tags: {{first_name}}, {{last_name}}, {{name}}, {{email}}, {{external_id}}, {{attributes.<key>}}, each with an optional default after a bar.';
35
+
36
+ /** A journey file: JSON, the whole journey or the fields to change. */
37
+ export function journeyFromFile(path) {
38
+ let raw;
39
+ try {
40
+ raw = readFileSync(String(path), 'utf8');
41
+ } catch {
42
+ throw apiError(400, `Cannot read ${path}.`);
43
+ }
44
+ try {
45
+ const v = JSON.parse(raw);
46
+ if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('not an object');
47
+ return v;
48
+ } catch {
49
+ throw apiError(400, `${path} is not a JSON object. ${JOURNEY_HELP}`);
50
+ }
51
+ }
52
+
53
+ /** A journey by its id, or by its name (live and paused before archived). */
54
+ export async function resolveJourney(call, ws, ref) {
55
+ const r = String(ref ?? '').trim();
56
+ if (!r) throw apiError(400, 'Name the journey: its id or its name.');
57
+ if (/^\d+$/.test(r)) return Number(r);
58
+ const { journeys = [] } = await call(`${base(ws)}/journeys?archived=true`);
59
+ const hits = journeys.filter((j) => j.name.toLowerCase() === r.toLowerCase());
60
+ const open = hits.filter((j) => j.status !== 'archived');
61
+ const pick = open.length ? open : hits;
62
+ if (!pick.length) throw apiError(404, `There is no journey "${r}". \`workover contacts journeys\` lists them.`);
63
+ if (pick.length > 1) throw apiError(400, `"${r}" names ${pick.length} journeys; use its id: ${pick.map((j) => j.id).join(', ')}.`);
64
+ return pick[0].id;
65
+ }
66
+
67
+ // ── Calls ─────────────────────────────────────────────────────────────────────────────────────────
68
+
69
+ export async function listJourneys(call, { workspace, archived } = {}) {
70
+ const ws = await resolveWorkspace(call, workspace);
71
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys${archived ? '?archived=true' : ''}`)) };
72
+ }
73
+
74
+ export async function getJourney(call, { workspace, journey }) {
75
+ const ws = await resolveWorkspace(call, workspace);
76
+ const id = await resolveJourney(call, ws, journey);
77
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys/${id}`)) };
78
+ }
79
+
80
+ /** A new draft. Owners and admins. */
81
+ export async function createJourney(call, { workspace, body }) {
82
+ if (!body || typeof body !== 'object') throw apiError(400, `Give the journey (--file journey.json). ${JOURNEY_HELP}`);
83
+ const ws = await resolveWorkspace(call, workspace);
84
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys`, { method: 'POST', body })) };
85
+ }
86
+
87
+ /** Change any of name, trigger, steps, exit, goal and entry. Owners and admins. */
88
+ export async function updateJourney(call, { workspace, journey, body }) {
89
+ if (!body || typeof body !== 'object' || !Object.keys(body).length)
90
+ throw apiError(400, 'Give what to change: --name, or --file with the fields.');
91
+ const ws = await resolveWorkspace(call, workspace);
92
+ const id = await resolveJourney(call, ws, journey);
93
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys/${id}`, { method: 'PATCH', body })) };
94
+ }
95
+
96
+ /**
97
+ * Publish: without `confirm`, only the impact (who matches now, who enters, what blocks it); with it,
98
+ * the journey goes live. Owners and admins.
99
+ */
100
+ export async function publishJourney(call, { workspace, journey, everyoneNow, atPublish, confirm }) {
101
+ const ws = await resolveWorkspace(call, workspace);
102
+ const id = await resolveJourney(call, ws, journey);
103
+ const at = everyoneNow ? 'everyone_now' : atPublish;
104
+ if (at !== undefined && !AT_PUBLISH.includes(at)) throw apiError(400, `atPublish is ${AT_PUBLISH.join(' or ')}.`);
105
+ const body = at ? { atPublish: at } : {};
106
+ if (!confirm)
107
+ return {
108
+ workspace: ws,
109
+ published: false,
110
+ ...(await call(`${base(ws)}/journeys/${id}/publish/preview`, { method: 'POST', body })),
111
+ };
112
+ return { workspace: ws, published: true, ...(await call(`${base(ws)}/journeys/${id}/publish`, { method: 'POST', body })) };
113
+ }
114
+
115
+ /** pause | resume | archive. Owners and admins. */
116
+ export async function setJourneyState(call, { workspace, journey, action }) {
117
+ if (!['pause', 'resume', 'archive'].includes(action)) throw apiError(400, 'pause, resume or archive.');
118
+ const ws = await resolveWorkspace(call, workspace);
119
+ const id = await resolveJourney(call, ws, journey);
120
+ return { workspace: ws, action, ...(await call(`${base(ws)}/journeys/${id}/${action}`, { method: 'POST', body: {} })) };
121
+ }
122
+
123
+ /** Send one email step to yourself, filled for a contact (or sample values). Owners and admins. */
124
+ export async function testJourney(call, { workspace, journey, step, contact }) {
125
+ const ws = await resolveWorkspace(call, workspace);
126
+ const id = await resolveJourney(call, ws, journey);
127
+ const body = {};
128
+ if (step !== undefined && step !== null && step !== '') {
129
+ const n = Number(step);
130
+ if (!Number.isInteger(n) || n < 1) throw apiError(400, '--step is the step’s number in the journey, 1 for the first.');
131
+ body.step = n;
132
+ }
133
+ if (contact) body.contact = String(contact);
134
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys/${id}/test`, { method: 'POST', body })) };
135
+ }
136
+
137
+ export async function journeyReport(call, { workspace, journey }) {
138
+ const ws = await resolveWorkspace(call, workspace);
139
+ const id = await resolveJourney(call, ws, journey);
140
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys/${id}/report`)) };
141
+ }
142
+
143
+ export async function journeyRuns(call, { workspace, journey, status, offset, limit }) {
144
+ if (status && !RUN_STATUSES.includes(status)) throw apiError(400, `--status is one of ${RUN_STATUSES.join(', ')}.`);
145
+ const ws = await resolveWorkspace(call, workspace);
146
+ const id = await resolveJourney(call, ws, journey);
147
+ const qs = new URLSearchParams();
148
+ if (status) qs.set('status', status);
149
+ if (offset) qs.set('offset', String(offset));
150
+ if (limit) qs.set('limit', String(limit));
151
+ return { workspace: ws, ...(await call(`${base(ws)}/journeys/${id}/runs${qs.size ? `?${qs}` : ''}`)) };
152
+ }
153
+
154
+ // ── Rendering ─────────────────────────────────────────────────────────────────────────────────────
155
+
156
+ export function renderJourneyLine(j) {
157
+ const counts = j.entered !== undefined ? ` ${plural(j.entered, 'entered', 'entered')}, ${plural(j.converted ?? 0, 'converted', 'converted')}` : '';
158
+ return ` ${j.id} ${j.name} [${j.status}] ${j.summary}${counts}`;
159
+ }
160
+
161
+ const mailerNote = (m) => (m?.note ? ['', ` ${m.note}`] : []);
162
+
163
+ export function renderJourneys(res) {
164
+ const list = res.journeys ?? [];
165
+ const out = [''];
166
+ if (!list.length) out.push(' No journeys yet. `workover contacts journeys create --file journey.json` makes one.');
167
+ else out.push(` Journeys (${list.length}):`, ...list.map(renderJourneyLine));
168
+ if (res.canManage === false) out.push('', ' Only workspace owners and admins change journeys.');
169
+ out.push(...mailerNote(res.mailer), '');
170
+ return out;
171
+ }
172
+
173
+ const minutesText = (m) =>
174
+ m % 1440 === 0 ? plural(m / 1440, 'day', 'days') : m % 60 === 0 ? plural(m / 60, 'hour', 'hours') : plural(m, 'minute', 'minutes');
175
+
176
+ export function renderJourney(res) {
177
+ const j = res.journey;
178
+ const out = ['', ` ${j.id} ${j.name} [${j.status}]`, ` Trigger: ${j.summary}`];
179
+ (j.steps ?? []).forEach((s, i) => {
180
+ if (s.type === 'wait') out.push(` ${i + 1}. Wait ${minutesText(s.minutes)}`);
181
+ else
182
+ out.push(
183
+ ` ${i + 1}. Email "${s.subject || 'no subject yet'}" topic ${s.topicKey ?? '-'}, from address ${s.fromAddressId ?? '-'}`,
184
+ );
185
+ });
186
+ if (!(j.steps ?? []).length) out.push(' No steps yet.');
187
+ const exit = [j.exit?.leavesTriggerSegment ? 'leaves the trigger segment' : null, j.exit?.when ? 'matches the exit condition' : null].filter(Boolean);
188
+ out.push(` Exit: ${exit.length ? exit.join(', or ') : 'only at the end'}`);
189
+ out.push(` Goal: ${j.goal ? `${j.goal.type === 'event' ? `does ${j.goal.name}` : `enters segment ${j.goal.segmentId}`} within ${plural(j.goal.withinDays, 'day', 'days')}${j.goal.exit ? ', then leaves' : ''}` : 'none'}`);
190
+ const re = j.entry?.reentry === 'after_days' ? `again after ${plural(j.entry.reentryDays, 'day', 'days')}` : j.entry?.reentry === 'always' ? 'every time' : 'once';
191
+ out.push(` Entry: ${re}; at publish, ${j.entry?.atPublish === 'everyone_now' ? 'everyone who matches enters' : 'only new matches enter'}`);
192
+ for (const p of j.problems ?? []) out.push(` ! ${p}`);
193
+ for (const w of j.warnings ?? []) out.push(` ~ ${w}`);
194
+ out.push(...mailerNote(res.mailer), '');
195
+ return out;
196
+ }
197
+
198
+ export function renderJourneySaved(res) {
199
+ return ['', ` ✓ ${res.created ? 'Created' : 'Saved'} (a draft does nothing until it is published).`, ...renderJourney(res).slice(1)];
200
+ }
201
+
202
+ export function renderPublish(res) {
203
+ const out = [''];
204
+ if (!res.published) {
205
+ out.push(` ${res.impact?.sentence ?? ''}`);
206
+ for (const p of res.problems ?? []) out.push(` ! ${p}`);
207
+ out.push(...mailerNote(res.mailer));
208
+ out.push(
209
+ '',
210
+ res.canPublish
211
+ ? ' Nothing is published yet. Run it again with --yes to publish.'
212
+ : ' It cannot be published yet.',
213
+ '',
214
+ );
215
+ return out;
216
+ }
217
+ out.push(` ✓ ${res.journey?.name ?? 'Journey'} is live. ${res.impact?.sentence ?? ''}`);
218
+ if (res.enrolled) out.push(` ${plural(res.enrolled, 'person entered', 'people entered')} now.`);
219
+ out.push('');
220
+ return out;
221
+ }
222
+
223
+ export function renderJourneyState(res) {
224
+ const verb = { pause: 'Paused', resume: 'Live again', archive: 'Archived' }[res.action] ?? 'Saved';
225
+ const out = ['', ` ✓ ${res.changed === false ? 'Already so' : verb}: ${res.journey?.name ?? ''}`];
226
+ if (res.exited) out.push(` ${plural(res.exited, 'person left', 'people left')} it.`);
227
+ out.push('');
228
+ return out;
229
+ }
230
+
231
+ export function renderTest(res) {
232
+ return [
233
+ '',
234
+ ` ✓ Test sent to ${res.to}${res.captured ? ' (captured, not delivered)' : ''}${res.sample ? ', with sample values' : ''}.`,
235
+ ` From: ${res.from}`,
236
+ ` Subject: ${res.subject}`,
237
+ ...(res.capturePath ? [` File: ${res.capturePath}`] : []),
238
+ '',
239
+ ...String(res.text ?? '')
240
+ .split('\n')
241
+ .map((l) => ` ${l}`),
242
+ '',
243
+ ];
244
+ }
245
+
246
+ export function renderReport(res) {
247
+ const t = res.totals ?? {};
248
+ const out = [
249
+ '',
250
+ ` ${res.journey?.name ?? 'Journey'} [${res.journey?.status}]`,
251
+ ` ${plural(t.entered, 'entered', 'entered')}, ${t.inJourney ?? 0} in it now, ${t.completed ?? 0} completed, ${t.exited ?? 0} exited, ${t.converted ?? 0} converted${t.conversionRate === null || t.conversionRate === undefined ? '' : ` (${t.conversionRate}%)`}${t.failed ? `, ${t.failed} failed` : ''}`,
252
+ ];
253
+ (res.steps ?? []).forEach((s, i) => {
254
+ const skipped = Object.entries(s.skipped ?? {})
255
+ .map(([k, n]) => `${k} ${n}`)
256
+ .join(', ');
257
+ out.push(
258
+ ` ${i + 1}. ${s.summary}: reached ${s.reached}, waiting ${s.waitingNow}${s.type === 'email' ? `, sent ${s.sent}${skipped ? `, skipped (${skipped})` : ''}${s.failed ? `, failed ${s.failed}` : ''}` : ''}${s.exited ? `, exited ${s.exited}` : ''}`,
259
+ );
260
+ });
261
+ out.push('');
262
+ return out;
263
+ }
264
+
265
+ export function renderRuns(res) {
266
+ const out = ['', ` People (${res.total ?? 0}):`];
267
+ for (const r of res.runs ?? []) {
268
+ const who = r.contact?.email ?? r.contact?.name ?? `contact ${r.contact?.id}`;
269
+ out.push(
270
+ ` ${who} ${r.status} step ${r.currentStep + 1} entered ${r.enteredAt}${r.nextAt ? ` next ${r.nextAt}` : ''}${r.reason ? ` (${r.reason})` : ''}${r.convertedAt ? ' converted' : ''}`,
271
+ );
272
+ }
273
+ if (!(res.runs ?? []).length) out.push(' Nobody yet.');
274
+ if (res.nextOffset !== null && res.nextOffset !== undefined) out.push('', ` More: --offset ${res.nextOffset}`);
275
+ out.push('');
276
+ return out;
277
+ }
278
+
279
+ // ── MCP ───────────────────────────────────────────────────────────────────────────────────────────
280
+
281
+ const WORKSPACE = { type: 'string', description: 'The workspace, by slug or id. Needed only when the account has more than one.' };
282
+ const JOURNEY = { type: 'string', description: 'The journey: its id, or its name.' };
283
+ const SCOPE =
284
+ ' Needs a token from `workover login --contacts`; without it this returns a permission error naming that command.';
285
+
286
+ export const JOURNEYS_TOOL_DEFS = [
287
+ {
288
+ name: 'workover_journeys_list',
289
+ description: "The workspace's journeys: status, trigger, how many entered and converted, and whether email can be sent here at all." + SCOPE,
290
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, archived: { type: 'boolean' } } },
291
+ },
292
+ {
293
+ name: 'workover_journeys_get',
294
+ description: 'One journey: trigger, steps, exit, goal, entry settings, and what still stops it going live.' + SCOPE,
295
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, journey: JOURNEY }, required: ['journey'] },
296
+ },
297
+ {
298
+ name: 'workover_journeys_create',
299
+ description: 'Create a DRAFT journey (nothing runs until it is published). ' + JOURNEY_HELP + ' Owners and admins.' + SCOPE,
300
+ inputSchema: {
301
+ type: 'object',
302
+ properties: { workspace: WORKSPACE, journey: { type: 'object', description: 'The journey as JSON.' } },
303
+ required: ['journey'],
304
+ },
305
+ },
306
+ {
307
+ name: 'workover_journeys_update',
308
+ description:
309
+ 'Change a journey: any of name, trigger, steps (keep a step’s id to keep it), exit, goal, entry. A live journey changes only its name; pause it first. Owners and admins.' +
310
+ SCOPE,
311
+ inputSchema: {
312
+ type: 'object',
313
+ properties: { workspace: WORKSPACE, journey: JOURNEY, changes: { type: 'object' } },
314
+ required: ['journey', 'changes'],
315
+ },
316
+ },
317
+ {
318
+ name: 'workover_journeys_publish',
319
+ description:
320
+ 'Publish a draft journey, which starts email to real people. ALWAYS call it first WITHOUT confirm: that answers the impact only (how many match now and whether they enter) and changes nothing. Show the person that sentence, and call again with confirm: true only after they say yes. atPublish: new_only (only people who meet the trigger from now on) or everyone_now (those who match now enter too). Owners and admins.' +
321
+ SCOPE,
322
+ inputSchema: {
323
+ type: 'object',
324
+ properties: {
325
+ workspace: WORKSPACE,
326
+ journey: JOURNEY,
327
+ atPublish: { type: 'string', enum: AT_PUBLISH },
328
+ confirm: { type: 'boolean', description: 'true publishes; anything else only answers the impact.' },
329
+ },
330
+ required: ['journey'],
331
+ },
332
+ },
333
+ {
334
+ name: 'workover_journeys_pause',
335
+ description: 'Pause a live journey: everyone is held where they are and nobody new enters. Owners and admins.' + SCOPE,
336
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, journey: JOURNEY }, required: ['journey'] },
337
+ },
338
+ {
339
+ name: 'workover_journeys_resume',
340
+ description: 'Resume a paused journey: held people move on, and people who meet the trigger from now on enter. Owners and admins.' + SCOPE,
341
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, journey: JOURNEY }, required: ['journey'] },
342
+ },
343
+ {
344
+ name: 'workover_journeys_archive',
345
+ description: 'Archive a journey: everyone still in it leaves, and it is hidden. Cannot be undone; ask first. Owners and admins.' + SCOPE,
346
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, journey: JOURNEY }, required: ['journey'] },
347
+ },
348
+ {
349
+ name: 'workover_journeys_test',
350
+ description:
351
+ 'Send one email step to the signed-in person, filled for a contact (id, email or x:<external id>) or sample values, with [Test] in the subject. Answers what was sent. Owners and admins.' +
352
+ SCOPE,
353
+ inputSchema: {
354
+ type: 'object',
355
+ properties: {
356
+ workspace: WORKSPACE,
357
+ journey: JOURNEY,
358
+ step: { type: 'number', description: 'The step’s number, 1 for the first; the first email when left out.' },
359
+ contact: { type: 'string' },
360
+ },
361
+ required: ['journey'],
362
+ },
363
+ },
364
+ {
365
+ name: 'workover_journeys_report',
366
+ description: 'A journey’s report: entered, in it now, completed, exited, converted and the conversion rate, and per step reached, waiting, sent and skipped by reason.' + SCOPE,
367
+ inputSchema: { type: 'object', properties: { workspace: WORKSPACE, journey: JOURNEY }, required: ['journey'] },
368
+ },
369
+ {
370
+ name: 'workover_journeys_runs',
371
+ description: 'The people in a journey, newest first: status, step, next move and why they left.' + SCOPE,
372
+ inputSchema: {
373
+ type: 'object',
374
+ properties: {
375
+ workspace: WORKSPACE,
376
+ journey: JOURNEY,
377
+ status: { type: 'string', enum: RUN_STATUSES },
378
+ offset: { type: 'number' },
379
+ limit: { type: 'number', description: 'Up to 200.' },
380
+ },
381
+ required: ['journey'],
382
+ },
383
+ },
384
+ ];
385
+
386
+ export const JOURNEYS_TOOLS = new Set(JOURNEYS_TOOL_DEFS.map((t) => t.name));
387
+
388
+ /** One journeys tool, run: the lines to answer with. Throws as `call` does. */
389
+ export async function runJourneysTool(call, name, args = {}) {
390
+ const workspace = args.workspace === undefined || args.workspace === null ? undefined : String(args.workspace);
391
+ const journey = args.journey;
392
+ if (name === 'workover_journeys_list') return renderJourneys(await listJourneys(call, { workspace, archived: args.archived === true }));
393
+ if (name === 'workover_journeys_get') return renderJourney(await getJourney(call, { workspace, journey }));
394
+ if (name === 'workover_journeys_create') return renderJourneySaved(await createJourney(call, { workspace, body: args.journey }));
395
+ if (name === 'workover_journeys_update')
396
+ return renderJourneySaved(await updateJourney(call, { workspace, journey, body: args.changes }));
397
+ if (name === 'workover_journeys_publish')
398
+ return renderPublish(await publishJourney(call, { workspace, journey, atPublish: args.atPublish, confirm: args.confirm === true }));
399
+ if (name === 'workover_journeys_pause' || name === 'workover_journeys_resume' || name === 'workover_journeys_archive')
400
+ return renderJourneyState(await setJourneyState(call, { workspace, journey, action: name.replace('workover_journeys_', '') }));
401
+ if (name === 'workover_journeys_test')
402
+ return renderTest(await testJourney(call, { workspace, journey, step: args.step, contact: args.contact }));
403
+ if (name === 'workover_journeys_report') return renderReport(await journeyReport(call, { workspace, journey }));
404
+ if (name === 'workover_journeys_runs')
405
+ return renderRuns(
406
+ await journeyRuns(call, { workspace, journey, status: args.status, offset: args.offset, limit: args.limit }),
407
+ );
408
+ throw apiError(400, `Unknown tool: ${name}`);
409
+ }