@perplexity-ai/mcp-server 0.2.2 → 0.14.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 (131) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +169 -73
  3. package/compat.d.mts +58 -0
  4. package/compat.d.mts.map +1 -0
  5. package/compat.d.ts +58 -0
  6. package/compat.d.ts.map +1 -0
  7. package/compat.js +387 -0
  8. package/compat.js.map +1 -0
  9. package/compat.mjs +378 -0
  10. package/compat.mjs.map +1 -0
  11. package/dynamic-tools.d.mts +12 -0
  12. package/dynamic-tools.d.mts.map +1 -0
  13. package/dynamic-tools.d.ts +12 -0
  14. package/dynamic-tools.d.ts.map +1 -0
  15. package/dynamic-tools.js +135 -0
  16. package/dynamic-tools.js.map +1 -0
  17. package/dynamic-tools.mjs +132 -0
  18. package/dynamic-tools.mjs.map +1 -0
  19. package/filtering.d.mts +2 -0
  20. package/filtering.d.mts.map +1 -0
  21. package/filtering.d.ts +2 -0
  22. package/filtering.d.ts.map +1 -0
  23. package/filtering.js +20 -0
  24. package/filtering.js.map +1 -0
  25. package/filtering.mjs +13 -0
  26. package/filtering.mjs.map +1 -0
  27. package/headers.d.mts +4 -0
  28. package/headers.d.mts.map +1 -0
  29. package/headers.d.ts +4 -0
  30. package/headers.d.ts.map +1 -0
  31. package/headers.js +22 -0
  32. package/headers.js.map +1 -0
  33. package/headers.mjs +18 -0
  34. package/headers.mjs.map +1 -0
  35. package/http.d.mts +9 -0
  36. package/http.d.mts.map +1 -0
  37. package/http.d.ts +9 -0
  38. package/http.d.ts.map +1 -0
  39. package/http.js +108 -0
  40. package/http.js.map +1 -0
  41. package/http.mjs +100 -0
  42. package/http.mjs.map +1 -0
  43. package/index.d.mts +3 -0
  44. package/index.d.mts.map +1 -0
  45. package/index.d.ts +3 -0
  46. package/index.d.ts.map +1 -0
  47. package/index.js +91 -0
  48. package/index.js.map +1 -0
  49. package/index.mjs +89 -0
  50. package/index.mjs.map +1 -0
  51. package/options.d.mts +18 -0
  52. package/options.d.mts.map +1 -0
  53. package/options.d.ts +18 -0
  54. package/options.d.ts.map +1 -0
  55. package/options.js +415 -0
  56. package/options.js.map +1 -0
  57. package/options.mjs +408 -0
  58. package/options.mjs.map +1 -0
  59. package/package.json +156 -37
  60. package/server.d.mts +35 -0
  61. package/server.d.mts.map +1 -0
  62. package/server.d.ts +35 -0
  63. package/server.d.ts.map +1 -0
  64. package/server.js +166 -0
  65. package/server.js.map +1 -0
  66. package/server.mjs +152 -0
  67. package/server.mjs.map +1 -0
  68. package/src/compat.ts +483 -0
  69. package/src/dynamic-tools.ts +159 -0
  70. package/src/filtering.ts +14 -0
  71. package/src/headers.ts +23 -0
  72. package/src/http.ts +127 -0
  73. package/src/index.ts +108 -0
  74. package/src/options.ts +453 -0
  75. package/src/server.ts +201 -0
  76. package/src/stdio.ts +13 -0
  77. package/src/tools/chat/completions/create-chat-completions.ts +1323 -0
  78. package/src/tools/index.ts +73 -0
  79. package/src/tools/search/create-search.ts +89 -0
  80. package/src/tools/types.ts +103 -0
  81. package/src/tools.ts +1 -0
  82. package/src/tsconfig.json +11 -0
  83. package/stdio.d.mts +3 -0
  84. package/stdio.d.mts.map +1 -0
  85. package/stdio.d.ts +3 -0
  86. package/stdio.d.ts.map +1 -0
  87. package/stdio.js +14 -0
  88. package/stdio.js.map +1 -0
  89. package/stdio.mjs +10 -0
  90. package/stdio.mjs.map +1 -0
  91. package/tools/chat/completions/create-chat-completions.d.mts +45 -0
  92. package/tools/chat/completions/create-chat-completions.d.mts.map +1 -0
  93. package/tools/chat/completions/create-chat-completions.d.ts +45 -0
  94. package/tools/chat/completions/create-chat-completions.d.ts.map +1 -0
  95. package/tools/chat/completions/create-chat-completions.js +1320 -0
  96. package/tools/chat/completions/create-chat-completions.js.map +1 -0
  97. package/tools/chat/completions/create-chat-completions.mjs +1316 -0
  98. package/tools/chat/completions/create-chat-completions.mjs.map +1 -0
  99. package/tools/index.d.mts +10 -0
  100. package/tools/index.d.mts.map +1 -0
  101. package/tools/index.d.ts +10 -0
  102. package/tools/index.d.ts.map +1 -0
  103. package/tools/index.js +57 -0
  104. package/tools/index.js.map +1 -0
  105. package/tools/index.mjs +50 -0
  106. package/tools/index.mjs.map +1 -0
  107. package/tools/search/create-search.d.mts +45 -0
  108. package/tools/search/create-search.d.mts.map +1 -0
  109. package/tools/search/create-search.d.ts +45 -0
  110. package/tools/search/create-search.d.ts.map +1 -0
  111. package/tools/search/create-search.js +86 -0
  112. package/tools/search/create-search.js.map +1 -0
  113. package/tools/search/create-search.mjs +82 -0
  114. package/tools/search/create-search.mjs.map +1 -0
  115. package/tools/types.d.mts +51 -0
  116. package/tools/types.d.mts.map +1 -0
  117. package/tools/types.d.ts +51 -0
  118. package/tools/types.d.ts.map +1 -0
  119. package/tools/types.js +46 -0
  120. package/tools/types.js.map +1 -0
  121. package/tools/types.mjs +42 -0
  122. package/tools/types.mjs.map +1 -0
  123. package/tools.d.mts +2 -0
  124. package/tools.d.mts.map +1 -0
  125. package/tools.d.ts +2 -0
  126. package/tools.d.ts.map +1 -0
  127. package/tools.js +18 -0
  128. package/tools.js.map +1 -0
  129. package/tools.mjs +2 -0
  130. package/tools.mjs.map +1 -0
  131. package/dist/index.js +0 -446
@@ -0,0 +1,1316 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { asTextContentResult } from '@perplexity-ai/mcp-server/tools/types';
3
+ export const metadata = {
4
+ resource: 'chat.completions',
5
+ operation: 'write',
6
+ tags: [],
7
+ httpMethod: 'post',
8
+ httpPath: '/chat/completions',
9
+ operationId: 'chat_completions_chat_completions_post',
10
+ };
11
+ export const tool = {
12
+ name: 'create_chat_completions',
13
+ description: 'Generate a chat completion response for the given conversation.',
14
+ inputSchema: {
15
+ type: 'object',
16
+ anyOf: [
17
+ {
18
+ type: 'object',
19
+ properties: {
20
+ messages: {
21
+ type: 'array',
22
+ title: 'Messages',
23
+ items: {
24
+ $ref: '#/$defs/chat_message_input',
25
+ },
26
+ },
27
+ model: {
28
+ type: 'string',
29
+ title: 'Model',
30
+ },
31
+ _debug_pro_search: {
32
+ type: 'boolean',
33
+ title: 'Debug Pro Search',
34
+ },
35
+ _inputs: {
36
+ type: 'array',
37
+ title: 'Inputs',
38
+ items: {
39
+ type: 'integer',
40
+ },
41
+ },
42
+ _is_browser_agent: {
43
+ type: 'boolean',
44
+ title: 'Is Browser Agent',
45
+ },
46
+ _prompt_token_length: {
47
+ type: 'integer',
48
+ title: 'Prompt Token Length',
49
+ },
50
+ best_of: {
51
+ type: 'integer',
52
+ title: 'Best Of',
53
+ },
54
+ country: {
55
+ type: 'string',
56
+ title: 'Country',
57
+ },
58
+ cum_logprobs: {
59
+ type: 'boolean',
60
+ title: 'Cum Logprobs',
61
+ },
62
+ disable_search: {
63
+ type: 'boolean',
64
+ title: 'Disable Search',
65
+ },
66
+ diverse_first_token: {
67
+ type: 'boolean',
68
+ title: 'Diverse First Token',
69
+ },
70
+ enable_search_classifier: {
71
+ type: 'boolean',
72
+ title: 'Enable Search Classifier',
73
+ },
74
+ file_workspace_id: {
75
+ type: 'string',
76
+ title: 'File Workspace Id',
77
+ },
78
+ frequency_penalty: {
79
+ type: 'number',
80
+ title: 'Frequency Penalty',
81
+ },
82
+ has_image_url: {
83
+ type: 'boolean',
84
+ title: 'Has Image Url',
85
+ },
86
+ image_domain_filter: {
87
+ type: 'array',
88
+ title: 'Image Domain Filter',
89
+ items: {
90
+ type: 'string',
91
+ },
92
+ },
93
+ image_format_filter: {
94
+ type: 'array',
95
+ title: 'Image Format Filter',
96
+ items: {
97
+ type: 'string',
98
+ },
99
+ },
100
+ language_preference: {
101
+ type: 'string',
102
+ title: 'Language Preference',
103
+ },
104
+ last_updated_after_filter: {
105
+ type: 'string',
106
+ title: 'Last Updated After Filter',
107
+ },
108
+ last_updated_before_filter: {
109
+ type: 'string',
110
+ title: 'Last Updated Before Filter',
111
+ },
112
+ latitude: {
113
+ type: 'number',
114
+ title: 'Latitude',
115
+ },
116
+ logprobs: {
117
+ type: 'boolean',
118
+ title: 'Logprobs',
119
+ },
120
+ longitude: {
121
+ type: 'number',
122
+ title: 'Longitude',
123
+ },
124
+ max_tokens: {
125
+ type: 'integer',
126
+ title: 'Max Tokens',
127
+ },
128
+ n: {
129
+ type: 'integer',
130
+ title: 'N',
131
+ },
132
+ num_images: {
133
+ type: 'integer',
134
+ title: 'Num Images',
135
+ },
136
+ num_search_results: {
137
+ type: 'integer',
138
+ title: 'Num Search Results',
139
+ },
140
+ parallel_tool_calls: {
141
+ type: 'boolean',
142
+ title: 'Parallel Tool Calls',
143
+ },
144
+ presence_penalty: {
145
+ type: 'number',
146
+ title: 'Presence Penalty',
147
+ },
148
+ ranking_model: {
149
+ type: 'string',
150
+ title: 'Ranking Model',
151
+ },
152
+ reasoning_effort: {
153
+ type: 'string',
154
+ title: 'Reasoning Effort',
155
+ enum: ['minimal', 'low', 'medium', 'high'],
156
+ },
157
+ response_format: {
158
+ anyOf: [
159
+ {
160
+ type: 'object',
161
+ title: 'ResponseFormatText',
162
+ properties: {
163
+ type: {
164
+ type: 'string',
165
+ title: 'Type',
166
+ enum: ['text'],
167
+ },
168
+ },
169
+ required: ['type'],
170
+ },
171
+ {
172
+ type: 'object',
173
+ title: 'ResponseFormatJSONSchema',
174
+ properties: {
175
+ json_schema: {
176
+ type: 'object',
177
+ title: 'JSONSchema',
178
+ properties: {
179
+ schema: {
180
+ type: 'object',
181
+ title: 'Schema',
182
+ additionalProperties: true,
183
+ },
184
+ description: {
185
+ type: 'string',
186
+ title: 'Description',
187
+ },
188
+ name: {
189
+ type: 'string',
190
+ title: 'Name',
191
+ },
192
+ strict: {
193
+ type: 'boolean',
194
+ title: 'Strict',
195
+ },
196
+ },
197
+ required: ['schema'],
198
+ },
199
+ type: {
200
+ type: 'string',
201
+ title: 'Type',
202
+ enum: ['json_schema'],
203
+ },
204
+ },
205
+ required: ['json_schema', 'type'],
206
+ },
207
+ {
208
+ type: 'object',
209
+ title: 'ResponseFormatRegex',
210
+ properties: {
211
+ regex: {
212
+ type: 'object',
213
+ title: 'RegexSchema',
214
+ properties: {
215
+ regex: {
216
+ type: 'string',
217
+ title: 'Regex',
218
+ },
219
+ description: {
220
+ type: 'string',
221
+ title: 'Description',
222
+ },
223
+ name: {
224
+ type: 'string',
225
+ title: 'Name',
226
+ },
227
+ strict: {
228
+ type: 'boolean',
229
+ title: 'Strict',
230
+ },
231
+ },
232
+ required: ['regex'],
233
+ },
234
+ type: {
235
+ type: 'string',
236
+ title: 'Type',
237
+ enum: ['regex'],
238
+ },
239
+ },
240
+ required: ['regex', 'type'],
241
+ },
242
+ ],
243
+ title: 'Response Format',
244
+ },
245
+ response_metadata: {
246
+ type: 'object',
247
+ title: 'Response Metadata',
248
+ additionalProperties: true,
249
+ },
250
+ return_images: {
251
+ type: 'boolean',
252
+ title: 'Return Images',
253
+ },
254
+ return_related_questions: {
255
+ type: 'boolean',
256
+ title: 'Return Related Questions',
257
+ },
258
+ safe_search: {
259
+ type: 'boolean',
260
+ title: 'Safe Search',
261
+ },
262
+ search_after_date_filter: {
263
+ type: 'string',
264
+ title: 'Search After Date Filter',
265
+ },
266
+ search_before_date_filter: {
267
+ type: 'string',
268
+ title: 'Search Before Date Filter',
269
+ },
270
+ search_domain_filter: {
271
+ type: 'array',
272
+ title: 'Search Domain Filter',
273
+ items: {
274
+ type: 'string',
275
+ },
276
+ },
277
+ search_internal_properties: {
278
+ type: 'object',
279
+ title: 'Search Internal Properties',
280
+ additionalProperties: true,
281
+ },
282
+ search_mode: {
283
+ type: 'string',
284
+ title: 'Search Mode',
285
+ enum: ['web', 'academic', 'sec'],
286
+ },
287
+ search_recency_filter: {
288
+ type: 'string',
289
+ title: 'Search Recency Filter',
290
+ enum: ['hour', 'day', 'week', 'month', 'year'],
291
+ },
292
+ search_tenant: {
293
+ type: 'string',
294
+ title: 'Search Tenant',
295
+ },
296
+ stop: {
297
+ anyOf: [
298
+ {
299
+ type: 'string',
300
+ },
301
+ {
302
+ type: 'array',
303
+ items: {
304
+ type: 'string',
305
+ },
306
+ },
307
+ ],
308
+ title: 'Stop',
309
+ },
310
+ stream: {
311
+ type: 'string',
312
+ title: 'Stream',
313
+ enum: [false],
314
+ },
315
+ stream_mode: {
316
+ type: 'string',
317
+ title: 'Stream Mode',
318
+ enum: ['full', 'concise'],
319
+ },
320
+ temperature: {
321
+ type: 'number',
322
+ title: 'Temperature',
323
+ },
324
+ thread_id: {
325
+ type: 'string',
326
+ title: 'Thread Id',
327
+ },
328
+ tool_choice: {
329
+ type: 'string',
330
+ title: 'Tool Choice',
331
+ enum: ['none', 'auto', 'required'],
332
+ },
333
+ tools: {
334
+ type: 'array',
335
+ title: 'Tools',
336
+ items: {
337
+ type: 'object',
338
+ title: 'ToolSpec',
339
+ properties: {
340
+ function: {
341
+ type: 'object',
342
+ title: 'FunctionSpec',
343
+ properties: {
344
+ description: {
345
+ type: 'string',
346
+ title: 'Description',
347
+ },
348
+ name: {
349
+ type: 'string',
350
+ title: 'Name',
351
+ },
352
+ parameters: {
353
+ type: 'object',
354
+ title: 'ParameterSpec',
355
+ properties: {
356
+ properties: {
357
+ type: 'object',
358
+ title: 'Properties',
359
+ additionalProperties: true,
360
+ },
361
+ type: {
362
+ type: 'string',
363
+ title: 'Type',
364
+ },
365
+ additional_properties: {
366
+ type: 'boolean',
367
+ title: 'Additional Properties',
368
+ },
369
+ required: {
370
+ type: 'array',
371
+ title: 'Required',
372
+ items: {
373
+ type: 'string',
374
+ },
375
+ },
376
+ },
377
+ required: ['properties', 'type'],
378
+ },
379
+ strict: {
380
+ type: 'boolean',
381
+ title: 'Strict',
382
+ },
383
+ },
384
+ required: ['description', 'name', 'parameters'],
385
+ },
386
+ type: {
387
+ type: 'string',
388
+ title: 'Type',
389
+ enum: ['function'],
390
+ },
391
+ },
392
+ required: ['function', 'type'],
393
+ },
394
+ },
395
+ top_k: {
396
+ type: 'integer',
397
+ title: 'Top K',
398
+ },
399
+ top_logprobs: {
400
+ type: 'integer',
401
+ title: 'Top Logprobs',
402
+ },
403
+ top_p: {
404
+ type: 'number',
405
+ title: 'Top P',
406
+ },
407
+ updated_after_timestamp: {
408
+ type: 'integer',
409
+ title: 'Updated After Timestamp',
410
+ },
411
+ updated_before_timestamp: {
412
+ type: 'integer',
413
+ title: 'Updated Before Timestamp',
414
+ },
415
+ use_threads: {
416
+ type: 'boolean',
417
+ title: 'Use Threads',
418
+ },
419
+ web_search_options: {
420
+ type: 'object',
421
+ title: 'WebSearchOptions',
422
+ properties: {
423
+ image_results_enhanced_relevance: {
424
+ type: 'boolean',
425
+ title: 'Image Results Enhanced Relevance',
426
+ },
427
+ search_context_size: {
428
+ type: 'string',
429
+ title: 'Search Context Size',
430
+ enum: ['low', 'medium', 'high'],
431
+ },
432
+ search_type: {
433
+ type: 'string',
434
+ title: 'Search Type',
435
+ enum: ['fast', 'pro', 'auto'],
436
+ },
437
+ user_location: {
438
+ type: 'object',
439
+ title: 'UserLocation',
440
+ properties: {
441
+ city: {
442
+ type: 'string',
443
+ title: 'City',
444
+ },
445
+ country: {
446
+ type: 'string',
447
+ title: 'Country',
448
+ },
449
+ latitude: {
450
+ type: 'number',
451
+ title: 'Latitude',
452
+ },
453
+ longitude: {
454
+ type: 'number',
455
+ title: 'Longitude',
456
+ },
457
+ region: {
458
+ type: 'string',
459
+ title: 'Region',
460
+ },
461
+ },
462
+ },
463
+ },
464
+ },
465
+ },
466
+ required: ['messages', 'model'],
467
+ },
468
+ {
469
+ type: 'object',
470
+ properties: {
471
+ messages: {
472
+ type: 'array',
473
+ title: 'Messages',
474
+ items: {
475
+ $ref: '#/$defs/chat_message_input',
476
+ },
477
+ },
478
+ model: {
479
+ type: 'string',
480
+ title: 'Model',
481
+ },
482
+ stream: {
483
+ type: 'string',
484
+ title: 'Stream',
485
+ enum: [true],
486
+ },
487
+ _debug_pro_search: {
488
+ type: 'boolean',
489
+ title: 'Debug Pro Search',
490
+ },
491
+ _inputs: {
492
+ type: 'array',
493
+ title: 'Inputs',
494
+ items: {
495
+ type: 'integer',
496
+ },
497
+ },
498
+ _is_browser_agent: {
499
+ type: 'boolean',
500
+ title: 'Is Browser Agent',
501
+ },
502
+ _prompt_token_length: {
503
+ type: 'integer',
504
+ title: 'Prompt Token Length',
505
+ },
506
+ best_of: {
507
+ type: 'integer',
508
+ title: 'Best Of',
509
+ },
510
+ country: {
511
+ type: 'string',
512
+ title: 'Country',
513
+ },
514
+ cum_logprobs: {
515
+ type: 'boolean',
516
+ title: 'Cum Logprobs',
517
+ },
518
+ disable_search: {
519
+ type: 'boolean',
520
+ title: 'Disable Search',
521
+ },
522
+ diverse_first_token: {
523
+ type: 'boolean',
524
+ title: 'Diverse First Token',
525
+ },
526
+ enable_search_classifier: {
527
+ type: 'boolean',
528
+ title: 'Enable Search Classifier',
529
+ },
530
+ file_workspace_id: {
531
+ type: 'string',
532
+ title: 'File Workspace Id',
533
+ },
534
+ frequency_penalty: {
535
+ type: 'number',
536
+ title: 'Frequency Penalty',
537
+ },
538
+ has_image_url: {
539
+ type: 'boolean',
540
+ title: 'Has Image Url',
541
+ },
542
+ image_domain_filter: {
543
+ type: 'array',
544
+ title: 'Image Domain Filter',
545
+ items: {
546
+ type: 'string',
547
+ },
548
+ },
549
+ image_format_filter: {
550
+ type: 'array',
551
+ title: 'Image Format Filter',
552
+ items: {
553
+ type: 'string',
554
+ },
555
+ },
556
+ language_preference: {
557
+ type: 'string',
558
+ title: 'Language Preference',
559
+ },
560
+ last_updated_after_filter: {
561
+ type: 'string',
562
+ title: 'Last Updated After Filter',
563
+ },
564
+ last_updated_before_filter: {
565
+ type: 'string',
566
+ title: 'Last Updated Before Filter',
567
+ },
568
+ latitude: {
569
+ type: 'number',
570
+ title: 'Latitude',
571
+ },
572
+ logprobs: {
573
+ type: 'boolean',
574
+ title: 'Logprobs',
575
+ },
576
+ longitude: {
577
+ type: 'number',
578
+ title: 'Longitude',
579
+ },
580
+ max_tokens: {
581
+ type: 'integer',
582
+ title: 'Max Tokens',
583
+ },
584
+ n: {
585
+ type: 'integer',
586
+ title: 'N',
587
+ },
588
+ num_images: {
589
+ type: 'integer',
590
+ title: 'Num Images',
591
+ },
592
+ num_search_results: {
593
+ type: 'integer',
594
+ title: 'Num Search Results',
595
+ },
596
+ parallel_tool_calls: {
597
+ type: 'boolean',
598
+ title: 'Parallel Tool Calls',
599
+ },
600
+ presence_penalty: {
601
+ type: 'number',
602
+ title: 'Presence Penalty',
603
+ },
604
+ ranking_model: {
605
+ type: 'string',
606
+ title: 'Ranking Model',
607
+ },
608
+ reasoning_effort: {
609
+ type: 'string',
610
+ title: 'Reasoning Effort',
611
+ enum: ['minimal', 'low', 'medium', 'high'],
612
+ },
613
+ response_format: {
614
+ anyOf: [
615
+ {
616
+ type: 'object',
617
+ title: 'ResponseFormatText',
618
+ properties: {
619
+ type: {
620
+ type: 'string',
621
+ title: 'Type',
622
+ enum: ['text'],
623
+ },
624
+ },
625
+ required: ['type'],
626
+ },
627
+ {
628
+ type: 'object',
629
+ title: 'ResponseFormatJSONSchema',
630
+ properties: {
631
+ json_schema: {
632
+ type: 'object',
633
+ title: 'JSONSchema',
634
+ properties: {
635
+ schema: {
636
+ type: 'object',
637
+ title: 'Schema',
638
+ additionalProperties: true,
639
+ },
640
+ description: {
641
+ type: 'string',
642
+ title: 'Description',
643
+ },
644
+ name: {
645
+ type: 'string',
646
+ title: 'Name',
647
+ },
648
+ strict: {
649
+ type: 'boolean',
650
+ title: 'Strict',
651
+ },
652
+ },
653
+ required: ['schema'],
654
+ },
655
+ type: {
656
+ type: 'string',
657
+ title: 'Type',
658
+ enum: ['json_schema'],
659
+ },
660
+ },
661
+ required: ['json_schema', 'type'],
662
+ },
663
+ {
664
+ type: 'object',
665
+ title: 'ResponseFormatRegex',
666
+ properties: {
667
+ regex: {
668
+ type: 'object',
669
+ title: 'RegexSchema',
670
+ properties: {
671
+ regex: {
672
+ type: 'string',
673
+ title: 'Regex',
674
+ },
675
+ description: {
676
+ type: 'string',
677
+ title: 'Description',
678
+ },
679
+ name: {
680
+ type: 'string',
681
+ title: 'Name',
682
+ },
683
+ strict: {
684
+ type: 'boolean',
685
+ title: 'Strict',
686
+ },
687
+ },
688
+ required: ['regex'],
689
+ },
690
+ type: {
691
+ type: 'string',
692
+ title: 'Type',
693
+ enum: ['regex'],
694
+ },
695
+ },
696
+ required: ['regex', 'type'],
697
+ },
698
+ ],
699
+ title: 'Response Format',
700
+ },
701
+ response_metadata: {
702
+ type: 'object',
703
+ title: 'Response Metadata',
704
+ additionalProperties: true,
705
+ },
706
+ return_images: {
707
+ type: 'boolean',
708
+ title: 'Return Images',
709
+ },
710
+ return_related_questions: {
711
+ type: 'boolean',
712
+ title: 'Return Related Questions',
713
+ },
714
+ safe_search: {
715
+ type: 'boolean',
716
+ title: 'Safe Search',
717
+ },
718
+ search_after_date_filter: {
719
+ type: 'string',
720
+ title: 'Search After Date Filter',
721
+ },
722
+ search_before_date_filter: {
723
+ type: 'string',
724
+ title: 'Search Before Date Filter',
725
+ },
726
+ search_domain_filter: {
727
+ type: 'array',
728
+ title: 'Search Domain Filter',
729
+ items: {
730
+ type: 'string',
731
+ },
732
+ },
733
+ search_internal_properties: {
734
+ type: 'object',
735
+ title: 'Search Internal Properties',
736
+ additionalProperties: true,
737
+ },
738
+ search_mode: {
739
+ type: 'string',
740
+ title: 'Search Mode',
741
+ enum: ['web', 'academic', 'sec'],
742
+ },
743
+ search_recency_filter: {
744
+ type: 'string',
745
+ title: 'Search Recency Filter',
746
+ enum: ['hour', 'day', 'week', 'month', 'year'],
747
+ },
748
+ search_tenant: {
749
+ type: 'string',
750
+ title: 'Search Tenant',
751
+ },
752
+ stop: {
753
+ anyOf: [
754
+ {
755
+ type: 'string',
756
+ },
757
+ {
758
+ type: 'array',
759
+ items: {
760
+ type: 'string',
761
+ },
762
+ },
763
+ ],
764
+ title: 'Stop',
765
+ },
766
+ stream_mode: {
767
+ type: 'string',
768
+ title: 'Stream Mode',
769
+ enum: ['full', 'concise'],
770
+ },
771
+ temperature: {
772
+ type: 'number',
773
+ title: 'Temperature',
774
+ },
775
+ thread_id: {
776
+ type: 'string',
777
+ title: 'Thread Id',
778
+ },
779
+ tool_choice: {
780
+ type: 'string',
781
+ title: 'Tool Choice',
782
+ enum: ['none', 'auto', 'required'],
783
+ },
784
+ tools: {
785
+ type: 'array',
786
+ title: 'Tools',
787
+ items: {
788
+ type: 'object',
789
+ title: 'ToolSpec',
790
+ properties: {
791
+ function: {
792
+ type: 'object',
793
+ title: 'FunctionSpec',
794
+ properties: {
795
+ description: {
796
+ type: 'string',
797
+ title: 'Description',
798
+ },
799
+ name: {
800
+ type: 'string',
801
+ title: 'Name',
802
+ },
803
+ parameters: {
804
+ type: 'object',
805
+ title: 'ParameterSpec',
806
+ properties: {
807
+ properties: {
808
+ type: 'object',
809
+ title: 'Properties',
810
+ additionalProperties: true,
811
+ },
812
+ type: {
813
+ type: 'string',
814
+ title: 'Type',
815
+ },
816
+ additional_properties: {
817
+ type: 'boolean',
818
+ title: 'Additional Properties',
819
+ },
820
+ required: {
821
+ type: 'array',
822
+ title: 'Required',
823
+ items: {
824
+ type: 'string',
825
+ },
826
+ },
827
+ },
828
+ required: ['properties', 'type'],
829
+ },
830
+ strict: {
831
+ type: 'boolean',
832
+ title: 'Strict',
833
+ },
834
+ },
835
+ required: ['description', 'name', 'parameters'],
836
+ },
837
+ type: {
838
+ type: 'string',
839
+ title: 'Type',
840
+ enum: ['function'],
841
+ },
842
+ },
843
+ required: ['function', 'type'],
844
+ },
845
+ },
846
+ top_k: {
847
+ type: 'integer',
848
+ title: 'Top K',
849
+ },
850
+ top_logprobs: {
851
+ type: 'integer',
852
+ title: 'Top Logprobs',
853
+ },
854
+ top_p: {
855
+ type: 'number',
856
+ title: 'Top P',
857
+ },
858
+ updated_after_timestamp: {
859
+ type: 'integer',
860
+ title: 'Updated After Timestamp',
861
+ },
862
+ updated_before_timestamp: {
863
+ type: 'integer',
864
+ title: 'Updated Before Timestamp',
865
+ },
866
+ use_threads: {
867
+ type: 'boolean',
868
+ title: 'Use Threads',
869
+ },
870
+ web_search_options: {
871
+ type: 'object',
872
+ title: 'WebSearchOptions',
873
+ properties: {
874
+ image_results_enhanced_relevance: {
875
+ type: 'boolean',
876
+ title: 'Image Results Enhanced Relevance',
877
+ },
878
+ search_context_size: {
879
+ type: 'string',
880
+ title: 'Search Context Size',
881
+ enum: ['low', 'medium', 'high'],
882
+ },
883
+ search_type: {
884
+ type: 'string',
885
+ title: 'Search Type',
886
+ enum: ['fast', 'pro', 'auto'],
887
+ },
888
+ user_location: {
889
+ type: 'object',
890
+ title: 'UserLocation',
891
+ properties: {
892
+ city: {
893
+ type: 'string',
894
+ title: 'City',
895
+ },
896
+ country: {
897
+ type: 'string',
898
+ title: 'Country',
899
+ },
900
+ latitude: {
901
+ type: 'number',
902
+ title: 'Latitude',
903
+ },
904
+ longitude: {
905
+ type: 'number',
906
+ title: 'Longitude',
907
+ },
908
+ region: {
909
+ type: 'string',
910
+ title: 'Region',
911
+ },
912
+ },
913
+ },
914
+ },
915
+ },
916
+ },
917
+ required: ['messages', 'model', 'stream'],
918
+ },
919
+ ],
920
+ $defs: {
921
+ chat_message_input: {
922
+ type: 'object',
923
+ title: 'ChatMessage',
924
+ properties: {
925
+ content: {
926
+ anyOf: [
927
+ {
928
+ type: 'string',
929
+ },
930
+ {
931
+ type: 'array',
932
+ title: 'Structured Content',
933
+ items: {
934
+ anyOf: [
935
+ {
936
+ type: 'object',
937
+ title: 'ChatMessageContentTextChunk',
938
+ properties: {
939
+ text: {
940
+ type: 'string',
941
+ title: 'Text',
942
+ },
943
+ type: {
944
+ type: 'string',
945
+ title: 'Type',
946
+ enum: ['text'],
947
+ },
948
+ },
949
+ required: ['text', 'type'],
950
+ },
951
+ {
952
+ type: 'object',
953
+ title: 'ChatMessageContentImageChunk',
954
+ properties: {
955
+ image_url: {
956
+ anyOf: [
957
+ {
958
+ type: 'object',
959
+ title: 'URL',
960
+ properties: {
961
+ url: {
962
+ type: 'string',
963
+ title: 'Url',
964
+ },
965
+ },
966
+ required: ['url'],
967
+ },
968
+ {
969
+ type: 'string',
970
+ },
971
+ ],
972
+ title: 'Image Url',
973
+ },
974
+ type: {
975
+ type: 'string',
976
+ title: 'Type',
977
+ enum: ['image_url'],
978
+ },
979
+ },
980
+ required: ['image_url', 'type'],
981
+ },
982
+ {
983
+ type: 'object',
984
+ title: 'ChatMessageContentFileChunk',
985
+ properties: {
986
+ file_url: {
987
+ anyOf: [
988
+ {
989
+ type: 'object',
990
+ title: 'URL',
991
+ properties: {
992
+ url: {
993
+ type: 'string',
994
+ title: 'Url',
995
+ },
996
+ },
997
+ required: ['url'],
998
+ },
999
+ {
1000
+ type: 'string',
1001
+ },
1002
+ ],
1003
+ title: 'File Url',
1004
+ },
1005
+ type: {
1006
+ type: 'string',
1007
+ title: 'Type',
1008
+ enum: ['file_url'],
1009
+ },
1010
+ file_name: {
1011
+ type: 'string',
1012
+ title: 'File Name',
1013
+ },
1014
+ },
1015
+ required: ['file_url', 'type'],
1016
+ },
1017
+ {
1018
+ type: 'object',
1019
+ title: 'ChatMessageContentPDFChunk',
1020
+ properties: {
1021
+ pdf_url: {
1022
+ anyOf: [
1023
+ {
1024
+ type: 'object',
1025
+ title: 'URL',
1026
+ properties: {
1027
+ url: {
1028
+ type: 'string',
1029
+ title: 'Url',
1030
+ },
1031
+ },
1032
+ required: ['url'],
1033
+ },
1034
+ {
1035
+ type: 'string',
1036
+ },
1037
+ ],
1038
+ title: 'Pdf Url',
1039
+ },
1040
+ type: {
1041
+ type: 'string',
1042
+ title: 'Type',
1043
+ enum: ['pdf_url'],
1044
+ },
1045
+ },
1046
+ required: ['pdf_url', 'type'],
1047
+ },
1048
+ {
1049
+ type: 'object',
1050
+ title: 'ChatMessageContentVideoChunk',
1051
+ properties: {
1052
+ type: {
1053
+ type: 'string',
1054
+ title: 'Type',
1055
+ enum: ['video_url'],
1056
+ },
1057
+ video_url: {
1058
+ anyOf: [
1059
+ {
1060
+ type: 'object',
1061
+ title: 'VideoURL',
1062
+ properties: {
1063
+ url: {
1064
+ type: 'string',
1065
+ title: 'Url',
1066
+ },
1067
+ frame_interval: {
1068
+ anyOf: [
1069
+ {
1070
+ type: 'string',
1071
+ },
1072
+ {
1073
+ type: 'integer',
1074
+ },
1075
+ ],
1076
+ title: 'Frame Interval',
1077
+ },
1078
+ },
1079
+ required: ['url'],
1080
+ },
1081
+ {
1082
+ type: 'string',
1083
+ },
1084
+ ],
1085
+ title: 'Video Url',
1086
+ },
1087
+ },
1088
+ required: ['type', 'video_url'],
1089
+ },
1090
+ ],
1091
+ },
1092
+ },
1093
+ ],
1094
+ title: 'Content',
1095
+ },
1096
+ role: {
1097
+ type: 'string',
1098
+ title: 'ChatMessageRole',
1099
+ description: 'Chat roles enum',
1100
+ enum: ['system', 'user', 'assistant', 'tool'],
1101
+ },
1102
+ reasoning_steps: {
1103
+ type: 'array',
1104
+ title: 'Reasoning Steps',
1105
+ items: {
1106
+ type: 'object',
1107
+ title: 'ReasoningStep',
1108
+ description: 'Reasoning step wrapper class',
1109
+ properties: {
1110
+ thought: {
1111
+ type: 'string',
1112
+ title: 'Thought',
1113
+ },
1114
+ agent_progress: {
1115
+ type: 'object',
1116
+ title: 'AgentProgressStepDetails',
1117
+ description: 'Agent progress class for live-browsing updates',
1118
+ properties: {
1119
+ action: {
1120
+ type: 'string',
1121
+ title: 'Action',
1122
+ },
1123
+ screenshot: {
1124
+ type: 'string',
1125
+ title: 'Screenshot',
1126
+ },
1127
+ url: {
1128
+ type: 'string',
1129
+ title: 'Url',
1130
+ },
1131
+ },
1132
+ required: ['action', 'screenshot', 'url'],
1133
+ },
1134
+ browser_agent: {
1135
+ type: 'object',
1136
+ title: 'BrowserAgentStepDetails',
1137
+ description: 'Browser agent step summary class',
1138
+ properties: {
1139
+ result: {
1140
+ type: 'string',
1141
+ title: 'Result',
1142
+ },
1143
+ url: {
1144
+ type: 'string',
1145
+ title: 'Url',
1146
+ },
1147
+ },
1148
+ required: ['result', 'url'],
1149
+ },
1150
+ browser_tool_execution: {
1151
+ type: 'object',
1152
+ title: 'BrowserToolExecutionDetails',
1153
+ description: 'Tool input for kicking off browser tool automation',
1154
+ properties: {
1155
+ tool: {
1156
+ type: 'object',
1157
+ title: 'Tool',
1158
+ additionalProperties: true,
1159
+ },
1160
+ },
1161
+ required: ['tool'],
1162
+ },
1163
+ execute_python: {
1164
+ type: 'object',
1165
+ title: 'ExecutePythonStepDetails',
1166
+ description: 'Code generation step details wrapper class',
1167
+ properties: {
1168
+ code: {
1169
+ type: 'string',
1170
+ title: 'Code',
1171
+ },
1172
+ result: {
1173
+ type: 'string',
1174
+ title: 'Result',
1175
+ },
1176
+ },
1177
+ required: ['code', 'result'],
1178
+ },
1179
+ fetch_url_content: {
1180
+ type: 'object',
1181
+ title: 'FetchUrlContentStepDetails',
1182
+ description: 'Fetch url content step details wrapper class',
1183
+ properties: {
1184
+ contents: {
1185
+ type: 'array',
1186
+ title: 'Contents',
1187
+ items: {
1188
+ $ref: '#/$defs/api_public_search_result',
1189
+ },
1190
+ },
1191
+ },
1192
+ required: ['contents'],
1193
+ },
1194
+ file_attachment_search: {
1195
+ type: 'object',
1196
+ title: 'FileAttachmentSearchStepDetails',
1197
+ description: 'File attachment search step details wrapper class',
1198
+ properties: {
1199
+ attachment_urls: {
1200
+ type: 'array',
1201
+ title: 'Attachment Urls',
1202
+ items: {
1203
+ type: 'string',
1204
+ },
1205
+ },
1206
+ },
1207
+ required: ['attachment_urls'],
1208
+ },
1209
+ type: {
1210
+ type: 'string',
1211
+ title: 'Type',
1212
+ },
1213
+ web_search: {
1214
+ type: 'object',
1215
+ title: 'WebSearchStepDetails',
1216
+ description: 'Web search step details wrapper class',
1217
+ properties: {
1218
+ search_keywords: {
1219
+ type: 'array',
1220
+ title: 'Search Keywords',
1221
+ items: {
1222
+ type: 'string',
1223
+ },
1224
+ },
1225
+ search_results: {
1226
+ type: 'array',
1227
+ title: 'Search Results',
1228
+ items: {
1229
+ $ref: '#/$defs/api_public_search_result',
1230
+ },
1231
+ },
1232
+ },
1233
+ required: ['search_keywords', 'search_results'],
1234
+ },
1235
+ },
1236
+ required: ['thought'],
1237
+ },
1238
+ },
1239
+ tool_calls: {
1240
+ type: 'array',
1241
+ title: 'Tool Calls',
1242
+ items: {
1243
+ type: 'object',
1244
+ title: 'ToolCall',
1245
+ properties: {
1246
+ id: {
1247
+ type: 'string',
1248
+ title: 'Id',
1249
+ },
1250
+ function: {
1251
+ type: 'object',
1252
+ title: 'ToolCallFunction',
1253
+ properties: {
1254
+ arguments: {
1255
+ type: 'string',
1256
+ title: 'Arguments',
1257
+ },
1258
+ name: {
1259
+ type: 'string',
1260
+ title: 'Name',
1261
+ },
1262
+ },
1263
+ },
1264
+ type: {
1265
+ type: 'string',
1266
+ title: 'Type',
1267
+ enum: ['function'],
1268
+ },
1269
+ },
1270
+ },
1271
+ },
1272
+ },
1273
+ required: ['content', 'role'],
1274
+ },
1275
+ api_public_search_result: {
1276
+ type: 'object',
1277
+ title: 'ApiPublicSearchResult',
1278
+ properties: {
1279
+ title: {
1280
+ type: 'string',
1281
+ title: 'Title',
1282
+ },
1283
+ url: {
1284
+ type: 'string',
1285
+ title: 'Url',
1286
+ },
1287
+ date: {
1288
+ type: 'string',
1289
+ title: 'Date',
1290
+ },
1291
+ last_updated: {
1292
+ type: 'string',
1293
+ title: 'Last Updated',
1294
+ },
1295
+ snippet: {
1296
+ type: 'string',
1297
+ title: 'Snippet',
1298
+ },
1299
+ source: {
1300
+ type: 'string',
1301
+ title: 'Source',
1302
+ enum: ['web', 'attachment'],
1303
+ },
1304
+ },
1305
+ required: ['title', 'url'],
1306
+ },
1307
+ },
1308
+ },
1309
+ annotations: {},
1310
+ };
1311
+ export const handler = async (client, args) => {
1312
+ const body = args;
1313
+ return asTextContentResult(await client.chat.completions.create(body));
1314
+ };
1315
+ export default { metadata, tool, handler };
1316
+ //# sourceMappingURL=create-chat-completions.mjs.map