@roarkanalytics/sdk-mcp 5.16.0 → 5.19.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client-headers.d.mts +2 -2
  3. package/client-headers.d.ts +2 -2
  4. package/client-headers.js +1 -1
  5. package/client-headers.mjs +1 -1
  6. package/code-tool-worker.d.mts.map +1 -1
  7. package/code-tool-worker.d.ts.map +1 -1
  8. package/code-tool-worker.js +8 -0
  9. package/code-tool-worker.js.map +1 -1
  10. package/code-tool-worker.mjs +8 -0
  11. package/code-tool-worker.mjs.map +1 -1
  12. package/directory-output-schemas.d.mts +139 -0
  13. package/directory-output-schemas.d.mts.map +1 -0
  14. package/directory-output-schemas.d.ts +139 -0
  15. package/directory-output-schemas.d.ts.map +1 -0
  16. package/directory-output-schemas.js +251 -0
  17. package/directory-output-schemas.js.map +1 -0
  18. package/directory-output-schemas.mjs +248 -0
  19. package/directory-output-schemas.mjs.map +1 -0
  20. package/directory-tools.d.mts +2 -0
  21. package/directory-tools.d.mts.map +1 -1
  22. package/directory-tools.d.ts +2 -0
  23. package/directory-tools.d.ts.map +1 -1
  24. package/directory-tools.js +282 -109
  25. package/directory-tools.js.map +1 -1
  26. package/directory-tools.mjs +281 -108
  27. package/directory-tools.mjs.map +1 -1
  28. package/docs-search-tool.d.mts +10 -3
  29. package/docs-search-tool.d.mts.map +1 -1
  30. package/docs-search-tool.d.ts +10 -3
  31. package/docs-search-tool.d.ts.map +1 -1
  32. package/docs-search-tool.js +36 -6
  33. package/docs-search-tool.js.map +1 -1
  34. package/docs-search-tool.mjs +34 -5
  35. package/docs-search-tool.mjs.map +1 -1
  36. package/http.d.mts.map +1 -1
  37. package/http.d.ts.map +1 -1
  38. package/http.js +8 -7
  39. package/http.js.map +1 -1
  40. package/http.mjs +9 -8
  41. package/http.mjs.map +1 -1
  42. package/local-docs-search.d.mts.map +1 -1
  43. package/local-docs-search.d.ts.map +1 -1
  44. package/local-docs-search.js +220 -8
  45. package/local-docs-search.js.map +1 -1
  46. package/local-docs-search.mjs +220 -8
  47. package/local-docs-search.mjs.map +1 -1
  48. package/methods.d.mts.map +1 -1
  49. package/methods.d.ts.map +1 -1
  50. package/methods.js +48 -0
  51. package/methods.js.map +1 -1
  52. package/methods.mjs +48 -0
  53. package/methods.mjs.map +1 -1
  54. package/oauth.d.mts +16 -1
  55. package/oauth.d.mts.map +1 -1
  56. package/oauth.d.ts +16 -1
  57. package/oauth.d.ts.map +1 -1
  58. package/oauth.js +24 -1
  59. package/oauth.js.map +1 -1
  60. package/oauth.mjs +22 -0
  61. package/oauth.mjs.map +1 -1
  62. package/options.d.mts +10 -0
  63. package/options.d.mts.map +1 -1
  64. package/options.d.ts +10 -0
  65. package/options.d.ts.map +1 -1
  66. package/options.js +29 -3
  67. package/options.js.map +1 -1
  68. package/options.mjs +27 -3
  69. package/options.mjs.map +1 -1
  70. package/package.json +12 -2
  71. package/server.d.mts.map +1 -1
  72. package/server.d.ts.map +1 -1
  73. package/server.js +8 -1
  74. package/server.js.map +1 -1
  75. package/server.mjs +8 -1
  76. package/server.mjs.map +1 -1
  77. package/src/client-headers.ts +1 -1
  78. package/src/code-tool-worker.ts +8 -0
  79. package/src/directory-output-schemas.ts +318 -0
  80. package/src/directory-tools.ts +322 -93
  81. package/src/docs-search-tool.ts +42 -6
  82. package/src/http.ts +9 -7
  83. package/src/local-docs-search.ts +261 -8
  84. package/src/methods.ts +48 -0
  85. package/src/oauth.ts +28 -1
  86. package/src/options.ts +30 -3
  87. package/src/server.ts +9 -1
  88. package/src/types.ts +1 -0
  89. package/types.d.mts +1 -0
  90. package/types.d.mts.map +1 -1
  91. package/types.d.ts +1 -0
  92. package/types.d.ts.map +1 -1
  93. package/types.js.map +1 -1
  94. package/types.mjs.map +1 -1
@@ -9,10 +9,11 @@
9
9
  //
10
10
  // The local code-execution server stays on `execute`. This file is not generated.
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DIRECTORY_SERVER_INSTRUCTIONS = void 0;
12
+ exports.AGENT_IDS_PATTERN = exports.DIRECTORY_SERVER_INSTRUCTIONS = void 0;
13
13
  exports.directoryTools = directoryTools;
14
14
  const sdk_1 = require("@roarkanalytics/sdk");
15
15
  const types_1 = require("./types.js");
16
+ const directory_output_schemas_1 = require("./directory-output-schemas.js");
16
17
  /**
17
18
  * Server instructions for the directory surface.
18
19
  *
@@ -92,8 +93,11 @@ const CALL_STATUSES = ['RINGING', 'IN_PROGRESS', 'ENDED'];
92
93
  const CALL_SORT_FIELDS = ['createdAt', 'startedAt', 'endedAt', 'duration', 'title', 'status'];
93
94
  const SORT_DIRECTIONS = ['asc', 'desc'];
94
95
  /** GET /v1/call rejects a non-UUID in `agentId` and in `properties[agent_id][eq]`. */
95
- const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
96
+ const UUID_SOURCE = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
97
+ const UUID_PATTERN = new RegExp(`^${UUID_SOURCE}$`);
96
98
  const MAX_AGENT_IDS = 100;
99
+ /** The rule `optionalAgentIds` enforces, as a JSON Schema pattern: 1 to MAX_AGENT_IDS comma-separated UUIDs. */
100
+ exports.AGENT_IDS_PATTERN = `^${UUID_SOURCE}(,${UUID_SOURCE}){0,${MAX_AGENT_IDS - 1}}$`;
97
101
  const MAX_PROPERTY_FILTERS = 20;
98
102
  const FLOW_TYPES = ['SCRIPTED', 'IMPROV', 'VOICEMAIL'];
99
103
  const TRANSCRIPT_SOURCES = [
@@ -107,30 +111,39 @@ class ToolInputError extends Error {
107
111
  this.name = 'ToolInputError';
108
112
  }
109
113
  }
114
+ // Every tool talks only to the Roark API, so openWorldHint is false, except
115
+ // run_simulation, which places phone calls to the agent under test.
110
116
  const readAnnotations = (title) => ({
111
117
  title,
112
118
  readOnlyHint: true,
113
119
  destructiveHint: false,
120
+ idempotentHint: true,
121
+ openWorldHint: false,
114
122
  });
115
- const writeAnnotations = (title) => ({
123
+ // Each write creates a new record, so repeating a call is not idempotent.
124
+ const writeAnnotations = (title, { openWorld = false } = {}) => ({
116
125
  title,
117
126
  readOnlyHint: false,
118
127
  destructiveHint: true,
128
+ idempotentHint: false,
129
+ openWorldHint: openWorld,
119
130
  });
120
131
  const projectProperty = {
121
132
  type: 'string',
122
133
  description: 'Roark project id. Required when this connection is not already pinned to one project. list_projects returns the ids this credential can use.',
123
134
  };
124
- const pagingProperties = {
135
+ /** `after` and `limit`, with the page size the endpoint uses when `limit` is omitted. */
136
+ const paging = (defaultLimit) => ({
125
137
  after: {
126
138
  type: 'string',
127
- description: 'Cursor from a previous response. Omit for the first page.',
139
+ description: 'Paging cursor: pass pagination.nextCursor from the previous response to get the next page. Omit for the first page.',
128
140
  },
129
141
  limit: {
130
142
  type: 'number',
131
- description: 'Maximum number of rows to return.',
143
+ description: `Page size: the most rows one response returns. When omitted, the API returns up to ${defaultLimit}.`,
132
144
  },
133
- };
145
+ });
146
+ const pagingProperties = paging(20);
134
147
  const objectSchema = (properties, required) => ({
135
148
  type: 'object',
136
149
  properties,
@@ -335,9 +348,17 @@ const callListQuery = (args) => omitUndefined({
335
348
  after: optionalString(args, 'after'),
336
349
  limit: optionalLimit(args),
337
350
  });
351
+ // Every tool declares an outputSchema, so the response body is also returned as
352
+ // structuredContent. The JSON text stays for clients that read only content.
338
353
  const callApi = async (fn) => {
339
354
  try {
340
- return (0, types_1.asTextContentResult)(await fn());
355
+ const result = await fn();
356
+ // A tool with an outputSchema must return structuredContent, which is an object. The API
357
+ // always answers with { data, ... }; anything else is reported rather than sent unstructured.
358
+ if (!isRecord(result)) {
359
+ return (0, types_1.asErrorResult)(`Unexpected response from the Roark API: ${JSON.stringify(result) ?? 'empty'}`);
360
+ }
361
+ return { ...(0, types_1.asTextContentResult)(result), structuredContent: result };
341
362
  }
342
363
  catch (error) {
343
364
  if (error instanceof ToolInputError || error instanceof sdk_1.APIError || error instanceof Error) {
@@ -347,22 +368,26 @@ const callApi = async (fn) => {
347
368
  }
348
369
  };
349
370
  const handler = (fn) => async ({ reqContext, args, }) => callApi(() => fn(reqContext, args ?? {}));
350
- const defineTool = (name, title, description, inputSchema, annotations, metadata, fn) => ({
371
+ const defineTool = (name, title, description, inputSchema, outputSchema, annotations, metadata, fn) => ({
351
372
  metadata,
352
373
  tool: {
353
374
  name,
354
375
  title,
355
376
  description,
356
377
  inputSchema,
378
+ outputSchema,
357
379
  annotations,
358
380
  },
359
381
  handler: handler(fn),
360
382
  });
361
383
  const endpointSchema = {
362
384
  type: 'object',
363
- description: 'An agent endpoint Roark dials or connects to.',
385
+ description: 'An agent endpoint the run tests.',
364
386
  properties: {
365
- id: { type: 'string', description: 'Agent endpoint id from list_agent_endpoints.' },
387
+ id: {
388
+ type: 'string',
389
+ description: 'Agent endpoint id, from list_agent_endpoints or create_agent_endpoint.',
390
+ },
366
391
  },
367
392
  required: ['id'],
368
393
  };
@@ -370,23 +395,65 @@ const metricRefSchema = {
370
395
  type: 'object',
371
396
  description: 'A metric to score, by id or by slug.',
372
397
  properties: {
373
- id: { type: 'string', description: 'Metric definition id.' },
374
- slug: { type: 'string', description: 'Metric slug, such as call_outcome.' },
398
+ id: { type: 'string', description: 'Metric definition id, from list_metric_definitions.' },
399
+ slug: {
400
+ type: 'string',
401
+ description: 'Metric slug, from list_metric_definitions. Use instead of id.',
402
+ },
375
403
  },
376
404
  };
405
+ // A {{variable}} name to value map. The API takes string values only.
406
+ const stringMapSchema = (description) => ({
407
+ type: 'object',
408
+ description,
409
+ additionalProperties: { type: 'string' },
410
+ });
377
411
  const flowAttachmentSchema = {
378
412
  type: 'object',
379
- description: 'A customer flow to include. Set happyPath, edgeCases, or both. id comes from list_customer_flows.',
413
+ description: 'A customer flow to include. Name it by id or slug, and set happyPath, edgeCases, or both.',
380
414
  properties: {
381
- id: { type: 'string', description: 'Customer flow id.' },
382
- slug: { type: 'string', description: 'Roark-curated flow slug, used instead of id.' },
383
- happyPath: { type: 'boolean', description: 'Whether to run the flow happy path.' },
415
+ id: {
416
+ type: 'string',
417
+ description: 'Customer flow id, from list_customer_flows or create_customer_flow.',
418
+ },
419
+ slug: {
420
+ type: 'string',
421
+ description: 'Stable slug of a flow Roark provides, used instead of id. GET /v1/simulation/template lists them. Flows made in the project have no slug.',
422
+ },
423
+ happyPath: {
424
+ type: 'boolean',
425
+ description: "true runs the flow's happy path, the conversation going as intended. It is resolved when the run starts, so it follows the flow as it is then.",
426
+ },
384
427
  edgeCases: {
385
- description: 'ALL runs every edge case. An array runs only the named edge case ids.',
428
+ type: ['string', 'array'],
429
+ description: 'The string ALL runs every edge case the flow has when the run starts. An array runs only the listed edge cases, each named by id or slug.',
430
+ items: {
431
+ type: 'object',
432
+ properties: {
433
+ id: {
434
+ type: 'string',
435
+ description: "Edge case id, from the flow's edgeCases in list_customer_flows.",
436
+ },
437
+ slug: {
438
+ type: 'string',
439
+ description: 'Stable slug of an edge case Roark provides, matched within this flow. Used instead of id.',
440
+ },
441
+ personaOverrideId: {
442
+ type: 'string',
443
+ description: 'Persona id, from list_personas, to run this edge case as instead of its own persona.',
444
+ },
445
+ variables: stringMapSchema('Values for the {{variables}} in this edge case only, as variable name to string value.'),
446
+ },
447
+ },
448
+ },
449
+ personaOverrideId: {
450
+ type: 'string',
451
+ description: 'Persona id, from list_personas, to run everything in this flow as instead of its own persona.',
386
452
  },
387
- personaOverrideId: { type: 'string', description: 'Persona id to use for this attachment.' },
388
453
  },
389
454
  };
455
+ const callIdDescription = 'Roark call id, from list_calls.';
456
+ const directionDescription = 'INBOUND: the simulated caller phones the agent. OUTBOUND: the agent places the call to the simulated caller.';
390
457
  const buildRunBody = (args) => {
391
458
  const hasPlanId = args['planId'] !== undefined;
392
459
  const hasPlan = args['plan'] !== undefined;
@@ -540,50 +607,63 @@ const buildEndpointBody = (args) => {
540
607
  */
541
608
  function directoryTools() {
542
609
  return [
543
- defineTool('list_projects', 'List projects', 'Lists the Roark projects this credential can use, with the permissions it holds in each. Returns each project id, name, slug, and organization.', objectSchema({}), readAnnotations('List projects'), readMeta('project', '/v1/projects'), async (reqContext) => reqContext.client.project.list()),
544
- defineTool('list_agents', 'List agents', 'Lists voice and chat agents in a Roark project. Returns each agent id, name, custom id, and description.', objectSchema({
610
+ defineTool('list_projects', 'List projects', 'Lists the Roark projects this credential can use, with the permissions it holds in each. Returns each project id, name, slug, and organization.', objectSchema({}), directory_output_schemas_1.directoryOutputSchemas.listProjects, readAnnotations('List projects'), readMeta('project', '/v1/projects'), async (reqContext) => reqContext.client.project.list()),
611
+ defineTool('list_agents', 'List agents', 'Lists voice and chat agents in a Roark project, every agent unless searchText narrows it. Returns each agent id, name, custom id, and description, one page at a time.', objectSchema({
545
612
  project: projectProperty,
546
- searchText: { type: 'string', description: 'Match against agent name or description.' },
613
+ searchText: {
614
+ type: 'string',
615
+ description: 'Text to match against agent names and descriptions. When omitted, every agent is listed.',
616
+ },
547
617
  ...pagingProperties,
548
- }), readAnnotations('List agents'), readMeta('agent', '/v1/agent'), async (reqContext, args) => scopedClient(reqContext, args).agent.list(omitUndefined({
618
+ }), directory_output_schemas_1.directoryOutputSchemas.listAgents, readAnnotations('List agents'), readMeta('agent', '/v1/agent'), async (reqContext, args) => scopedClient(reqContext, args).agent.list(omitUndefined({
549
619
  searchText: optionalString(args, 'searchText'),
550
620
  after: optionalString(args, 'after'),
551
621
  limit: optionalLimit(args),
552
622
  }))),
553
- defineTool('list_agent_endpoints', 'List agent endpoints', 'Lists the endpoints Roark uses to reach agents in a project. Returns each endpoint id, agent id, direction, type, and address. A simulation runs against an endpoint id.', objectSchema({
623
+ defineTool('list_agent_endpoints', 'List agent endpoints', 'Lists the endpoints Roark uses to reach agents in a project: phone numbers and other transports. Returns each endpoint id, agent id, direction, type, and address. A simulation runs against an endpoint id.', objectSchema({
554
624
  project: projectProperty,
555
- agentId: { type: 'string', description: 'Return endpoints for this agent only.' },
556
- searchText: { type: 'string', description: 'Match against endpoint address or environment name.' },
625
+ agentId: {
626
+ type: 'string',
627
+ description: "Agent id, from list_agents, to list only that agent's endpoints. When omitted, endpoints for every agent are listed.",
628
+ },
629
+ searchText: {
630
+ type: 'string',
631
+ description: 'Text to match against the endpoint address, such as a phone number, or its environment name.',
632
+ },
557
633
  ...pagingProperties,
558
- }), readAnnotations('List agent endpoints'), readMeta('agentEndpoint', '/v1/agent/endpoint'), async (reqContext, args) => scopedClient(reqContext, args).agentEndpoint.list(omitUndefined({
634
+ }), directory_output_schemas_1.directoryOutputSchemas.listAgentEndpoints, readAnnotations('List agent endpoints'), readMeta('agentEndpoint', '/v1/agent/endpoint'), async (reqContext, args) => scopedClient(reqContext, args).agentEndpoint.list(omitUndefined({
559
635
  agentId: optionalString(args, 'agentId'),
560
636
  searchText: optionalString(args, 'searchText'),
561
637
  after: optionalString(args, 'after'),
562
638
  limit: optionalLimit(args),
563
639
  }))),
564
- defineTool('list_calls', 'List calls', 'Lists calls in a Roark project, including simulated and live calls. Returns call ids, status, direction, and timestamps. Does not include transcripts. ' +
565
- 'agentId is one agent UUID, or up to 100 comma-separated UUIDs with no spaces. ' +
566
- 'properties filters with one operator per name: eq is a case-insensitive exact match, and exists checks whether the property is set. ' +
567
- "Built-in agent_name, also accepted as agentName, matches any participating agent's current name. Built-in agent_id matches one agent UUID. Any other name is a custom property. " +
568
- 'sortBy is createdAt (the default), startedAt, endedAt, duration, title, or status, and sortDirection is desc (the default) or asc. The filters and the sort apply together.', objectSchema({
640
+ defineTool('list_calls', 'List calls', 'Lists calls in a Roark project, simulated and live. Returns call ids, status, direction, and timestamps, without transcripts. Every filter and the sort apply together.', objectSchema({
569
641
  project: projectProperty,
570
- searchText: { type: 'string', description: 'Match against call title, summary, or transcript text.' },
571
- status: { type: 'string', enum: [...CALL_STATUSES], description: 'Call status filter.' },
642
+ searchText: {
643
+ type: 'string',
644
+ description: 'Text to match against call titles, summaries, and transcripts.',
645
+ },
646
+ status: {
647
+ type: 'string',
648
+ enum: [...CALL_STATUSES],
649
+ description: 'Where the calls are in their lifecycle: RINGING has not connected yet, IN_PROGRESS is live, ENDED has finished. When omitted, calls in every state are listed.',
650
+ },
572
651
  agentId: {
573
652
  type: 'string',
574
- description: 'One agent UUID, or up to 100 comma-separated UUIDs with no spaces. Returns calls that include any of these agents.',
653
+ pattern: exports.AGENT_IDS_PATTERN,
654
+ description: 'Agents whose calls to list, by id from list_agents. A call matches when any of them took part. Separate several ids with commas.',
575
655
  },
576
656
  properties: {
577
657
  type: 'object',
578
- description: "One entry per property name, at most 20. Each entry sets eq (case-insensitive exact match, sent as properties[<name>][eq]=<value>) or exists (properties[<name>][exists]=true or false), and not both. agent_name (alias agentName) matches any participating agent's current name. agent_id takes one UUID. Any other name is a custom property.",
658
+ description: "Call property filters, keyed by property name, at most 20. Each entry sets eq or exists, not both. eq matches a value, ignoring case, and exists checks whether the property is set. The built-in agent_name, also accepted as agentName, matches any participating agent's current name, and agent_id matches one agent id. Any other name is a custom property set on the call.",
579
659
  additionalProperties: {
580
660
  type: 'object',
581
- description: 'Exactly one of eq or exists.',
661
+ description: 'One filter: eq or exists.',
582
662
  properties: {
583
- eq: { type: 'string', description: 'Case-insensitive exact match.' },
663
+ eq: { type: 'string', description: 'Value the property must equal, ignoring case.' },
584
664
  exists: {
585
665
  type: 'boolean',
586
- description: 'true: the property is set. false: the property is missing.',
666
+ description: 'true lists calls that have the property set. false lists calls that do not.',
587
667
  },
588
668
  },
589
669
  },
@@ -591,35 +671,37 @@ function directoryTools() {
591
671
  sortBy: {
592
672
  type: 'string',
593
673
  enum: [...CALL_SORT_FIELDS],
594
- description: 'Field to sort by. createdAt is the default. Combines with the filters and with sortDirection.',
674
+ default: 'createdAt',
675
+ description: 'What orders the results: when the call was created, started, or ended, how long it lasted, its title, or its status.',
595
676
  },
596
677
  sortDirection: {
597
678
  type: 'string',
598
679
  enum: [...SORT_DIRECTIONS],
599
- description: 'asc or desc. desc is the default. Combines with sortBy and the filters.',
680
+ default: 'desc',
681
+ description: 'asc puts the earliest or smallest first, desc the latest or largest.',
600
682
  },
601
683
  simulationRunPlanJobId: {
602
684
  type: 'string',
603
- description: 'Return calls from this simulation run only.',
685
+ description: 'Simulation run id, the simulationRunPlanJobId that run_simulation returns, to list only the calls that run placed.',
604
686
  },
605
687
  ...pagingProperties,
606
- }), readAnnotations('List calls'), readMeta('call', '/v1/call'), async (reqContext, args) => scopedClient(reqContext, args).call.list(callListQuery(args))),
688
+ }), directory_output_schemas_1.directoryOutputSchemas.listCalls, readAnnotations('List calls'), readMeta('call', '/v1/call'), async (reqContext, args) => scopedClient(reqContext, args).call.list(callListQuery(args))),
607
689
  defineTool('get_call', 'Get call', 'Returns one call in a Roark project by its id, including status, direction, timestamps, and summary. Does not include the transcript.', objectSchema({
608
690
  project: projectProperty,
609
- callId: { type: 'string', description: 'Call id.' },
610
- }, ['callId']), readAnnotations('Get call'), readMeta('call', '/v1/call/{callId}'), async (reqContext, args) => scopedClient(reqContext, args).call.getByID(requireString(args, 'callId'))),
611
- defineTool('get_call_transcript', 'Get call transcript', 'Returns the transcript of one call in a Roark project: participants and the text of each turn, with timing.', objectSchema({
691
+ callId: { type: 'string', description: callIdDescription },
692
+ }, ['callId']), directory_output_schemas_1.directoryOutputSchemas.getCall, readAnnotations('Get call'), readMeta('call', '/v1/call/{callId}'), async (reqContext, args) => scopedClient(reqContext, args).call.getByID(requireString(args, 'callId'))),
693
+ defineTool('get_call_transcript', 'Get call transcript', 'Returns the transcript of one call in a Roark project: who took part, and the text of each turn with its timing.', objectSchema({
612
694
  project: projectProperty,
613
- callId: { type: 'string', description: 'Call id.' },
695
+ callId: { type: 'string', description: callIdDescription },
614
696
  source: {
615
697
  type: 'string',
616
698
  enum: [...TRANSCRIPT_SOURCES],
617
- description: 'Transcription source. When omitted, the API uses the best source it has for the call.',
699
+ description: 'Which transcription to return: Roark post-call transcription, or the one the simulated caller or your agent captured live. When omitted, the first available of CUSTOMER_AGENT_REALTIME, SIMULATION_AGENT_REALTIME, then ROARK_POST_CALL.',
618
700
  },
619
- }, ['callId']), readAnnotations('Get call transcript'), readMeta('call', '/v1/call/{callId}/transcript'), async (reqContext, args) => scopedClient(reqContext, args).call.getTranscript(requireString(args, 'callId'), omitUndefined({ source: optionalEnum(args, 'source', TRANSCRIPT_SOURCES) }))),
620
- defineTool('list_call_metrics', 'List call metrics', 'Returns the metric scores recorded for one call in a Roark project. status success returns computed scores only. status all also returns rows that have no value. flatten true returns one row per score; when omitted, scores are grouped by metric.', objectSchema({
701
+ }, ['callId']), directory_output_schemas_1.directoryOutputSchemas.getCallTranscript, readAnnotations('Get call transcript'), readMeta('call', '/v1/call/{callId}/transcript'), async (reqContext, args) => scopedClient(reqContext, args).call.getTranscript(requireString(args, 'callId'), omitUndefined({ source: optionalEnum(args, 'source', TRANSCRIPT_SOURCES) }))),
702
+ defineTool('list_call_metrics', 'List call metrics', 'Returns the metric scores recorded for one call in a Roark project, grouped by metric unless flatten is true.', objectSchema({
621
703
  project: projectProperty,
622
- callId: { type: 'string', description: 'Call id.' },
704
+ callId: { type: 'string', description: callIdDescription },
623
705
  flatten: {
624
706
  type: 'string',
625
707
  description: 'true returns one row per score. Any other value, or omitting it, groups scores by metric.',
@@ -627,13 +709,13 @@ function directoryTools() {
627
709
  status: {
628
710
  type: 'string',
629
711
  enum: ['success', 'all'],
630
- description: 'success returns computed scores. all also returns rows with no value.',
712
+ description: 'success returns computed scores only. all also returns metrics with no value (not applicable, missing data, or an error), so a caller can tell a finished metric from one still computing. When omitted, success.',
631
713
  },
632
- }, ['callId']), readAnnotations('List call metrics'), readMeta('call', '/v1/call/{callId}/metrics'), async (reqContext, args) => scopedClient(reqContext, args).call.listMetrics(requireString(args, 'callId'), omitUndefined({
714
+ }, ['callId']), directory_output_schemas_1.directoryOutputSchemas.listCallMetrics, readAnnotations('List call metrics'), readMeta('call', '/v1/call/{callId}/metrics'), async (reqContext, args) => scopedClient(reqContext, args).call.listMetrics(requireString(args, 'callId'), omitUndefined({
633
715
  flatten: optionalString(args, 'flatten'),
634
716
  status: optionalEnum(args, 'status', ['success', 'all']),
635
717
  }))),
636
- defineTool('list_metric_definitions', 'List metric definitions', 'Lists the metrics a Roark project can score, including built-in and custom metrics. Returns each metric id, slug, name, and type.', objectSchema({ project: projectProperty, ...pagingProperties }), readAnnotations('List metric definitions'), readMeta('metric', '/v1/metric/definitions'), async (reqContext, args) => scopedClient(reqContext, args).metric.listDefinitions(omitUndefined({ after: optionalString(args, 'after'), limit: optionalLimit(args) }))),
718
+ defineTool('list_metric_definitions', 'List metric definitions', 'Lists the metrics a Roark project can score, including built-in and custom metrics. Returns each metric id, slug, name, and type.', objectSchema({ project: projectProperty, ...paging(500) }), directory_output_schemas_1.directoryOutputSchemas.listMetricDefinitions, readAnnotations('List metric definitions'), readMeta('metric', '/v1/metric/definitions'), async (reqContext, args) => scopedClient(reqContext, args).metric.listDefinitions(omitUndefined({ after: optionalString(args, 'after'), limit: optionalLimit(args) }))),
637
719
  defineTool('get_simulation_results', 'Get simulation results', 'Returns the results of one simulation run in a Roark project: run status, score, pass or fail verdict, per-metric aggregates, and the checks on each simulated call. Counts include calls that have finished so far. The verdict is absent until the run ends.', objectSchema({
638
720
  project: projectProperty,
639
721
  jobId: {
@@ -644,102 +726,140 @@ function directoryTools() {
644
726
  type: 'string',
645
727
  description: 'Another simulation run id to compare against. When omitted, the API compares with the previous settled run of the same plan.',
646
728
  },
647
- }, ['jobId']), readAnnotations('Get simulation results'), readMeta('simulationRunPlanJob', '/v1/simulation/plan/job/{jobId}/results'), async (reqContext, args) => scopedClient(reqContext, args).simulationRunPlanJob.getResults(requireString(args, 'jobId'), omitUndefined({ compareToJobId: optionalString(args, 'compareToJobId') }))),
648
- defineTool('list_personas', 'List personas', 'Lists simulated caller personas in a Roark project. Returns each persona id, name, language, accent, and gender.', objectSchema({
729
+ }, ['jobId']), directory_output_schemas_1.directoryOutputSchemas.getSimulationResults, readAnnotations('Get simulation results'), readMeta('simulationRunPlanJob', '/v1/simulation/plan/job/{jobId}/results'), async (reqContext, args) => scopedClient(reqContext, args).simulationRunPlanJob.getResults(requireString(args, 'jobId'), omitUndefined({ compareToJobId: optionalString(args, 'compareToJobId') }))),
730
+ defineTool('list_personas', 'List personas', 'Lists simulated caller personas in a Roark project, every persona unless searchText narrows it. Returns each persona id, name, language, accent, and gender, one page at a time.', objectSchema({
649
731
  project: projectProperty,
650
- searchText: { type: 'string', description: 'Match against persona name or description.' },
732
+ searchText: {
733
+ type: 'string',
734
+ description: 'Text to match against persona names and descriptions. When omitted, every persona is listed.',
735
+ },
651
736
  ...pagingProperties,
652
- }), readAnnotations('List personas'), readMeta('simulationPersona', '/v1/persona'), async (reqContext, args) => scopedClient(reqContext, args).simulationPersona.list(omitUndefined({
737
+ }), directory_output_schemas_1.directoryOutputSchemas.listPersonas, readAnnotations('List personas'), readMeta('simulationPersona', '/v1/persona'), async (reqContext, args) => scopedClient(reqContext, args).simulationPersona.list(omitUndefined({
653
738
  searchText: optionalString(args, 'searchText'),
654
739
  after: optionalString(args, 'after'),
655
740
  limit: optionalLimit(args),
656
741
  }))),
657
- defineTool('list_customer_flows', 'List customer flows', 'Lists customer flows in a Roark project. A customer flow is the conversation scenario a simulated caller follows. Returns each flow id, title, and type. The step graph of a scripted flow is not included.', objectSchema({
742
+ defineTool('list_customer_flows', 'List customer flows', 'Lists customer flows in a Roark project. A customer flow is the conversation scenario a simulated caller follows. Returns each flow id, title, type, happy path, and edge cases. The step graph of a scripted flow is not included.', objectSchema({
658
743
  project: projectProperty,
659
- searchText: { type: 'string', description: 'Match against flow title.' },
660
- type: { type: 'string', enum: [...FLOW_TYPES], description: 'Flow type filter.' },
744
+ searchText: {
745
+ type: 'string',
746
+ description: 'Text to match against flow titles. When omitted, flows are not filtered by title.',
747
+ },
748
+ type: {
749
+ type: 'string',
750
+ enum: [...FLOW_TYPES],
751
+ description: 'How the simulated caller behaves. IMPROV gives the caller a goal to improvise around, SCRIPTED follows an exact step graph, and VOICEMAIL plays a voicemail greeting to test the message the agent leaves. When omitted, flows of every type are listed.',
752
+ },
661
753
  includeSystem: {
662
754
  type: 'string',
663
755
  enum: ['true', 'false'],
664
- description: 'true includes flows Roark provides. false returns only flows in the project.',
756
+ description: 'true also lists flows Roark provides. false, or omitting it, lists only flows made in the project.',
665
757
  },
666
758
  ...pagingProperties,
667
- }), readAnnotations('List customer flows'), readMeta('customerFlow', '/v1/customer-flow'), async (reqContext, args) => scopedClient(reqContext, args).customerFlow.list(omitUndefined({
759
+ }), directory_output_schemas_1.directoryOutputSchemas.listCustomerFlows, readAnnotations('List customer flows'), readMeta('customerFlow', '/v1/customer-flow'), async (reqContext, args) => scopedClient(reqContext, args).customerFlow.list(omitUndefined({
668
760
  searchText: optionalString(args, 'searchText'),
669
761
  type: optionalEnum(args, 'type', FLOW_TYPES),
670
762
  includeSystem: optionalEnum(args, 'includeSystem', ['true', 'false']),
671
763
  after: optionalString(args, 'after'),
672
764
  limit: optionalLimit(args),
673
765
  }))),
674
- defineTool('list_simulation_environments', 'List simulation environments', 'Lists call environments in a Roark project, including environments Roark provides. Returns each environment id, name, and background noise. Creating a customer flow requires an environment id.', objectSchema({ project: projectProperty, ...pagingProperties }), readAnnotations('List simulation environments'), readMeta('simulationEnvironment', '/v1/simulation/environment'), async (reqContext, args) => scopedClient(reqContext, args).simulationEnvironment.list(omitUndefined({ after: optionalString(args, 'after'), limit: optionalLimit(args) }))),
675
- defineTool('create_agent', 'Create agent', 'Creates an agent in a Roark project. Requires a name. Returns the created agent, including its id. Does not create an endpoint.', objectSchema({
766
+ defineTool('list_simulation_environments', 'List simulation environments', 'Lists call environments in a Roark project, including environments Roark provides. Returns each environment id, name, and background noise. Creating a customer flow requires an environment id.', objectSchema({ project: projectProperty, ...pagingProperties }), directory_output_schemas_1.directoryOutputSchemas.listSimulationEnvironments, readAnnotations('List simulation environments'), readMeta('simulationEnvironment', '/v1/simulation/environment'), async (reqContext, args) => scopedClient(reqContext, args).simulationEnvironment.list(omitUndefined({ after: optionalString(args, 'after'), limit: optionalLimit(args) }))),
767
+ defineTool('create_agent', 'Create agent', 'Creates an agent in a Roark project. Each call adds a new agent. Requires a name. Returns the created agent, including its id. Does not create an endpoint; create_agent_endpoint does.', objectSchema({
676
768
  project: projectProperty,
677
- name: { type: 'string', description: 'Agent name.' },
769
+ name: {
770
+ type: 'string',
771
+ description: 'Display name for the agent, shown in Roark and returned by list_agents.',
772
+ },
678
773
  description: { type: 'string', description: 'What the agent does.' },
679
- customId: { type: 'string', description: 'Caller-chosen id, unique in the project.' },
680
- }, ['name']), writeAnnotations('Create agent'), writeMeta('agent', '/v1/agent'), async (reqContext, args) => scopedClient(reqContext, args).agent.create({
774
+ customId: {
775
+ type: 'string',
776
+ description: 'Your own identifier for the agent, such as its id in your platform. Unique in the project.',
777
+ },
778
+ }, ['name']), directory_output_schemas_1.directoryOutputSchemas.createAgent, writeAnnotations('Create agent'), writeMeta('agent', '/v1/agent'), async (reqContext, args) => scopedClient(reqContext, args).agent.create({
681
779
  name: requireString(args, 'name'),
682
780
  ...omitUndefined({
683
781
  description: optionalString(args, 'description'),
684
782
  customId: optionalString(args, 'customId'),
685
783
  }),
686
784
  })),
687
- defineTool('create_agent_endpoint', 'Create agent endpoint', 'Creates a phone endpoint for an agent in a Roark project. Roark places simulated calls to this number. Requires an agent id, an E.164 phone number, and a direction of INCOMING, OUTGOING, or INCOMING_AND_OUTGOING. Phone is the only endpoint type this tool creates.', objectSchema({
785
+ defineTool('create_agent_endpoint', 'Create agent endpoint', 'Creates a phone endpoint for an agent in a Roark project. Each call adds a new endpoint; it places no calls itself. Simulations then call the agent on this number, or receive its calls. Phone is the only endpoint type this tool creates.', objectSchema({
688
786
  project: projectProperty,
689
787
  agentId: { type: 'string', description: 'Agent id from list_agents or create_agent.' },
690
- value: { type: 'string', description: 'Phone number in E.164 format, starting with +.' },
788
+ value: {
789
+ type: 'string',
790
+ description: "The agent's phone number in E.164 form, such as +14155550123.",
791
+ },
691
792
  direction: {
692
793
  type: 'string',
693
794
  enum: [...ENDPOINT_DIRECTIONS],
694
- description: 'Which way calls can travel on this number.',
795
+ description: 'Which way calls travel on this number: INCOMING when callers reach the agent here, OUTGOING when the agent calls out from it, or both.',
796
+ },
797
+ environment: {
798
+ type: 'string',
799
+ description: 'Environment label for the endpoint, such as production or staging. When omitted, production.',
695
800
  },
696
- environment: { type: 'string', description: 'Environment name. The API default is production.' },
697
801
  outboundDialType: {
698
802
  type: 'string',
699
803
  enum: ['NONE', 'HTTP_REQUEST'],
700
- description: 'How Roark places an outbound call. The API default is NONE.',
804
+ description: 'How Roark starts an outbound simulation: HTTP_REQUEST sends an HTTP request to your platform to make the agent dial, NONE sends nothing. When omitted, NONE.',
701
805
  },
702
806
  outboundDialHttpRequestDefinitionId: {
703
807
  type: 'string',
704
- description: 'HTTP request definition id. Required when outboundDialType is HTTP_REQUEST.',
808
+ description: 'Id of the HTTP request definition Roark sends to make the agent dial, from GET /v1/http-request-definition. Required when outboundDialType is HTTP_REQUEST.',
705
809
  },
706
- }, ['agentId', 'value', 'direction']), writeAnnotations('Create agent endpoint'), writeMeta('agentEndpoint', '/v1/agent/endpoint'), async (reqContext, args) => scopedClient(reqContext, args).agentEndpoint.create(buildEndpointBody(args))),
707
- defineTool('create_persona', 'Create persona', 'Creates a simulated caller persona in a Roark project. Requires a name, language, accent, and gender. Returns the created persona, including its id.', objectSchema({
810
+ }, ['agentId', 'value', 'direction']), directory_output_schemas_1.directoryOutputSchemas.createAgentEndpoint, writeAnnotations('Create agent endpoint'), writeMeta('agentEndpoint', '/v1/agent/endpoint'), async (reqContext, args) => scopedClient(reqContext, args).agentEndpoint.create(buildEndpointBody(args))),
811
+ defineTool('create_persona', 'Create persona', 'Creates a simulated caller persona in a Roark project. Each call adds a new persona, so repeating it creates a duplicate. It changes nothing else and places no calls. Returns the created persona; pass its id as personaOverrideId to create_customer_flow to use it.', objectSchema({
708
812
  project: projectProperty,
709
813
  name: { type: 'string', description: 'Name the caller uses in conversation.' },
710
- language: { type: 'string', enum: [...LANGUAGES], description: 'Primary spoken language.' },
711
- accent: { type: 'string', enum: [...ACCENTS], description: 'Accent the persona is voiced with.' },
814
+ language: {
815
+ type: 'string',
816
+ enum: [...LANGUAGES],
817
+ description: 'The language the simulated caller speaks, as an ISO 639-1 code: EN is English, ES Spanish.',
818
+ },
819
+ accent: { type: 'string', enum: [...ACCENTS], description: 'Accent the caller speaks with.' },
712
820
  gender: { type: 'string', enum: [...GENDERS], description: 'Gender the persona is voiced with.' },
713
821
  age: {
714
822
  type: 'string',
715
823
  enum: [...AGES],
716
- description: 'How old the caller sounds. The API default is ADULT.',
824
+ default: 'ADULT',
825
+ description: 'How old the caller sounds.',
717
826
  },
718
827
  baseEmotion: {
719
828
  type: 'string',
720
829
  enum: [...EMOTIONS],
721
- description: 'Emotional baseline. The API default is NEUTRAL.',
830
+ default: 'NEUTRAL',
831
+ description: 'The emotional state the simulated caller brings to the call.',
722
832
  },
723
833
  backstoryPrompt: {
724
834
  type: 'string',
725
835
  description: 'Background and behavior the simulated caller plays.',
726
836
  },
727
- description: { type: 'string', description: 'Short label for the persona.' },
728
- }, ['name', 'language', 'accent', 'gender']), writeAnnotations('Create persona'), writeMeta('simulationPersona', '/v1/persona'), async (reqContext, args) => scopedClient(reqContext, args).simulationPersona.create(buildPersonaBody(args))),
729
- defineTool('create_customer_flow', 'Create customer flow', 'Creates an improv customer flow in a Roark project. A customer flow is the conversation scenario a simulated caller follows. Requires a title, at least one agent id, and a happy path with a title, a persona id, and an environment id. Returns the created flow, including its id. Scripted step graphs are not created by this tool.', objectSchema({
837
+ description: {
838
+ type: 'string',
839
+ description: 'Short summary of the persona, to tell it apart from others in the project.',
840
+ },
841
+ }, ['name', 'language', 'accent', 'gender']), directory_output_schemas_1.directoryOutputSchemas.createPersona, writeAnnotations('Create persona'), writeMeta('simulationPersona', '/v1/persona'), async (reqContext, args) => scopedClient(reqContext, args).simulationPersona.create(buildPersonaBody(args))),
842
+ defineTool('create_customer_flow', 'Create customer flow', 'Creates an improv customer flow in a Roark project. A customer flow is the conversation scenario a simulated caller follows. Each call adds a new flow. Requires a title, at least one agent id, and a happy path with a title, a persona id, and an environment id. Returns the created flow, including its id. Scripted step graphs are not created by this tool.', objectSchema({
730
843
  project: projectProperty,
731
- title: { type: 'string', description: 'Flow title.' },
844
+ title: {
845
+ type: 'string',
846
+ description: 'Name for the flow, shown in Roark and returned by list_customer_flows.',
847
+ },
732
848
  description: { type: 'string', description: 'What the conversation covers.' },
733
849
  agentIds: {
734
850
  type: 'array',
735
851
  items: { type: 'string' },
736
- description: 'Agents this flow exercises. At least one.',
852
+ minItems: 1,
853
+ description: 'Ids of the agents this flow tests, from list_agents or create_agent.',
737
854
  },
738
855
  happyPath: {
739
856
  type: 'object',
740
857
  description: 'The way the conversation is meant to go.',
741
858
  properties: {
742
- title: { type: 'string', description: 'Happy path title.' },
859
+ title: {
860
+ type: 'string',
861
+ description: 'Name for the happy path, the run where the conversation goes as intended.',
862
+ },
743
863
  prompt: { type: 'string', description: 'What the simulated caller is trying to do.' },
744
864
  personaOverrideId: {
745
865
  type: 'string',
@@ -758,73 +878,126 @@ function directoryTools() {
758
878
  items: {
759
879
  type: 'object',
760
880
  properties: {
761
- title: { type: 'string' },
762
- prompt: { type: 'string' },
763
- personaOverrideId: { type: 'string' },
764
- environmentId: { type: 'string' },
881
+ title: { type: 'string', description: 'Name for this edge case.' },
882
+ prompt: {
883
+ type: 'string',
884
+ description: 'What the simulated caller is trying to do in this edge case.',
885
+ },
886
+ personaOverrideId: {
887
+ type: 'string',
888
+ description: 'Persona id from list_personas or create_persona. When omitted, the happy path persona.',
889
+ },
890
+ environmentId: {
891
+ type: 'string',
892
+ description: 'Environment id from list_simulation_environments. When omitted, the happy path environment.',
893
+ },
765
894
  },
766
895
  required: ['title'],
767
896
  },
768
897
  },
769
- }, ['title', 'agentIds', 'happyPath']), writeAnnotations('Create customer flow'), writeMeta('customerFlow', '/v1/customer-flow'), async (reqContext, args) => scopedClient(reqContext, args).customerFlow.create(buildFlowBody(args))),
770
- defineTool('run_simulation', 'Run simulation', 'Starts a simulation run in a Roark project and places simulated calls. Pass exactly one of planId (an existing plan), plan (an inline plan), or template (a built-in template name, with agentEndpoints and direction). Returns the run id and how many calls the run places. This spends simulation usage on the account.', objectSchema({
898
+ }, ['title', 'agentIds', 'happyPath']), directory_output_schemas_1.directoryOutputSchemas.createCustomerFlow, writeAnnotations('Create customer flow'), writeMeta('customerFlow', '/v1/customer-flow'), async (reqContext, args) => scopedClient(reqContext, args).customerFlow.create(buildFlowBody(args))),
899
+ defineTool('run_simulation', 'Run simulation', 'Starts a simulation run in a Roark project and places simulated calls to the agent. Pass exactly one of planId (an existing plan), plan (an inline plan), or template (a built-in template name, with agentEndpoints and direction). Returns the run id and how many calls the run places. This spends simulation usage on the account.', objectSchema({
771
900
  project: projectProperty,
772
- planId: { type: 'string', description: 'Id of a saved simulation plan to run.' },
901
+ planId: {
902
+ type: 'string',
903
+ description: 'A saved run plan to run again, with its own endpoints, flows, and metrics: the simulationRunPlanId of a run started with saveAsPlan true.',
904
+ },
773
905
  plan: {
774
906
  type: 'object',
775
907
  description: 'Inline plan to run once. Requires agentEndpoints, direction, and maxSimulationDurationSeconds.',
776
908
  properties: {
777
- name: { type: 'string', description: 'Plan name. Required when saveAsPlan is true.' },
778
- description: { type: 'string' },
779
- direction: { type: 'string', enum: [...DIRECTIONS] },
780
- agentEndpoints: { type: 'array', items: endpointSchema },
909
+ name: {
910
+ type: 'string',
911
+ description: 'Name for the plan. When omitted, one is generated from the date. Needed for saveAsPlan.',
912
+ },
913
+ description: { type: 'string', description: 'Note on what the plan tests.' },
914
+ direction: { type: 'string', enum: [...DIRECTIONS], description: directionDescription },
915
+ agentEndpoints: {
916
+ type: 'array',
917
+ items: endpointSchema,
918
+ description: 'The agent endpoints the run tests.',
919
+ },
781
920
  metrics: {
782
921
  type: 'array',
783
922
  items: metricRefSchema,
784
923
  description: 'Metrics to score, by id or slug.',
785
924
  },
786
- flows: { type: 'array', items: flowAttachmentSchema },
787
- maxSimulationDurationSeconds: { type: 'number', description: 'Per-call cap, in seconds.' },
925
+ flows: {
926
+ type: 'array',
927
+ items: flowAttachmentSchema,
928
+ description: 'Customer flows to run, and which of their happy paths and edge cases.',
929
+ },
930
+ maxSimulationDurationSeconds: {
931
+ type: 'number',
932
+ description: 'Longest one simulated call may last, in seconds.',
933
+ },
788
934
  iterationCount: {
789
935
  type: 'number',
790
- description: 'Repeats of each test case. The API default is 1.',
936
+ description: 'Times each test case runs. When omitted, 1.',
791
937
  },
792
938
  maxConcurrentJobs: {
793
939
  type: 'number',
794
- description: 'How many calls run at once. The API default is 5.',
940
+ description: 'How many calls run at once. When omitted, 5.',
795
941
  },
796
942
  executionMode: {
797
943
  type: 'string',
798
944
  enum: ['PARALLEL', 'SEQUENTIAL_SAME_RUN_PLAN', 'SEQUENTIAL_PROJECT'],
945
+ description: 'When the run starts relative to other runs. PARALLEL starts it at once. SEQUENTIAL_SAME_RUN_PLAN queues it while another run of the same plan is active. SEQUENTIAL_PROJECT queues it while any run in the project is active. When omitted, PARALLEL.',
799
946
  },
800
947
  },
801
948
  required: ['agentEndpoints', 'direction', 'maxSimulationDurationSeconds'],
802
949
  },
803
950
  template: {
804
951
  type: 'string',
805
- description: 'Built-in template name, as listed by the simulation template API.',
952
+ description: 'Name of a built-in Roark template, such as health-check. GET /v1/simulation/template lists them.',
806
953
  },
807
954
  agentEndpoints: {
808
955
  type: 'array',
809
956
  items: endpointSchema,
810
- description: 'Required with template. The endpoints the template calls.',
957
+ description: 'For a template run: the agent endpoints it tests. A template run fails without it.',
958
+ },
959
+ direction: {
960
+ type: 'string',
961
+ enum: [...DIRECTIONS],
962
+ description: `For a template run, where it is required. ${directionDescription}`,
811
963
  },
812
- direction: { type: 'string', enum: [...DIRECTIONS], description: 'Required with template.' },
813
964
  flows: {
814
965
  type: 'array',
815
966
  items: flowAttachmentSchema,
816
- description: 'Flows for a template that does not supply its own.',
967
+ description: 'For a template run: the flows to run. Needed when the template has no flows of its own; otherwise they replace its flows.',
968
+ },
969
+ iterationCount: {
970
+ type: 'number',
971
+ description: "For a template run: times each test case runs. When omitted, 1, or the template's own count for a template that sweeps a property.",
972
+ },
973
+ maxSimulationDurationSeconds: {
974
+ type: 'number',
975
+ description: "For a template run: longest one simulated call may last, in seconds. When omitted, the template's default.",
817
976
  },
818
- iterationCount: { type: 'number' },
819
- maxSimulationDurationSeconds: { type: 'number' },
820
977
  saveAsPlan: {
821
978
  type: 'boolean',
822
979
  description: 'When plan is set, true keeps the plan so it can be run again by planId. Requires plan.name.',
823
980
  },
824
981
  variables: {
825
- description: 'Placeholder values for the run. An object applies to the whole run. An array applies per flow.',
982
+ type: ['object', 'array'],
983
+ description: 'Values for the {{variables}} the run resolves. An object of name to string value applies to the whole run. An array applies values per flow (flowId, optionally narrowed by edgeCaseId or happyPath).',
984
+ additionalProperties: { type: 'string' },
985
+ items: {
986
+ type: 'object',
987
+ properties: {
988
+ flowId: { type: 'string', description: 'Customer flow id the values apply to.' },
989
+ edgeCaseId: { type: 'string', description: 'Narrow to one edge case of that flow.' },
990
+ happyPath: { type: 'boolean', description: "Narrow to the flow's happy path." },
991
+ scenarioId: {
992
+ type: 'string',
993
+ description: 'Deprecated. Scenario id the values apply to, for a saved plan built from scenarios rather than flows. Use flowId otherwise. Template runs refuse it.',
994
+ },
995
+ variables: stringMapSchema('The values to apply, as variable name to string value.'),
996
+ },
997
+ required: ['variables'],
998
+ },
826
999
  },
827
- }), writeAnnotations('Run simulation'), writeMeta('simulation', '/v1/simulation/run'), async (reqContext, args) => scopedClient(reqContext, args).simulation.run(buildRunBody(args))),
1000
+ }), directory_output_schemas_1.directoryOutputSchemas.runSimulation, writeAnnotations('Run simulation', { openWorld: true }), writeMeta('simulation', '/v1/simulation/run'), async (reqContext, args) => scopedClient(reqContext, args).simulation.run(buildRunBody(args))),
828
1001
  ];
829
1002
  }
830
1003
  //# sourceMappingURL=directory-tools.js.map