@roarkanalytics/sdk-mcp 4.44.2 → 4.44.4

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 (69) hide show
  1. package/CHANGELOG.md +14 -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/directory-output-schemas.d.mts +139 -0
  7. package/directory-output-schemas.d.mts.map +1 -0
  8. package/directory-output-schemas.d.ts +139 -0
  9. package/directory-output-schemas.d.ts.map +1 -0
  10. package/directory-output-schemas.js +191 -0
  11. package/directory-output-schemas.js.map +1 -0
  12. package/directory-output-schemas.mjs +188 -0
  13. package/directory-output-schemas.mjs.map +1 -0
  14. package/directory-tools.d.mts.map +1 -1
  15. package/directory-tools.d.ts.map +1 -1
  16. package/directory-tools.js +232 -111
  17. package/directory-tools.js.map +1 -1
  18. package/directory-tools.mjs +232 -111
  19. package/directory-tools.mjs.map +1 -1
  20. package/docs-search-tool.d.mts.map +1 -1
  21. package/docs-search-tool.d.ts.map +1 -1
  22. package/docs-search-tool.js +6 -3
  23. package/docs-search-tool.js.map +1 -1
  24. package/docs-search-tool.mjs +6 -3
  25. package/docs-search-tool.mjs.map +1 -1
  26. package/http.d.mts.map +1 -1
  27. package/http.d.ts.map +1 -1
  28. package/http.js +8 -7
  29. package/http.js.map +1 -1
  30. package/http.mjs +9 -8
  31. package/http.mjs.map +1 -1
  32. package/oauth.d.mts +16 -1
  33. package/oauth.d.mts.map +1 -1
  34. package/oauth.d.ts +16 -1
  35. package/oauth.d.ts.map +1 -1
  36. package/oauth.js +24 -1
  37. package/oauth.js.map +1 -1
  38. package/oauth.mjs +22 -0
  39. package/oauth.mjs.map +1 -1
  40. package/options.d.mts +10 -0
  41. package/options.d.mts.map +1 -1
  42. package/options.d.ts +10 -0
  43. package/options.d.ts.map +1 -1
  44. package/options.js +28 -3
  45. package/options.js.map +1 -1
  46. package/options.mjs +26 -3
  47. package/options.mjs.map +1 -1
  48. package/package.json +11 -1
  49. package/server.d.mts.map +1 -1
  50. package/server.d.ts.map +1 -1
  51. package/server.js +8 -1
  52. package/server.js.map +1 -1
  53. package/server.mjs +8 -1
  54. package/server.mjs.map +1 -1
  55. package/src/client-headers.ts +1 -1
  56. package/src/directory-output-schemas.ts +240 -0
  57. package/src/directory-tools.ts +267 -97
  58. package/src/docs-search-tool.ts +9 -3
  59. package/src/http.ts +9 -7
  60. package/src/oauth.ts +28 -1
  61. package/src/options.ts +27 -3
  62. package/src/server.ts +9 -1
  63. package/src/types.ts +1 -0
  64. package/types.d.mts +1 -0
  65. package/types.d.mts.map +1 -1
  66. package/types.d.ts +1 -0
  67. package/types.d.ts.map +1 -1
  68. package/types.js.map +1 -1
  69. package/types.mjs.map +1 -1
@@ -0,0 +1,240 @@
1
+ // Output schemas for the directory tools. Not generated.
2
+ //
3
+ // Each tool returns the customer-api response body as structuredContent, so each
4
+ // schema describes that body: `data`, plus `pagination` on list endpoints. The
5
+ // field types follow the published SDK response types.
6
+ //
7
+ // The schemas name the fields a caller acts on, not every field. They declare no
8
+ // enums and do not close objects with additionalProperties: false. Clients such
9
+ // as the MCP TypeScript SDK validate structuredContent against outputSchema and
10
+ // fail the call on a mismatch, so a new enum value or field added to the API must
11
+ // not turn a working tool call into an error.
12
+
13
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
14
+
15
+ type OutputSchema = NonNullable<Tool['outputSchema']>;
16
+ type Field = Record<string, unknown>;
17
+
18
+ const string = (description: string): Field => ({ type: 'string', description });
19
+ const nullableString = (description: string): Field => ({ type: ['string', 'null'], description });
20
+ const number = (description: string): Field => ({ type: 'number', description });
21
+ const boolean = (description: string): Field => ({ type: 'boolean', description });
22
+ const object = (description: string, properties: Record<string, Field> = {}): Field => ({
23
+ type: 'object',
24
+ description,
25
+ properties,
26
+ });
27
+ const nullableObject = (description: string): Field => ({ type: ['object', 'null'], description });
28
+ const array = (description: string, items: Field): Field => ({ type: 'array', description, items });
29
+
30
+ const timestamps = {
31
+ createdAt: string('When it was created, ISO 8601.'),
32
+ updatedAt: string('When it last changed, ISO 8601.'),
33
+ };
34
+
35
+ const paginationWithTotal = object('Paging state for this list.', {
36
+ hasMore: boolean('Whether more rows follow this page.'),
37
+ nextCursor: nullableString('Pass as after to get the next page. null on the last page.'),
38
+ total: number('Rows matching the request across all pages.'),
39
+ });
40
+
41
+ const paginationWithLimit = object('Paging state for this list.', {
42
+ hasMore: boolean('Whether more rows follow this page.'),
43
+ nextCursor: nullableString('Pass as after to get the next page. null on the last page.'),
44
+ limit: number('The page size used for this response.'),
45
+ });
46
+
47
+ const single = (item: Field): OutputSchema => ({
48
+ type: 'object',
49
+ properties: { data: item },
50
+ required: ['data'],
51
+ });
52
+
53
+ const list = (description: string, item: Field, pagination: Field): OutputSchema => ({
54
+ type: 'object',
55
+ properties: { data: array(description, item), pagination },
56
+ required: ['data'],
57
+ });
58
+
59
+ const agent = object('An agent.', {
60
+ id: string('Agent id.'),
61
+ name: string('Agent name.'),
62
+ description: nullableString('What the agent does.'),
63
+ customId: nullableString('Caller-chosen id, unique in the project.'),
64
+ ...timestamps,
65
+ });
66
+
67
+ const agentEndpoint = object('An agent endpoint.', {
68
+ id: string('Agent endpoint id. run_simulation takes it in agentEndpoints.'),
69
+ agentId: string('The agent this endpoint reaches.'),
70
+ type: string('Transport, such as PHONE.'),
71
+ direction: string('INCOMING, OUTGOING, or INCOMING_AND_OUTGOING.'),
72
+ value: string('The address Roark connects to, such as an E.164 phone number.'),
73
+ environment: string('Environment name, such as production.'),
74
+ outboundDialType: string('How Roark starts an outbound call: NONE or HTTP_REQUEST.'),
75
+ outboundDialHttpRequestDefinitionId: nullableString(
76
+ 'The HTTP request definition used when outboundDialType is HTTP_REQUEST.',
77
+ ),
78
+ ...timestamps,
79
+ });
80
+
81
+ const call = object('A call.', {
82
+ id: string('Call id. get_call, get_call_transcript, and list_call_metrics take it as callId.'),
83
+ projectId: string('Project the call belongs to.'),
84
+ title: nullableString('Call title.'),
85
+ status: nullableString('RINGING, IN_PROGRESS, or ENDED.'),
86
+ callDirection: string('INBOUND or OUTBOUND.'),
87
+ startedAt: string('When the call started, ISO 8601.'),
88
+ endedAt: nullableString('When the call ended, ISO 8601. null while it is in progress.'),
89
+ durationMs: { type: ['number', 'null'], description: 'Call length in milliseconds.' },
90
+ summary: nullableString('Generated summary of the call.'),
91
+ simulationJobId: nullableString('The simulated call that produced it. null for a live call.'),
92
+ });
93
+
94
+ const persona = object('A simulated caller persona.', {
95
+ id: string('Persona id. create_customer_flow takes it as personaOverrideId.'),
96
+ name: string('Name the caller uses in conversation.'),
97
+ language: string('Primary spoken language.'),
98
+ accent: string('Accent the persona is voiced with.'),
99
+ gender: string('Gender the persona is voiced with.'),
100
+ age: string('How old the caller sounds.'),
101
+ baseEmotion: string('Emotional baseline.'),
102
+ backstoryPrompt: nullableString('Background and behavior the simulated caller plays.'),
103
+ description: nullableString('Short label for the persona.'),
104
+ ...timestamps,
105
+ });
106
+
107
+ const customerFlow = object('A customer flow.', {
108
+ id: string('Customer flow id. run_simulation takes it in flows.'),
109
+ title: string('Flow title.'),
110
+ type: string('SCRIPTED, IMPROV, or VOICEMAIL.'),
111
+ source: string('CUSTOM for flows made in the project, SYSTEM for flows Roark provides.'),
112
+ description: nullableString('What the conversation covers.'),
113
+ agents: array('Agents the flow exercises.', object('An agent the flow exercises.')),
114
+ happyPath: nullableObject('The way the conversation is meant to go.'),
115
+ edgeCases: array('Other ways of running the flow.', object('An edge case.')),
116
+ ...timestamps,
117
+ });
118
+
119
+ const environment = object('A call environment.', {
120
+ id: string('Environment id. create_customer_flow takes it as environmentId.'),
121
+ name: string('Environment name.'),
122
+ description: nullableString('What the environment simulates.'),
123
+ backgroundNoise: string('Background noise played into the call, or NONE.'),
124
+ backgroundNoiseVolume: number('Background noise volume.'),
125
+ ...timestamps,
126
+ });
127
+
128
+ const metricDefinition = object('A metric the project can score.', {
129
+ id: string('Metric definition id.'),
130
+ metricId: string('Same value as slug, kept for backwards compatibility.'),
131
+ slug: string('Metric slug. run_simulation takes it in plan.metrics.'),
132
+ name: string('Metric name.'),
133
+ description: string('What the metric measures.'),
134
+ type: string('Value type, such as BOOLEAN, NUMERIC, or SCALE.'),
135
+ calculationType: string('How the value is computed, such as LLM_JUDGE or FORMULA.'),
136
+ scope: string('GLOBAL for the whole call, PER_PARTICIPANT for each participant.'),
137
+ });
138
+
139
+ const callMetric = object(
140
+ 'A metric scored on the call. Grouped rows carry a values array. With flatten true, each row is one score and carries value, captureStatus, and the other value fields directly.',
141
+ {
142
+ metricDefinitionId: string('Metric definition id.'),
143
+ metricId: string('Same value as slug, kept for backwards compatibility.'),
144
+ slug: string('Metric slug.'),
145
+ name: string('Metric name.'),
146
+ description: string('What the metric measures.'),
147
+ type: string('Value type, such as BOOLEAN, NUMERIC, or SCALE.'),
148
+ scope: string('GLOBAL for the whole call, PER_PARTICIPANT for each participant.'),
149
+ },
150
+ );
151
+
152
+ export const directoryOutputSchemas = {
153
+ listProjects: single(
154
+ object('Projects this credential can use.', {
155
+ projects: array(
156
+ 'One entry per project.',
157
+ object('A project.', {
158
+ id: string('Project id. Other tools take it as project.'),
159
+ name: string('Project name.'),
160
+ slug: string('Project slug.'),
161
+ grantedPermissions: array(
162
+ 'Permissions this credential holds in the project.',
163
+ string('A permission.'),
164
+ ),
165
+ organization: object('The organization that owns the project.', {
166
+ id: string('Organization id.'),
167
+ name: string('Organization name.'),
168
+ }),
169
+ }),
170
+ ),
171
+ }),
172
+ ),
173
+ listAgents: list('Agents on this page.', agent, paginationWithTotal),
174
+ listAgentEndpoints: list('Agent endpoints on this page.', agentEndpoint, paginationWithTotal),
175
+ listCalls: list('Calls on this page.', call, paginationWithTotal),
176
+ getCall: single(call),
177
+ getCallTranscript: single(
178
+ object('The transcript.', {
179
+ transcriptionSource: nullableString('Which transcription this is.'),
180
+ participants: array(
181
+ 'Who spoke on the call.',
182
+ object('A participant.', {
183
+ id: string('Participant id. Transcript entries refer to it as participantId.'),
184
+ type: string('AGENT, CUSTOMER, SIMULATED_CUSTOMER, or BACKGROUND_SPEAKER.'),
185
+ }),
186
+ ),
187
+ entries: array(
188
+ 'Turns in the order they were spoken.',
189
+ object('One turn.', {
190
+ participantId: nullableString('The participant who spoke.'),
191
+ role: nullableString('AGENT or CUSTOMER.'),
192
+ text: string('What was said.'),
193
+ startOffsetMs: number('Start of the turn, in milliseconds from the start of the call.'),
194
+ endOffsetMs: number('End of the turn, in milliseconds from the start of the call.'),
195
+ }),
196
+ ),
197
+ }),
198
+ ),
199
+ listCallMetrics: single(array('Metric scores for the call.', callMetric)),
200
+ listMetricDefinitions: list('Metric definitions on this page.', metricDefinition, paginationWithLimit),
201
+ getSimulationResults: single(
202
+ object('Results of the simulation run.', {
203
+ run: object('The run: ids, status, run number, and start and end times.'),
204
+ summary: object('Call counts, pass rates, and the run score, over the calls finished so far.'),
205
+ verdict: nullableObject(
206
+ 'Pass or fail for the run, judged against the success criteria pinned on the plan. null until the run ends.',
207
+ ),
208
+ metrics: array('Aggregate for each metric, checks first.', object('One metric aggregate.')),
209
+ calls: array('The simulated calls and their checks.', object('One simulated call.')),
210
+ comparison: nullableObject('Comparison with an earlier run of the plan. null when there is none.'),
211
+ attemptSummary: object(
212
+ 'Simulations placed against test cases. Differs from the call count only when the plan retried calls the agent never spoke on.',
213
+ ),
214
+ breakdowns: object('Pass rates and scores grouped by agent and by persona.'),
215
+ debrief: nullableObject(
216
+ 'Executive summary, failure themes, and recommendations. Generated when a run with graded calls settles.',
217
+ ),
218
+ sweepAttribution: nullableObject(
219
+ 'For a run that swept a property, such as accent or background noise: which check failures that property caused.',
220
+ ),
221
+ }),
222
+ ),
223
+ listPersonas: list('Personas on this page.', persona, paginationWithTotal),
224
+ listCustomerFlows: list('Customer flows on this page.', customerFlow, paginationWithTotal),
225
+ listSimulationEnvironments: list('Environments on this page.', environment, paginationWithTotal),
226
+ createAgent: single(agent),
227
+ createAgentEndpoint: single(agentEndpoint),
228
+ createPersona: single(persona),
229
+ createCustomerFlow: single(customerFlow),
230
+ runSimulation: single(
231
+ object('The started run.', {
232
+ simulationRunPlanJobId: string('Run id. get_simulation_results takes it as jobId.'),
233
+ simulationRunPlanId: string('The plan the run executes.'),
234
+ status: string('Run status, such as PENDING or RUNNING_SIMULATIONS.'),
235
+ simulationJobCount: number('How many simulated calls this run places.'),
236
+ savedAsPlan: boolean('Whether the plan was kept so it can be run again by planId.'),
237
+ createdAt: string('When the run was created, ISO 8601.'),
238
+ }),
239
+ ),
240
+ };