sipgate-mcp 0.5.2 → 0.6.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.
@@ -93,6 +93,7 @@ const historyTypes = z.array(z.enum(["CALL", "VOICEMAIL", "SMS", "FAX"])).min(1)
93
93
  const historyDirections = z.array(z.enum(["INCOMING", "OUTGOING", "MISSED_INCOMING", "MISSED_OUTGOING"])).min(1).optional();
94
94
  const historyStarred = z.array(z.enum(["STARRED", "UNSTARRED"])).min(1).optional();
95
95
  const callRestriction = id.describe("Call restriction name, for example roaming");
96
+ const phonelineId = id.describe("Phoneline ID returned by list_phonelines, for example p0");
96
97
  function define(options) {
97
98
  return {
98
99
  name: options.name,
@@ -102,8 +103,23 @@ function define(options) {
102
103
  execute: async (input) => options.execute(options.schema.parse(input)),
103
104
  };
104
105
  }
105
- export function createToolDefinitions(backend, readonly = false, accessScope = "user") {
106
+ export function createToolDefinitions(backend, readonly = false, accessScope = "user", authenticatedUserId) {
106
107
  const userScoped = accessScope === "user";
108
+ /**
109
+ * In user scope the authenticated user is the only permitted value, so the
110
+ * ID defaults to it before anything is delegated. An explicit foreign ID is
111
+ * passed on unchanged for the access layer to reject; account scope keeps
112
+ * the ID required.
113
+ */
114
+ const userIdField = (accountDescription) => {
115
+ if (!userScoped)
116
+ return id.describe(accountDescription);
117
+ if (authenticatedUserId === undefined) {
118
+ return id.describe("Authenticated sipgate user ID; another user's ID is rejected");
119
+ }
120
+ return id.default(authenticatedUserId)
121
+ .describe("Optional; defaults to the authenticated sipgate user. Another user's ID is rejected");
122
+ };
107
123
  const changeWarning = userScoped
108
124
  ? "CHANGES THE AUTHENTICATED USER'S SIPGATE ACCOUNT AND MAY INCUR CHARGES:"
109
125
  : "CHANGES THE SIPGATE ACCOUNT AND MAY INCUR CHARGES:";
@@ -179,14 +195,14 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
179
195
  execute: async ({ device_id }) => backend.getDeviceLocalPrefix(device_id),
180
196
  }),
181
197
  define({
182
- name: "get_device_tariff_announcement",
198
+ name: "get_tariff_announcement",
183
199
  description: "Get the tariff-announcement setting for one owned sipgate device.",
184
200
  schema: z.object({ device_id: id.describe("Device ID returned by list_devices") }),
185
201
  annotations: readAnnotations,
186
202
  execute: async ({ device_id }) => backend.getDeviceTariffAnnouncement(device_id),
187
203
  }),
188
204
  define({
189
- name: "get_device_single_row_display",
205
+ name: "get_single_row_display",
190
206
  description: "Get the single-row display setting for one owned sipgate device.",
191
207
  schema: z.object({ device_id: id.describe("Device ID returned by list_devices") }),
192
208
  annotations: readAnnotations,
@@ -196,9 +212,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
196
212
  name: "get_device_contingents",
197
213
  description: "List the booked and remaining contingents for one owned sipgate device.",
198
214
  schema: z.object({
199
- user_id: id.describe(userScoped
200
- ? "Authenticated sipgate user ID; another user's ID is rejected"
201
- : "Owner user ID, for example w0"),
215
+ user_id: userIdField("Owner user ID, for example w0"),
202
216
  device_id: id.describe("Device ID returned by list_devices"),
203
217
  }),
204
218
  annotations: readAnnotations,
@@ -208,9 +222,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
208
222
  name: "list_user_numbers",
209
223
  description: "List phone numbers from sipgate's documented user-specific numbers endpoint without using phonelines.",
210
224
  schema: z.object({
211
- user_id: id.describe(userScoped
212
- ? "Authenticated sipgate user ID; another user's ID is rejected"
213
- : "sipgate user ID, for example w0"),
225
+ user_id: userIdField("sipgate user ID, for example w0"),
214
226
  }),
215
227
  annotations: readAnnotations,
216
228
  execute: async ({ user_id }) => backend.getUserNumbers(user_id),
@@ -298,11 +310,9 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
298
310
  }),
299
311
  define({
300
312
  name: "list_notifications",
301
- description: "List call, fax, SMS, and voicemail notifications for one sipgate user.",
313
+ description: "List the call, fax, SMS, and voicemail notifications (email/SMS alerts created by the create_*_alert tools) of one sipgate user, including the notification IDs that delete_notification needs.",
302
314
  schema: z.object({
303
- user_id: id.describe(userScoped
304
- ? "Authenticated sipgate user ID; another user's ID is rejected"
305
- : "sipgate user ID, for example w0"),
315
+ user_id: userIdField("sipgate user ID, for example w0"),
306
316
  }),
307
317
  annotations: readAnnotations,
308
318
  execute: async ({ user_id }) => backend.listNotifications(user_id),
@@ -311,41 +321,46 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
311
321
  name: "list_faxlines",
312
322
  description: "List faxlines belonging to one sipgate user, including send/receive capability.",
313
323
  schema: z.object({
314
- user_id: id.describe(userScoped
315
- ? "Authenticated sipgate user ID; another user's ID is rejected"
316
- : "sipgate user ID, for example w0"),
324
+ user_id: userIdField("sipgate user ID, for example w0"),
317
325
  }),
318
326
  annotations: readAnnotations,
319
327
  execute: async ({ user_id }) => backend.listFaxlines(user_id),
320
328
  }),
321
329
  define({
322
330
  name: "list_faxline_numbers",
323
- description: "List phone numbers routed to an owned faxline.",
331
+ description: "List the phone numbers routed to one owned faxline, so senders know which number reaches it. Get faxline_id from list_faxlines.",
324
332
  schema: z.object({
325
- user_id: id.describe(userScoped
326
- ? "Authenticated sipgate user ID; another user's ID is rejected"
327
- : "Faxline owner user ID, for example w0"),
333
+ user_id: userIdField("Faxline owner user ID, for example w0"),
328
334
  faxline_id: id.describe("Faxline ID returned by list_faxlines"),
329
335
  }),
330
336
  annotations: readAnnotations,
331
337
  execute: async ({ user_id, faxline_id }) => backend.listFaxlineNumbers(user_id, faxline_id),
332
338
  }),
339
+ define({
340
+ name: "list_phonelines",
341
+ description: "List the phonelines (extensions with numbers, forwardings, and voicemail) of one sipgate user, with the phoneline IDs that the other phoneline tools need. Accounts without a phoneline layer return an empty list with phonelinesAvailable: false.",
342
+ schema: z.object({
343
+ user_id: userIdField("sipgate user ID, for example w0"),
344
+ }),
345
+ annotations: readAnnotations,
346
+ execute: async ({ user_id }) => backend.listPhonelines(user_id),
347
+ }),
333
348
  define({
334
349
  name: "get_phoneline",
335
350
  description: "Get one owned phoneline. Accounts without a phoneline layer return a clean unavailable result.",
336
351
  schema: z.object({
337
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
338
- phoneline_id: id.describe("Phoneline ID returned by get_routing or get_settings"),
352
+ user_id: userIdField("Owner user ID"),
353
+ phoneline_id: phonelineId,
339
354
  }),
340
355
  annotations: readAnnotations,
341
356
  execute: async ({ user_id, phoneline_id }) => backend.getPhoneline(user_id, phoneline_id),
342
357
  }),
343
358
  define({
344
- name: "get_phoneline_block_anonymous",
359
+ name: "get_anonymous_call_blocking",
345
360
  description: "Get anonymous-caller blocking for one owned phoneline, or report that phonelines are unavailable.",
346
361
  schema: z.object({
347
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
348
- phoneline_id: id,
362
+ user_id: userIdField("Owner user ID"),
363
+ phoneline_id: phonelineId,
349
364
  }),
350
365
  annotations: readAnnotations,
351
366
  execute: async ({ user_id, phoneline_id }) => backend.getPhonelineBlockAnonymous(user_id, phoneline_id),
@@ -354,8 +369,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
354
369
  name: "list_phoneline_devices",
355
370
  description: "List owned devices attached to one owned phoneline, or report that phonelines are unavailable.",
356
371
  schema: z.object({
357
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
358
- phoneline_id: id,
372
+ user_id: userIdField("Owner user ID"),
373
+ phoneline_id: phonelineId,
359
374
  }),
360
375
  annotations: readAnnotations,
361
376
  execute: async ({ user_id, phoneline_id }) => backend.listPhonelineDevices(user_id, phoneline_id),
@@ -364,8 +379,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
364
379
  name: "list_parallel_forwardings",
365
380
  description: "List parallel forwardings of one owned phoneline, or report that the feature is unavailable.",
366
381
  schema: z.object({
367
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
368
- phoneline_id: id,
382
+ user_id: userIdField("Owner user ID"),
383
+ phoneline_id: phonelineId,
369
384
  }),
370
385
  annotations: readAnnotations,
371
386
  execute: async ({ user_id, phoneline_id }) => backend.listParallelForwardings(user_id, phoneline_id),
@@ -374,8 +389,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
374
389
  name: "list_phoneline_voicemails",
375
390
  description: "List voicemail extensions belonging to one owned phoneline, or report that the feature is unavailable.",
376
391
  schema: z.object({
377
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
378
- phoneline_id: id,
392
+ user_id: userIdField("Owner user ID"),
393
+ phoneline_id: phonelineId,
379
394
  }),
380
395
  annotations: readAnnotations,
381
396
  execute: async ({ user_id, phoneline_id }) => backend.listPhonelineVoicemails(user_id, phoneline_id),
@@ -384,8 +399,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
384
399
  name: "list_voicemail_greetings",
385
400
  description: "List greetings belonging to an owned voicemail on an owned phoneline.",
386
401
  schema: z.object({
387
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
388
- phoneline_id: id,
402
+ user_id: userIdField("Owner user ID"),
403
+ phoneline_id: phonelineId,
389
404
  voicemail_id: id,
390
405
  }),
391
406
  annotations: readAnnotations,
@@ -423,9 +438,9 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
423
438
  }),
424
439
  define({
425
440
  name: "get_faxline_caller_id",
426
- description: "Get the caller ID configured for one owned faxline.",
441
+ description: "Get the outgoing caller ID (sender number) that one owned faxline shows to fax recipients. Get faxline_id from list_faxlines.",
427
442
  schema: z.object({
428
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
443
+ user_id: userIdField("Owner user ID"),
429
444
  faxline_id: id.describe("Faxline ID returned by list_faxlines"),
430
445
  }),
431
446
  annotations: readAnnotations,
@@ -531,7 +546,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
531
546
  name: "list_restrictions",
532
547
  description: "List product/action restrictions for one sipgate user. User scope only permits the authenticated user ID.",
533
548
  schema: z.object({
534
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "sipgate user ID"),
549
+ user_id: userIdField("sipgate user ID"),
535
550
  restrictions: z.array(swaggerString).min(1).optional(),
536
551
  }),
537
552
  annotations: readAnnotations,
@@ -547,7 +562,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
547
562
  types: historyTypes,
548
563
  directions: historyDirections,
549
564
  offset: z.int().min(0).default(0),
550
- limit: z.int().min(0).max(1000).default(1000),
565
+ limit: z.int().min(1).max(1000).default(1000),
551
566
  archived: z.boolean().optional(),
552
567
  starred: historyStarred,
553
568
  from: isoDateTime.optional(),
@@ -818,10 +833,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
818
833
  name: "set_forwarding",
819
834
  description: `${changeWarning} replace all forwardings for a phoneline, including timeout routing. Pass [] to delete all forwardings. Returns before/after state.`,
820
835
  schema: z.object({
821
- user_id: id.describe(userScoped
822
- ? "Authenticated sipgate user ID; another user's ID is rejected"
823
- : "Owner user ID, for example w0"),
824
- phoneline_id: id.describe("Phoneline ID, for example p0"),
836
+ user_id: userIdField("Owner user ID, for example w0"),
837
+ phoneline_id: phonelineId,
825
838
  forwardings: z.array(z.object({
826
839
  active: z.boolean().default(true),
827
840
  destination: e164,
@@ -835,7 +848,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
835
848
  name: "create_phoneline",
836
849
  description: `${changeWarning} create a phoneline for the authenticated user. Provisioning may affect billing; returns before: null and the initial state, or a clean unavailable result.`,
837
850
  schema: z.object({
838
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
851
+ user_id: userIdField("Owner user ID"),
839
852
  }),
840
853
  annotations: actionAnnotations,
841
854
  execute: async ({ user_id }) => backend.createPhoneline(user_id),
@@ -844,8 +857,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
844
857
  name: "update_phoneline_alias",
845
858
  description: `${changeWarning} update an owned phoneline alias. Returns before/after state or a clean unavailable result.`,
846
859
  schema: z.object({
847
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
848
- phoneline_id: id,
860
+ user_id: userIdField("Owner user ID"),
861
+ phoneline_id: phonelineId,
849
862
  alias: swaggerString.optional(),
850
863
  }),
851
864
  annotations: writeAnnotations,
@@ -855,18 +868,18 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
855
868
  name: "delete_phoneline",
856
869
  description: `${changeWarning} permanently delete an owned phoneline. Returns its previous state and a deletion marker, or a clean unavailable result.`,
857
870
  schema: z.object({
858
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
859
- phoneline_id: id,
871
+ user_id: userIdField("Owner user ID"),
872
+ phoneline_id: phonelineId,
860
873
  }),
861
874
  annotations: writeAnnotations,
862
875
  execute: async ({ user_id, phoneline_id }) => backend.deletePhoneline(user_id, phoneline_id),
863
876
  }),
864
877
  define({
865
- name: "set_phoneline_block_anonymous",
878
+ name: "set_anonymous_call_blocking",
866
879
  description: `${changeWarning} configure anonymous-caller rejection or voicemail routing on an owned phoneline. Returns before/after state.`,
867
880
  schema: z.object({
868
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
869
- phoneline_id: id,
881
+ user_id: userIdField("Owner user ID"),
882
+ phoneline_id: phonelineId,
870
883
  enabled: z.boolean().optional(),
871
884
  target: z.enum(["REJECT", "VOICEMAIL"]).optional(),
872
885
  }),
@@ -880,8 +893,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
880
893
  name: "attach_device_to_phoneline",
881
894
  description: `${changeWarning} attach an owned device to an owned phoneline. Returns the complete before/after device assignment.`,
882
895
  schema: z.object({
883
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
884
- phoneline_id: id,
896
+ user_id: userIdField("Owner user ID"),
897
+ phoneline_id: phonelineId,
885
898
  device_id: id.describe("Owned device ID returned by list_devices"),
886
899
  }),
887
900
  annotations: actionAnnotations,
@@ -891,8 +904,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
891
904
  name: "detach_device_from_phoneline",
892
905
  description: `${changeWarning} detach an owned device from an owned phoneline. Returns the complete before/after device assignment.`,
893
906
  schema: z.object({
894
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
895
- phoneline_id: id,
907
+ user_id: userIdField("Owner user ID"),
908
+ phoneline_id: phonelineId,
896
909
  device_id: id.describe("Owned device ID returned by list_phoneline_devices"),
897
910
  }),
898
911
  annotations: writeAnnotations,
@@ -902,8 +915,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
902
915
  name: "create_parallel_forwarding",
903
916
  description: `${changeWarning} create a parallel forwarding on an owned phoneline. Returns the complete before/after forwarding list.`,
904
917
  schema: z.object({
905
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
906
- phoneline_id: id,
918
+ user_id: userIdField("Owner user ID"),
919
+ phoneline_id: phonelineId,
907
920
  active: z.boolean().optional(),
908
921
  alias: swaggerString.optional(),
909
922
  destination: swaggerString.optional(),
@@ -919,8 +932,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
919
932
  name: "update_parallel_forwarding",
920
933
  description: `${changeWarning} update a parallel forwarding belonging to an owned phoneline. Returns the complete before/after forwarding list.`,
921
934
  schema: z.object({
922
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
923
- phoneline_id: id,
935
+ user_id: userIdField("Owner user ID"),
936
+ phoneline_id: phonelineId,
924
937
  parallel_forwarding_id: id,
925
938
  active: z.boolean().optional(),
926
939
  alias: swaggerString.optional(),
@@ -937,8 +950,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
937
950
  name: "delete_parallel_forwarding",
938
951
  description: `${changeWarning} delete a parallel forwarding belonging to an owned phoneline. Returns the complete before/after forwarding list.`,
939
952
  schema: z.object({
940
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
941
- phoneline_id: id,
953
+ user_id: userIdField("Owner user ID"),
954
+ phoneline_id: phonelineId,
942
955
  parallel_forwarding_id: id,
943
956
  }),
944
957
  annotations: writeAnnotations,
@@ -948,8 +961,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
948
961
  name: "update_voicemail",
949
962
  description: `${changeWarning} update an owned phoneline voicemail's active, timeout, and transcription settings. Returns before/after voicemail lists.`,
950
963
  schema: z.object({
951
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
952
- phoneline_id: id,
964
+ user_id: userIdField("Owner user ID"),
965
+ phoneline_id: phonelineId,
953
966
  voicemail_id: id,
954
967
  active: z.boolean(),
955
968
  transcription: z.boolean(),
@@ -966,8 +979,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
966
979
  name: "create_voicemail_greeting",
967
980
  description: `${changeWarning} upload a greeting for an owned phoneline voicemail. Returns the complete before/after greeting list.`,
968
981
  schema: z.object({
969
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
970
- phoneline_id: id,
982
+ user_id: userIdField("Owner user ID"),
983
+ phoneline_id: phonelineId,
971
984
  voicemail_id: id,
972
985
  base64_content: z.string().max(15_000_000).optional(),
973
986
  filename: swaggerString.optional(),
@@ -982,8 +995,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
982
995
  name: "update_voicemail_greeting",
983
996
  description: `${changeWarning} activate or deactivate a greeting belonging to an owned phoneline voicemail. Returns the complete before/after greeting list.`,
984
997
  schema: z.object({
985
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
986
- phoneline_id: id,
998
+ user_id: userIdField("Owner user ID"),
999
+ phoneline_id: phonelineId,
987
1000
  voicemail_id: id,
988
1001
  greeting_id: id,
989
1002
  active: z.boolean().optional(),
@@ -995,8 +1008,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
995
1008
  name: "delete_voicemail_greeting",
996
1009
  description: `${changeWarning} delete a greeting belonging to an owned phoneline voicemail. Returns the complete before/after greeting list.`,
997
1010
  schema: z.object({
998
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
999
- phoneline_id: id,
1011
+ user_id: userIdField("Owner user ID"),
1012
+ phoneline_id: phonelineId,
1000
1013
  voicemail_id: id,
1001
1014
  greeting_id: id,
1002
1015
  }),
@@ -1007,8 +1020,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1007
1020
  name: "set_voicemail_transcription",
1008
1021
  description: `${changeWarning} enable or disable transcription for an owned phoneline voicemail. Transcription availability and pricing depend on the account. Returns before/after voicemail lists.`,
1009
1022
  schema: z.object({
1010
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1011
- phoneline_id: id,
1023
+ user_id: userIdField("Owner user ID"),
1024
+ phoneline_id: phonelineId,
1012
1025
  voicemail_id: id,
1013
1026
  active: z.boolean().optional(),
1014
1027
  }),
@@ -1044,7 +1057,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1044
1057
  }),
1045
1058
  }),
1046
1059
  define({
1047
- name: "create_autorecording_greeting",
1060
+ name: "create_recording_greeting",
1048
1061
  description: `${changeWarning} replace the account-wide automated call-recording announcement. This resource has no user ownership link and therefore requires administrator account scope. Call recording may incur charges; the caller is responsible for obtaining every participant's consent. Returns before/after greeting state.`,
1049
1062
  schema: z.object({
1050
1063
  base64_content: z.string().max(15_000_000).optional(),
@@ -1057,7 +1070,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1057
1070
  }),
1058
1071
  }),
1059
1072
  define({
1060
- name: "delete_autorecording_greeting",
1073
+ name: "delete_recording_greeting",
1061
1074
  description: `${changeWarning} delete the account-wide automated call-recording announcement. This resource has no user ownership link and therefore requires administrator account scope. Call recording may incur charges; the caller is responsible for obtaining every participant's consent. Returns previous state and a deletion marker.`,
1062
1075
  schema: z.object({ greeting_id: id }),
1063
1076
  annotations: writeAnnotations,
@@ -1077,7 +1090,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1077
1090
  name: "create_faxline",
1078
1091
  description: `${changeWarning} create a faxline for the authenticated user. Provisioning may affect billing; returns before: null and the initial state.`,
1079
1092
  schema: z.object({
1080
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1093
+ user_id: userIdField("Owner user ID"),
1081
1094
  }),
1082
1095
  annotations: actionAnnotations,
1083
1096
  execute: async ({ user_id }) => backend.createFaxline(user_id),
@@ -1086,7 +1099,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1086
1099
  name: "update_faxline_alias",
1087
1100
  description: `${changeWarning} update the alias of an owned faxline. Returns before/after faxline state.`,
1088
1101
  schema: z.object({
1089
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1102
+ user_id: userIdField("Owner user ID"),
1090
1103
  faxline_id: id,
1091
1104
  alias: swaggerString.optional(),
1092
1105
  }),
@@ -1097,7 +1110,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1097
1110
  name: "delete_faxline",
1098
1111
  description: `${changeWarning} permanently delete an owned faxline. Returns its previous state and a deletion marker.`,
1099
1112
  schema: z.object({
1100
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1113
+ user_id: userIdField("Owner user ID"),
1101
1114
  faxline_id: id,
1102
1115
  }),
1103
1116
  annotations: writeAnnotations,
@@ -1107,7 +1120,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1107
1120
  name: "set_faxline_caller_id",
1108
1121
  description: `${changeWarning} set an owned faxline's caller ID to an owned phone number. Returns before/after caller-ID state.`,
1109
1122
  schema: z.object({
1110
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1123
+ user_id: userIdField("Owner user ID"),
1111
1124
  faxline_id: id,
1112
1125
  value: swaggerString.optional(),
1113
1126
  }),
@@ -1118,7 +1131,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1118
1131
  name: "set_faxline_tagline",
1119
1132
  description: `${changeWarning} update the tagline of an owned faxline. Returns before/after faxline state.`,
1120
1133
  schema: z.object({
1121
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1134
+ user_id: userIdField("Owner user ID"),
1122
1135
  faxline_id: id,
1123
1136
  value: swaggerString.optional(),
1124
1137
  }),
@@ -1191,7 +1204,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1191
1204
  }),
1192
1205
  }),
1193
1206
  define({
1194
- name: "set_device_tariff_announcement",
1207
+ name: "set_tariff_announcement",
1195
1208
  description: `${changeWarning} update the tariff-announcement setting for an owned device. Returns before/after state.`,
1196
1209
  schema: z.object({
1197
1210
  device_id: id.describe("Device ID returned by list_devices"),
@@ -1201,7 +1214,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1201
1214
  execute: async ({ device_id, enabled }) => backend.setDeviceTariffAnnouncement(device_id, enabled),
1202
1215
  }),
1203
1216
  define({
1204
- name: "set_device_single_row_display",
1217
+ name: "set_single_row_display",
1205
1218
  description: `${changeWarning} update the single-row display setting for an owned device. Returns before/after state.`,
1206
1219
  schema: z.object({
1207
1220
  device_id: id.describe("Device ID returned by list_devices"),
@@ -1211,7 +1224,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1211
1224
  execute: async ({ device_id, enabled }) => backend.setDeviceSingleRowDisplay(device_id, enabled),
1212
1225
  }),
1213
1226
  define({
1214
- name: "set_external_device_target_number",
1227
+ name: "set_external_device_target",
1215
1228
  description: `${changeWarning} update the target phone number of an owned external device. Returns before/after device state.`,
1216
1229
  schema: z.object({
1217
1230
  device_id: id.describe("External device ID returned by list_devices"),
@@ -1221,8 +1234,8 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1221
1234
  execute: async ({ device_id, number }) => backend.setExternalDeviceTargetNumber(device_id, number),
1222
1235
  }),
1223
1236
  define({
1224
- name: "set_external_device_incoming_call_display",
1225
- description: `${changeWarning} choose whether an owned external device sees the called or caller number. Returns before/after device state.`,
1237
+ name: "set_external_device_display",
1238
+ description: `${changeWarning} choose whether an owned external device (a forwarding target such as a mobile phone) displays the called sipgate number or the caller's number for incoming calls. Returns before/after device state.`,
1226
1239
  schema: z.object({
1227
1240
  device_id: id.describe("External device ID returned by list_devices"),
1228
1241
  incoming_call_display: z.enum(["CALLED_NUMBER", "CALLER_NUMBER"]),
@@ -1241,7 +1254,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1241
1254
  name: "create_register_device",
1242
1255
  description: `${changeWarning} create a SIP register device; device creation may affect billing. Returns the sanitized initial device state.`,
1243
1256
  schema: z.object({
1244
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1257
+ user_id: userIdField("Owner user ID"),
1245
1258
  alias: swaggerString.optional(),
1246
1259
  }),
1247
1260
  annotations: actionAnnotations,
@@ -1251,7 +1264,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1251
1264
  name: "create_mobile_device",
1252
1265
  description: `${changeWarning} create a mobile device; device or SIM provisioning may affect billing. Returns the sanitized initial device state.`,
1253
1266
  schema: z.object({
1254
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1267
+ user_id: userIdField("Owner user ID"),
1255
1268
  alias: swaggerString.optional(),
1256
1269
  }),
1257
1270
  annotations: actionAnnotations,
@@ -1261,7 +1274,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1261
1274
  name: "create_external_device",
1262
1275
  description: `${changeWarning} create an external device; device provisioning or calls may affect billing. Returns the sanitized initial device state.`,
1263
1276
  schema: z.object({
1264
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1277
+ user_id: userIdField("Owner user ID"),
1265
1278
  alias: swaggerString.optional(),
1266
1279
  number: swaggerString.optional().describe("External target phone number"),
1267
1280
  }),
@@ -1272,7 +1285,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1272
1285
  name: "create_quick_dial",
1273
1286
  description: `${changeWarning} create a quick-dial number for a sipgate user. The API has no documented read-back response.`,
1274
1287
  schema: z.object({
1275
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1288
+ user_id: userIdField("Owner user ID"),
1276
1289
  number: swaggerString.optional().describe("Quick-dial number"),
1277
1290
  }),
1278
1291
  annotations: actionAnnotations,
@@ -1286,7 +1299,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1286
1299
  description: `${changeWarning} update an owned quick-dial number and its assigned user. Returns before/after state.`,
1287
1300
  schema: z.object({
1288
1301
  quick_dial_id: id.describe("Quick-dial ID returned by list_user_numbers or list_numbers"),
1289
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1302
+ user_id: userIdField("Owner user ID"),
1290
1303
  number: swaggerString.optional().describe("Quick-dial number"),
1291
1304
  }),
1292
1305
  annotations: writeAnnotations,
@@ -1332,9 +1345,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1332
1345
  name: "send_sms",
1333
1346
  description: `${changeWarning} send an SMS after verifying an SMS-capable extension. Returns a before/after history snapshot; history can update asynchronously.`,
1334
1347
  schema: z.object({
1335
- user_id: id.describe(userScoped
1336
- ? "Authenticated sipgate user ID; another user's ID is rejected"
1337
- : "Owner of the SMS extension"),
1348
+ user_id: userIdField("Owner of the SMS extension"),
1338
1349
  sms_id: id.optional().describe("SMS extension ID; the first available extension is used when omitted"),
1339
1350
  recipient: e164,
1340
1351
  message: z.string().min(1),
@@ -1367,10 +1378,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1367
1378
  }),
1368
1379
  }),
1369
1380
  define({
1370
- name: "create_call_email_notification",
1371
- description: `${changeWarning} create an email notification for calls on an owned endpoint. Returns the complete before/after notification state.`,
1381
+ name: "create_call_email_alert",
1382
+ description: `${changeWarning} create an email notification for calls on an owned endpoint. Returns the complete before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1372
1383
  schema: z.object({
1373
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1384
+ user_id: userIdField("Owner user ID"),
1374
1385
  endpoint_id: id.describe("Owned device or phoneline ID"),
1375
1386
  cause: z.enum(["MISSED", "SUCCESSFUL"]),
1376
1387
  direction: z.enum(["INCOMING", "OUTGOING"]),
@@ -1386,10 +1397,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1386
1397
  }),
1387
1398
  }),
1388
1399
  define({
1389
- name: "create_call_sms_notification",
1390
- description: `${changeWarning} create an SMS notification for calls on an owned endpoint. Returns the complete before/after notification state.`,
1400
+ name: "create_call_sms_alert",
1401
+ description: `${changeWarning} create an SMS notification for calls on an owned endpoint. Returns the complete before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1391
1402
  schema: z.object({
1392
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1403
+ user_id: userIdField("Owner user ID"),
1393
1404
  endpoint_id: id.describe("Owned device or phoneline ID"),
1394
1405
  cause: z.enum(["MISSED", "SUCCESSFUL"]),
1395
1406
  direction: z.enum(["INCOMING", "OUTGOING"]),
@@ -1405,10 +1416,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1405
1416
  }),
1406
1417
  }),
1407
1418
  define({
1408
- name: "create_fax_email_notification",
1409
- description: `${changeWarning} create an email notification for incoming or outgoing faxes on an owned faxline. Returns before/after notification state.`,
1419
+ name: "create_fax_email_alert",
1420
+ description: `${changeWarning} create an email notification for incoming or outgoing faxes on an owned faxline. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1410
1421
  schema: z.object({
1411
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1422
+ user_id: userIdField("Owner user ID"),
1412
1423
  faxline_id: id.describe("Faxline ID returned by list_faxlines"),
1413
1424
  direction: z.enum(["INCOMING", "OUTGOING"]),
1414
1425
  email: swaggerString,
@@ -1422,10 +1433,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1422
1433
  }),
1423
1434
  }),
1424
1435
  define({
1425
- name: "create_fax_sms_notification",
1426
- description: `${changeWarning} create an SMS notification for incoming or outgoing faxes on an owned faxline. Returns before/after notification state.`,
1436
+ name: "create_fax_sms_alert",
1437
+ description: `${changeWarning} create an SMS notification for incoming or outgoing faxes on an owned faxline. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1427
1438
  schema: z.object({
1428
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1439
+ user_id: userIdField("Owner user ID"),
1429
1440
  faxline_id: id.describe("Faxline ID returned by list_faxlines"),
1430
1441
  direction: z.enum(["INCOMING", "OUTGOING"]),
1431
1442
  number: e164,
@@ -1439,10 +1450,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1439
1450
  }),
1440
1451
  }),
1441
1452
  define({
1442
- name: "create_fax_report_notification",
1443
- description: `${changeWarning} create an email delivery-report notification for an owned faxline. Returns before/after notification state.`,
1453
+ name: "create_fax_report_alert",
1454
+ description: `${changeWarning} create an email delivery-report notification for an owned faxline. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1444
1455
  schema: z.object({
1445
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1456
+ user_id: userIdField("Owner user ID"),
1446
1457
  faxline_id: id.describe("Faxline ID returned by list_faxlines"),
1447
1458
  email: swaggerString,
1448
1459
  }),
@@ -1454,10 +1465,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1454
1465
  }),
1455
1466
  }),
1456
1467
  define({
1457
- name: "create_sms_email_notification",
1458
- description: `${changeWarning} create an email notification for incoming SMS on a user SMS endpoint. Returns before/after notification state.`,
1468
+ name: "create_sms_email_alert",
1469
+ description: `${changeWarning} create an email notification for incoming SMS on a user SMS endpoint. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1459
1470
  schema: z.object({
1460
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1471
+ user_id: userIdField("Owner user ID"),
1461
1472
  endpoint_id: id.describe("SMS endpoint ID, for example y0"),
1462
1473
  email: swaggerString,
1463
1474
  }),
@@ -1469,10 +1480,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1469
1480
  }),
1470
1481
  }),
1471
1482
  define({
1472
- name: "create_voicemail_email_notification",
1473
- description: `${changeWarning} create an email notification for a user voicemail. Returns before/after notification state.`,
1483
+ name: "create_voicemail_email_alert",
1484
+ description: `${changeWarning} create an email notification for a user voicemail. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1474
1485
  schema: z.object({
1475
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1486
+ user_id: userIdField("Owner user ID"),
1476
1487
  voicemail_id: id.describe("Voicemail ID, for example v0"),
1477
1488
  email: swaggerString,
1478
1489
  }),
@@ -1484,10 +1495,10 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1484
1495
  }),
1485
1496
  }),
1486
1497
  define({
1487
- name: "create_voicemail_sms_notification",
1488
- description: `${changeWarning} create an SMS notification for a user voicemail. Returns before/after notification state.`,
1498
+ name: "create_voicemail_sms_alert",
1499
+ description: `${changeWarning} create an SMS notification for a user voicemail. Returns before/after notification state. It then appears in list_notifications and can be removed with delete_notification.`,
1489
1500
  schema: z.object({
1490
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1501
+ user_id: userIdField("Owner user ID"),
1491
1502
  voicemail_id: id.describe("Voicemail ID, for example v0"),
1492
1503
  number: e164,
1493
1504
  }),
@@ -1502,7 +1513,7 @@ export function createToolDefinitions(backend, readonly = false, accessScope = "
1502
1513
  name: "delete_notification",
1503
1514
  description: `${changeWarning} delete a notification after verifying that its nested notification ID belongs to the selected user. Returns before/after notification state.`,
1504
1515
  schema: z.object({
1505
- user_id: id.describe(userScoped ? "Authenticated sipgate user ID" : "Owner user ID"),
1516
+ user_id: userIdField("Owner user ID"),
1506
1517
  notification_id: id.describe("Notification target ID returned by list_notifications"),
1507
1518
  }),
1508
1519
  annotations: writeAnnotations,