@azure/ai-agents 1.0.0-beta.6 → 1.1.0-beta.1

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 (380) hide show
  1. package/README.md +105 -26
  2. package/dist/browser/agentsClient.d.ts +2 -2
  3. package/dist/browser/agentsClient.d.ts.map +1 -1
  4. package/dist/browser/agentsClient.js.map +1 -1
  5. package/dist/browser/api/agentsContext.d.ts +2 -2
  6. package/dist/browser/api/agentsContext.d.ts.map +1 -1
  7. package/dist/browser/api/agentsContext.js +12 -24
  8. package/dist/browser/api/agentsContext.js.map +1 -1
  9. package/dist/browser/api/files/operations.d.ts +4 -4
  10. package/dist/browser/api/files/operations.d.ts.map +1 -1
  11. package/dist/browser/api/files/operations.js +25 -12
  12. package/dist/browser/api/files/operations.js.map +1 -1
  13. package/dist/browser/api/files/options.d.ts +3 -3
  14. package/dist/browser/api/files/options.d.ts.map +1 -1
  15. package/dist/browser/api/files/options.js.map +1 -1
  16. package/dist/browser/api/messages/operations.d.ts.map +1 -1
  17. package/dist/browser/api/messages/operations.js +18 -12
  18. package/dist/browser/api/messages/operations.js.map +1 -1
  19. package/dist/browser/api/operations.d.ts +7 -6
  20. package/dist/browser/api/operations.d.ts.map +1 -1
  21. package/dist/browser/api/operations.js +34 -22
  22. package/dist/browser/api/operations.js.map +1 -1
  23. package/dist/browser/api/options.d.ts +2 -2
  24. package/dist/browser/api/options.d.ts.map +1 -1
  25. package/dist/browser/api/options.js.map +1 -1
  26. package/dist/browser/api/runSteps/operations.d.ts.map +1 -1
  27. package/dist/browser/api/runSteps/operations.js +11 -7
  28. package/dist/browser/api/runSteps/operations.js.map +1 -1
  29. package/dist/browser/api/runs/operations.d.ts.map +1 -1
  30. package/dist/browser/api/runs/operations.js +38 -20
  31. package/dist/browser/api/runs/operations.js.map +1 -1
  32. package/dist/browser/api/runs/options.d.ts +9 -3
  33. package/dist/browser/api/runs/options.d.ts.map +1 -1
  34. package/dist/browser/api/runs/options.js.map +1 -1
  35. package/dist/browser/api/threads/operations.d.ts.map +1 -1
  36. package/dist/browser/api/threads/operations.js +26 -16
  37. package/dist/browser/api/threads/operations.js.map +1 -1
  38. package/dist/browser/api/threads/options.d.ts +2 -2
  39. package/dist/browser/api/threads/options.d.ts.map +1 -1
  40. package/dist/browser/api/threads/options.js.map +1 -1
  41. package/dist/browser/api/vectorStoreFileBatches/operations.d.ts +7 -7
  42. package/dist/browser/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
  43. package/dist/browser/api/vectorStoreFileBatches/operations.js +29 -11
  44. package/dist/browser/api/vectorStoreFileBatches/operations.js.map +1 -1
  45. package/dist/browser/api/vectorStoreFileBatches/options.d.ts +3 -3
  46. package/dist/browser/api/vectorStoreFileBatches/options.d.ts.map +1 -1
  47. package/dist/browser/api/vectorStoreFileBatches/options.js.map +1 -1
  48. package/dist/browser/api/vectorStoreFiles/operations.d.ts.map +1 -1
  49. package/dist/browser/api/vectorStoreFiles/operations.js +13 -5
  50. package/dist/browser/api/vectorStoreFiles/operations.js.map +1 -1
  51. package/dist/browser/api/vectorStores/operations.d.ts.map +1 -1
  52. package/dist/browser/api/vectorStores/operations.js +16 -6
  53. package/dist/browser/api/vectorStores/operations.js.map +1 -1
  54. package/dist/browser/classic/runSteps/index.d.ts +0 -1
  55. package/dist/browser/classic/runSteps/index.d.ts.map +1 -1
  56. package/dist/browser/classic/runSteps/index.js.map +1 -1
  57. package/dist/browser/classic/runs/index.d.ts +1 -1
  58. package/dist/browser/classic/runs/index.d.ts.map +1 -1
  59. package/dist/browser/classic/runs/index.js.map +1 -1
  60. package/dist/browser/classic/vectorStoreFileBatches/index.d.ts +6 -6
  61. package/dist/browser/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
  62. package/dist/browser/classic/vectorStoreFileBatches/index.js.map +1 -1
  63. package/dist/browser/classic/vectorStoreFiles/index.d.ts +5 -5
  64. package/dist/browser/classic/vectorStoreFiles/index.d.ts.map +1 -1
  65. package/dist/browser/classic/vectorStoreFiles/index.js +2 -0
  66. package/dist/browser/classic/vectorStoreFiles/index.js.map +1 -1
  67. package/dist/browser/classic/vectorStores/index.d.ts.map +1 -1
  68. package/dist/browser/classic/vectorStores/index.js.map +1 -1
  69. package/dist/browser/constants.d.ts +1 -1
  70. package/dist/browser/constants.js +1 -1
  71. package/dist/browser/constants.js.map +1 -1
  72. package/dist/browser/index.d.ts +5 -4
  73. package/dist/browser/index.d.ts.map +1 -1
  74. package/dist/browser/index.js +3 -2
  75. package/dist/browser/index.js.map +1 -1
  76. package/dist/browser/models/index.d.ts +1 -1
  77. package/dist/browser/models/index.d.ts.map +1 -1
  78. package/dist/browser/models/index.js.map +1 -1
  79. package/dist/browser/models/models.d.ts +212 -94
  80. package/dist/browser/models/models.d.ts.map +1 -1
  81. package/dist/browser/models/models.js +245 -108
  82. package/dist/browser/models/models.js.map +1 -1
  83. package/dist/browser/static-helpers/pagingHelpers.d.ts +1 -1
  84. package/dist/browser/static-helpers/pagingHelpers.d.ts.map +1 -1
  85. package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
  86. package/dist/browser/utils/MCPTool.d.ts +78 -0
  87. package/dist/browser/utils/MCPTool.d.ts.map +1 -0
  88. package/dist/browser/utils/MCPTool.js +128 -0
  89. package/dist/browser/utils/MCPTool.js.map +1 -0
  90. package/dist/browser/{utils.d.ts → utils/utils.d.ts} +12 -1
  91. package/dist/browser/utils/utils.d.ts.map +1 -0
  92. package/dist/{esm → browser/utils}/utils.js +9 -0
  93. package/dist/browser/utils/utils.js.map +1 -0
  94. package/dist/commonjs/agentsClient.d.ts +2 -2
  95. package/dist/commonjs/agentsClient.d.ts.map +1 -1
  96. package/dist/commonjs/agentsClient.js.map +1 -1
  97. package/dist/commonjs/api/agentsContext.d.ts +2 -2
  98. package/dist/commonjs/api/agentsContext.d.ts.map +1 -1
  99. package/dist/commonjs/api/agentsContext.js +12 -24
  100. package/dist/commonjs/api/agentsContext.js.map +1 -1
  101. package/dist/commonjs/api/files/operations.d.ts +4 -4
  102. package/dist/commonjs/api/files/operations.d.ts.map +1 -1
  103. package/dist/commonjs/api/files/operations.js +23 -10
  104. package/dist/commonjs/api/files/operations.js.map +1 -1
  105. package/dist/commonjs/api/files/options.d.ts +3 -3
  106. package/dist/commonjs/api/files/options.d.ts.map +1 -1
  107. package/dist/commonjs/api/files/options.js.map +1 -1
  108. package/dist/commonjs/api/messages/operations.d.ts.map +1 -1
  109. package/dist/commonjs/api/messages/operations.js +17 -11
  110. package/dist/commonjs/api/messages/operations.js.map +1 -1
  111. package/dist/commonjs/api/operations.d.ts +7 -6
  112. package/dist/commonjs/api/operations.d.ts.map +1 -1
  113. package/dist/commonjs/api/operations.js +31 -19
  114. package/dist/commonjs/api/operations.js.map +1 -1
  115. package/dist/commonjs/api/options.d.ts +2 -2
  116. package/dist/commonjs/api/options.d.ts.map +1 -1
  117. package/dist/commonjs/api/options.js.map +1 -1
  118. package/dist/commonjs/api/runSteps/operations.d.ts.map +1 -1
  119. package/dist/commonjs/api/runSteps/operations.js +10 -6
  120. package/dist/commonjs/api/runSteps/operations.js.map +1 -1
  121. package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
  122. package/dist/commonjs/api/runs/operations.js +37 -19
  123. package/dist/commonjs/api/runs/operations.js.map +1 -1
  124. package/dist/commonjs/api/runs/options.d.ts +9 -3
  125. package/dist/commonjs/api/runs/options.d.ts.map +1 -1
  126. package/dist/commonjs/api/runs/options.js.map +1 -1
  127. package/dist/commonjs/api/threads/operations.d.ts.map +1 -1
  128. package/dist/commonjs/api/threads/operations.js +25 -15
  129. package/dist/commonjs/api/threads/operations.js.map +1 -1
  130. package/dist/commonjs/api/threads/options.d.ts +2 -2
  131. package/dist/commonjs/api/threads/options.d.ts.map +1 -1
  132. package/dist/commonjs/api/threads/options.js.map +1 -1
  133. package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts +7 -7
  134. package/dist/commonjs/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
  135. package/dist/commonjs/api/vectorStoreFileBatches/operations.js +26 -8
  136. package/dist/commonjs/api/vectorStoreFileBatches/operations.js.map +1 -1
  137. package/dist/commonjs/api/vectorStoreFileBatches/options.d.ts +3 -3
  138. package/dist/commonjs/api/vectorStoreFileBatches/options.d.ts.map +1 -1
  139. package/dist/commonjs/api/vectorStoreFileBatches/options.js.map +1 -1
  140. package/dist/commonjs/api/vectorStoreFiles/operations.d.ts.map +1 -1
  141. package/dist/commonjs/api/vectorStoreFiles/operations.js +12 -4
  142. package/dist/commonjs/api/vectorStoreFiles/operations.js.map +1 -1
  143. package/dist/commonjs/api/vectorStores/operations.d.ts.map +1 -1
  144. package/dist/commonjs/api/vectorStores/operations.js +15 -5
  145. package/dist/commonjs/api/vectorStores/operations.js.map +1 -1
  146. package/dist/commonjs/classic/runSteps/index.d.ts +0 -1
  147. package/dist/commonjs/classic/runSteps/index.d.ts.map +1 -1
  148. package/dist/commonjs/classic/runSteps/index.js.map +1 -1
  149. package/dist/commonjs/classic/runs/index.d.ts +1 -1
  150. package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
  151. package/dist/commonjs/classic/runs/index.js.map +1 -1
  152. package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts +6 -6
  153. package/dist/commonjs/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
  154. package/dist/commonjs/classic/vectorStoreFileBatches/index.js.map +1 -1
  155. package/dist/commonjs/classic/vectorStoreFiles/index.d.ts +5 -5
  156. package/dist/commonjs/classic/vectorStoreFiles/index.d.ts.map +1 -1
  157. package/dist/commonjs/classic/vectorStoreFiles/index.js +2 -0
  158. package/dist/commonjs/classic/vectorStoreFiles/index.js.map +1 -1
  159. package/dist/commonjs/classic/vectorStores/index.d.ts.map +1 -1
  160. package/dist/commonjs/classic/vectorStores/index.js.map +1 -1
  161. package/dist/commonjs/constants.d.ts +1 -1
  162. package/dist/commonjs/constants.js +1 -1
  163. package/dist/commonjs/constants.js.map +1 -1
  164. package/dist/commonjs/index.d.ts +5 -4
  165. package/dist/commonjs/index.d.ts.map +1 -1
  166. package/dist/commonjs/index.js +5 -3
  167. package/dist/commonjs/index.js.map +1 -1
  168. package/dist/commonjs/models/index.d.ts +1 -1
  169. package/dist/commonjs/models/index.d.ts.map +1 -1
  170. package/dist/commonjs/models/index.js +2 -2
  171. package/dist/commonjs/models/index.js.map +1 -1
  172. package/dist/commonjs/models/models.d.ts +212 -94
  173. package/dist/commonjs/models/models.d.ts.map +1 -1
  174. package/dist/commonjs/models/models.js +282 -125
  175. package/dist/commonjs/models/models.js.map +1 -1
  176. package/dist/commonjs/static-helpers/pagingHelpers.d.ts +1 -1
  177. package/dist/commonjs/static-helpers/pagingHelpers.d.ts.map +1 -1
  178. package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -1
  179. package/dist/commonjs/tsdoc-metadata.json +11 -11
  180. package/dist/commonjs/utils/MCPTool.d.ts +78 -0
  181. package/dist/commonjs/utils/MCPTool.d.ts.map +1 -0
  182. package/dist/commonjs/utils/MCPTool.js +132 -0
  183. package/dist/commonjs/utils/MCPTool.js.map +1 -0
  184. package/dist/commonjs/{utils.d.ts → utils/utils.d.ts} +12 -1
  185. package/dist/commonjs/utils/utils.d.ts.map +1 -0
  186. package/dist/commonjs/{utils.js → utils/utils.js} +9 -0
  187. package/dist/commonjs/utils/utils.js.map +1 -0
  188. package/dist/esm/agentsClient.d.ts +2 -2
  189. package/dist/esm/agentsClient.d.ts.map +1 -1
  190. package/dist/esm/agentsClient.js.map +1 -1
  191. package/dist/esm/api/agentsContext.d.ts +2 -2
  192. package/dist/esm/api/agentsContext.d.ts.map +1 -1
  193. package/dist/esm/api/agentsContext.js +12 -24
  194. package/dist/esm/api/agentsContext.js.map +1 -1
  195. package/dist/esm/api/files/operations.d.ts +4 -4
  196. package/dist/esm/api/files/operations.d.ts.map +1 -1
  197. package/dist/esm/api/files/operations.js +25 -12
  198. package/dist/esm/api/files/operations.js.map +1 -1
  199. package/dist/esm/api/files/options.d.ts +3 -3
  200. package/dist/esm/api/files/options.d.ts.map +1 -1
  201. package/dist/esm/api/files/options.js.map +1 -1
  202. package/dist/esm/api/messages/operations.d.ts.map +1 -1
  203. package/dist/esm/api/messages/operations.js +18 -12
  204. package/dist/esm/api/messages/operations.js.map +1 -1
  205. package/dist/esm/api/operations.d.ts +7 -6
  206. package/dist/esm/api/operations.d.ts.map +1 -1
  207. package/dist/esm/api/operations.js +34 -22
  208. package/dist/esm/api/operations.js.map +1 -1
  209. package/dist/esm/api/options.d.ts +2 -2
  210. package/dist/esm/api/options.d.ts.map +1 -1
  211. package/dist/esm/api/options.js.map +1 -1
  212. package/dist/esm/api/runSteps/operations.d.ts.map +1 -1
  213. package/dist/esm/api/runSteps/operations.js +11 -7
  214. package/dist/esm/api/runSteps/operations.js.map +1 -1
  215. package/dist/esm/api/runs/operations.d.ts.map +1 -1
  216. package/dist/esm/api/runs/operations.js +38 -20
  217. package/dist/esm/api/runs/operations.js.map +1 -1
  218. package/dist/esm/api/runs/options.d.ts +9 -3
  219. package/dist/esm/api/runs/options.d.ts.map +1 -1
  220. package/dist/esm/api/runs/options.js.map +1 -1
  221. package/dist/esm/api/threads/operations.d.ts.map +1 -1
  222. package/dist/esm/api/threads/operations.js +26 -16
  223. package/dist/esm/api/threads/operations.js.map +1 -1
  224. package/dist/esm/api/threads/options.d.ts +2 -2
  225. package/dist/esm/api/threads/options.d.ts.map +1 -1
  226. package/dist/esm/api/threads/options.js.map +1 -1
  227. package/dist/esm/api/vectorStoreFileBatches/operations.d.ts +7 -7
  228. package/dist/esm/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
  229. package/dist/esm/api/vectorStoreFileBatches/operations.js +29 -11
  230. package/dist/esm/api/vectorStoreFileBatches/operations.js.map +1 -1
  231. package/dist/esm/api/vectorStoreFileBatches/options.d.ts +3 -3
  232. package/dist/esm/api/vectorStoreFileBatches/options.d.ts.map +1 -1
  233. package/dist/esm/api/vectorStoreFileBatches/options.js.map +1 -1
  234. package/dist/esm/api/vectorStoreFiles/operations.d.ts.map +1 -1
  235. package/dist/esm/api/vectorStoreFiles/operations.js +13 -5
  236. package/dist/esm/api/vectorStoreFiles/operations.js.map +1 -1
  237. package/dist/esm/api/vectorStores/operations.d.ts.map +1 -1
  238. package/dist/esm/api/vectorStores/operations.js +16 -6
  239. package/dist/esm/api/vectorStores/operations.js.map +1 -1
  240. package/dist/esm/classic/runSteps/index.d.ts +0 -1
  241. package/dist/esm/classic/runSteps/index.d.ts.map +1 -1
  242. package/dist/esm/classic/runSteps/index.js.map +1 -1
  243. package/dist/esm/classic/runs/index.d.ts +1 -1
  244. package/dist/esm/classic/runs/index.d.ts.map +1 -1
  245. package/dist/esm/classic/runs/index.js.map +1 -1
  246. package/dist/esm/classic/vectorStoreFileBatches/index.d.ts +6 -6
  247. package/dist/esm/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
  248. package/dist/esm/classic/vectorStoreFileBatches/index.js.map +1 -1
  249. package/dist/esm/classic/vectorStoreFiles/index.d.ts +5 -5
  250. package/dist/esm/classic/vectorStoreFiles/index.d.ts.map +1 -1
  251. package/dist/esm/classic/vectorStoreFiles/index.js +2 -0
  252. package/dist/esm/classic/vectorStoreFiles/index.js.map +1 -1
  253. package/dist/esm/classic/vectorStores/index.d.ts.map +1 -1
  254. package/dist/esm/classic/vectorStores/index.js.map +1 -1
  255. package/dist/esm/constants.d.ts +1 -1
  256. package/dist/esm/constants.js +1 -1
  257. package/dist/esm/constants.js.map +1 -1
  258. package/dist/esm/index.d.ts +5 -4
  259. package/dist/esm/index.d.ts.map +1 -1
  260. package/dist/esm/index.js +3 -2
  261. package/dist/esm/index.js.map +1 -1
  262. package/dist/esm/models/index.d.ts +1 -1
  263. package/dist/esm/models/index.d.ts.map +1 -1
  264. package/dist/esm/models/index.js.map +1 -1
  265. package/dist/esm/models/models.d.ts +212 -94
  266. package/dist/esm/models/models.d.ts.map +1 -1
  267. package/dist/esm/models/models.js +245 -108
  268. package/dist/esm/models/models.js.map +1 -1
  269. package/dist/esm/static-helpers/pagingHelpers.d.ts +1 -1
  270. package/dist/esm/static-helpers/pagingHelpers.d.ts.map +1 -1
  271. package/dist/esm/static-helpers/pagingHelpers.js.map +1 -1
  272. package/dist/esm/utils/MCPTool.d.ts +78 -0
  273. package/dist/esm/utils/MCPTool.d.ts.map +1 -0
  274. package/dist/esm/utils/MCPTool.js +128 -0
  275. package/dist/esm/utils/MCPTool.js.map +1 -0
  276. package/dist/{react-native → esm/utils}/utils.d.ts +12 -1
  277. package/dist/esm/utils/utils.d.ts.map +1 -0
  278. package/dist/{react-native → esm/utils}/utils.js +9 -0
  279. package/dist/esm/utils/utils.js.map +1 -0
  280. package/dist/react-native/agentsClient.d.ts +2 -2
  281. package/dist/react-native/agentsClient.d.ts.map +1 -1
  282. package/dist/react-native/agentsClient.js.map +1 -1
  283. package/dist/react-native/api/agentsContext.d.ts +2 -2
  284. package/dist/react-native/api/agentsContext.d.ts.map +1 -1
  285. package/dist/react-native/api/agentsContext.js +12 -24
  286. package/dist/react-native/api/agentsContext.js.map +1 -1
  287. package/dist/react-native/api/files/operations.d.ts +4 -4
  288. package/dist/react-native/api/files/operations.d.ts.map +1 -1
  289. package/dist/react-native/api/files/operations.js +25 -12
  290. package/dist/react-native/api/files/operations.js.map +1 -1
  291. package/dist/react-native/api/files/options.d.ts +3 -3
  292. package/dist/react-native/api/files/options.d.ts.map +1 -1
  293. package/dist/react-native/api/files/options.js.map +1 -1
  294. package/dist/react-native/api/messages/operations.d.ts.map +1 -1
  295. package/dist/react-native/api/messages/operations.js +18 -12
  296. package/dist/react-native/api/messages/operations.js.map +1 -1
  297. package/dist/react-native/api/operations.d.ts +7 -6
  298. package/dist/react-native/api/operations.d.ts.map +1 -1
  299. package/dist/react-native/api/operations.js +34 -22
  300. package/dist/react-native/api/operations.js.map +1 -1
  301. package/dist/react-native/api/options.d.ts +2 -2
  302. package/dist/react-native/api/options.d.ts.map +1 -1
  303. package/dist/react-native/api/options.js.map +1 -1
  304. package/dist/react-native/api/runSteps/operations.d.ts.map +1 -1
  305. package/dist/react-native/api/runSteps/operations.js +11 -7
  306. package/dist/react-native/api/runSteps/operations.js.map +1 -1
  307. package/dist/react-native/api/runs/operations.d.ts.map +1 -1
  308. package/dist/react-native/api/runs/operations.js +38 -20
  309. package/dist/react-native/api/runs/operations.js.map +1 -1
  310. package/dist/react-native/api/runs/options.d.ts +9 -3
  311. package/dist/react-native/api/runs/options.d.ts.map +1 -1
  312. package/dist/react-native/api/runs/options.js.map +1 -1
  313. package/dist/react-native/api/threads/operations.d.ts.map +1 -1
  314. package/dist/react-native/api/threads/operations.js +26 -16
  315. package/dist/react-native/api/threads/operations.js.map +1 -1
  316. package/dist/react-native/api/threads/options.d.ts +2 -2
  317. package/dist/react-native/api/threads/options.d.ts.map +1 -1
  318. package/dist/react-native/api/threads/options.js.map +1 -1
  319. package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts +7 -7
  320. package/dist/react-native/api/vectorStoreFileBatches/operations.d.ts.map +1 -1
  321. package/dist/react-native/api/vectorStoreFileBatches/operations.js +29 -11
  322. package/dist/react-native/api/vectorStoreFileBatches/operations.js.map +1 -1
  323. package/dist/react-native/api/vectorStoreFileBatches/options.d.ts +3 -3
  324. package/dist/react-native/api/vectorStoreFileBatches/options.d.ts.map +1 -1
  325. package/dist/react-native/api/vectorStoreFileBatches/options.js.map +1 -1
  326. package/dist/react-native/api/vectorStoreFiles/operations.d.ts.map +1 -1
  327. package/dist/react-native/api/vectorStoreFiles/operations.js +13 -5
  328. package/dist/react-native/api/vectorStoreFiles/operations.js.map +1 -1
  329. package/dist/react-native/api/vectorStores/operations.d.ts.map +1 -1
  330. package/dist/react-native/api/vectorStores/operations.js +16 -6
  331. package/dist/react-native/api/vectorStores/operations.js.map +1 -1
  332. package/dist/react-native/classic/runSteps/index.d.ts +0 -1
  333. package/dist/react-native/classic/runSteps/index.d.ts.map +1 -1
  334. package/dist/react-native/classic/runSteps/index.js.map +1 -1
  335. package/dist/react-native/classic/runs/index.d.ts +1 -1
  336. package/dist/react-native/classic/runs/index.d.ts.map +1 -1
  337. package/dist/react-native/classic/runs/index.js.map +1 -1
  338. package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts +6 -6
  339. package/dist/react-native/classic/vectorStoreFileBatches/index.d.ts.map +1 -1
  340. package/dist/react-native/classic/vectorStoreFileBatches/index.js.map +1 -1
  341. package/dist/react-native/classic/vectorStoreFiles/index.d.ts +5 -5
  342. package/dist/react-native/classic/vectorStoreFiles/index.d.ts.map +1 -1
  343. package/dist/react-native/classic/vectorStoreFiles/index.js +2 -0
  344. package/dist/react-native/classic/vectorStoreFiles/index.js.map +1 -1
  345. package/dist/react-native/classic/vectorStores/index.d.ts.map +1 -1
  346. package/dist/react-native/classic/vectorStores/index.js.map +1 -1
  347. package/dist/react-native/constants.d.ts +1 -1
  348. package/dist/react-native/constants.js +1 -1
  349. package/dist/react-native/constants.js.map +1 -1
  350. package/dist/react-native/index.d.ts +5 -4
  351. package/dist/react-native/index.d.ts.map +1 -1
  352. package/dist/react-native/index.js +3 -2
  353. package/dist/react-native/index.js.map +1 -1
  354. package/dist/react-native/models/index.d.ts +1 -1
  355. package/dist/react-native/models/index.d.ts.map +1 -1
  356. package/dist/react-native/models/index.js.map +1 -1
  357. package/dist/react-native/models/models.d.ts +212 -94
  358. package/dist/react-native/models/models.d.ts.map +1 -1
  359. package/dist/react-native/models/models.js +245 -108
  360. package/dist/react-native/models/models.js.map +1 -1
  361. package/dist/react-native/static-helpers/pagingHelpers.d.ts +1 -1
  362. package/dist/react-native/static-helpers/pagingHelpers.d.ts.map +1 -1
  363. package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
  364. package/dist/react-native/utils/MCPTool.d.ts +78 -0
  365. package/dist/react-native/utils/MCPTool.d.ts.map +1 -0
  366. package/dist/react-native/utils/MCPTool.js +128 -0
  367. package/dist/react-native/utils/MCPTool.js.map +1 -0
  368. package/dist/{esm → react-native/utils}/utils.d.ts +12 -1
  369. package/dist/react-native/utils/utils.d.ts.map +1 -0
  370. package/dist/{browser → react-native/utils}/utils.js +9 -0
  371. package/dist/react-native/utils/utils.js.map +1 -0
  372. package/package.json +1 -1
  373. package/dist/browser/utils.d.ts.map +0 -1
  374. package/dist/browser/utils.js.map +0 -1
  375. package/dist/commonjs/utils.d.ts.map +0 -1
  376. package/dist/commonjs/utils.js.map +0 -1
  377. package/dist/esm/utils.d.ts.map +0 -1
  378. package/dist/esm/utils.js.map +0 -1
  379. package/dist/react-native/utils.d.ts.map +0 -1
  380. package/dist/react-native/utils.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
1
+ import type { Client, PathUncheckedResponse } from "@azure-rest/core-client";
2
2
  /**
3
3
  * Options for the byPage method
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pagingHelpers.d.ts","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAmB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGzF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,EAAE,IAAI,KAAK,GAAG;IAClE;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,0BAA0B,CACzC,QAAQ,EACR,KAAK,GAAG,QAAQ,EAAE,EAClB,aAAa,SAAS,YAAY,GAAG,YAAY;IAEjD;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C;;OAEG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,0BAA0B,CAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,CAA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Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.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AAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,IAAA,6BAAe,EACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.8"
9
- }
10
- ]
11
- }
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.52.8"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,78 @@
1
+ import { MCPToolDefinition, ToolResources } from "../index.js";
2
+ /**
3
+ * A tool that connects to Model Context Protocol (MCP) servers.
4
+ * Supports managing MCP server connections and allowed tools dynamically.
5
+ */
6
+ export declare class MCPTool {
7
+ private _serverLabel;
8
+ private _serverUrl;
9
+ private _allowedTools;
10
+ private _requireApproval?;
11
+ private _headers;
12
+ /**
13
+ * Constructor initializes the tool with MCP server configuration.
14
+ * @param serverLabel - The label for the MCP server
15
+ * @param serverUrl - The endpoint for the MCP server
16
+ * @param allowedTools - List of allowed tools for MCP server
17
+ */
18
+ constructor(serverLabel: string, serverUrl: string, allowedTools?: string[]);
19
+ /**
20
+ * Get the MCP tool resource.
21
+ * @returns The MCP tool resource
22
+ */
23
+ private get _resource();
24
+ /**
25
+ * Set the MCP tool definition.
26
+ * @returns The MCP tool definition
27
+ * */
28
+ private get _definition();
29
+ /**
30
+ * Get the MCP tool definition.
31
+ * @returns A list containing the MCP tool definition
32
+ */
33
+ get definitions(): MCPToolDefinition[];
34
+ /**
35
+ * Add a tool to the list of allowed tools.
36
+ * @param toolName - The name of the tool to allow
37
+ */
38
+ allowTool(toolName: string): void;
39
+ /**
40
+ * Remove a tool from the list of allowed tools.
41
+ * @param toolName - The name of the tool to remove from allowed tools
42
+ * @throws Error if the tool is not in the allowed tools list
43
+ */
44
+ disallowTool(toolName: string): void;
45
+ /**
46
+ * Update the approval mode for the MCP tool.
47
+ * @param requireApproval - The require_approval setting to update
48
+ */
49
+ setApprovalMode(requireApproval?: "always" | "never"): void;
50
+ /**
51
+ * Update the headers for the MCP tool.
52
+ * @param key - The header key to update
53
+ * @param value - The new value for the header key
54
+ * @throws Error if the key is empty
55
+ */
56
+ updateHeaders(key: string, value: string): void;
57
+ /**
58
+ * Get the server label for the MCP tool.
59
+ */
60
+ get serverLabel(): string;
61
+ /**
62
+ * Get the server URL for the MCP tool.
63
+ */
64
+ get serverUrl(): string;
65
+ /**
66
+ * Get the list of allowed tools for the MCP server.
67
+ */
68
+ get allowedTools(): string[];
69
+ /**
70
+ * Get the headers for the MCP tool.
71
+ */
72
+ get headers(): Record<string, string>;
73
+ /**
74
+ * Get the tool resources for the agent.
75
+ */
76
+ get resources(): ToolResources;
77
+ }
78
+ //# sourceMappingURL=MCPTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCPTool.d.ts","sourceRoot":"","sources":["../../../src/utils/MCPTool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,gBAAgB,CAAC,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAyB;IAEzC;;;;;OAKG;gBACS,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE;IAO3E;;;OAGG;IACH,OAAO,KAAK,SAAS,GAMpB;IAED;;;SAGK;IACL,OAAO,KAAK,WAAW,GAOtB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,iBAAiB,EAAE,CAErC;IAED;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMjC;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IASpC;;;OAGG;IACH,eAAe,CAAC,eAAe,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI;IAI3D;;;;;OAKG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ/C;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,EAAE,CAE3B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEpC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,aAAa,CAI7B;CACF"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.MCPTool = void 0;
6
+ /**
7
+ * A tool that connects to Model Context Protocol (MCP) servers.
8
+ * Supports managing MCP server connections and allowed tools dynamically.
9
+ */
10
+ class MCPTool {
11
+ /**
12
+ * Constructor initializes the tool with MCP server configuration.
13
+ * @param serverLabel - The label for the MCP server
14
+ * @param serverUrl - The endpoint for the MCP server
15
+ * @param allowedTools - List of allowed tools for MCP server
16
+ */
17
+ constructor(serverLabel, serverUrl, allowedTools) {
18
+ this._serverLabel = serverLabel;
19
+ this._serverUrl = serverUrl;
20
+ this._allowedTools = allowedTools || [];
21
+ this._requireApproval = "always"; // Default to always require approval
22
+ this._headers = {};
23
+ }
24
+ /**
25
+ * Get the MCP tool resource.
26
+ * @returns The MCP tool resource
27
+ */
28
+ get _resource() {
29
+ return {
30
+ serverLabel: this._serverLabel,
31
+ headers: this._headers,
32
+ requireApproval: this._requireApproval,
33
+ };
34
+ }
35
+ /**
36
+ * Set the MCP tool definition.
37
+ * @returns The MCP tool definition
38
+ * */
39
+ get _definition() {
40
+ return {
41
+ type: "mcp",
42
+ serverLabel: this._serverLabel,
43
+ serverUrl: this._serverUrl,
44
+ allowedTools: this._allowedTools.length > 0 ? this._allowedTools : undefined,
45
+ };
46
+ }
47
+ /**
48
+ * Get the MCP tool definition.
49
+ * @returns A list containing the MCP tool definition
50
+ */
51
+ get definitions() {
52
+ return [this._definition];
53
+ }
54
+ /**
55
+ * Add a tool to the list of allowed tools.
56
+ * @param toolName - The name of the tool to allow
57
+ */
58
+ allowTool(toolName) {
59
+ if (!this._allowedTools.includes(toolName)) {
60
+ this._allowedTools.push(toolName);
61
+ }
62
+ }
63
+ /**
64
+ * Remove a tool from the list of allowed tools.
65
+ * @param toolName - The name of the tool to remove from allowed tools
66
+ * @throws Error if the tool is not in the allowed tools list
67
+ */
68
+ disallowTool(toolName) {
69
+ const index = this._allowedTools.indexOf(toolName);
70
+ if (index > -1) {
71
+ this._allowedTools.splice(index, 1);
72
+ }
73
+ else {
74
+ throw new Error(`Tool '${toolName}' is not in the allowed tools list.`);
75
+ }
76
+ }
77
+ /**
78
+ * Update the approval mode for the MCP tool.
79
+ * @param requireApproval - The require_approval setting to update
80
+ */
81
+ setApprovalMode(requireApproval) {
82
+ this._requireApproval = requireApproval;
83
+ }
84
+ /**
85
+ * Update the headers for the MCP tool.
86
+ * @param key - The header key to update
87
+ * @param value - The new value for the header key
88
+ * @throws Error if the key is empty
89
+ */
90
+ updateHeaders(key, value) {
91
+ if (key) {
92
+ this._headers[key] = value;
93
+ }
94
+ else {
95
+ throw new Error("Header key cannot be empty.");
96
+ }
97
+ }
98
+ /**
99
+ * Get the server label for the MCP tool.
100
+ */
101
+ get serverLabel() {
102
+ return this._serverLabel;
103
+ }
104
+ /**
105
+ * Get the server URL for the MCP tool.
106
+ */
107
+ get serverUrl() {
108
+ return this._serverUrl;
109
+ }
110
+ /**
111
+ * Get the list of allowed tools for the MCP server.
112
+ */
113
+ get allowedTools() {
114
+ return [...this._allowedTools];
115
+ }
116
+ /**
117
+ * Get the headers for the MCP tool.
118
+ */
119
+ get headers() {
120
+ return Object.assign({}, this._headers);
121
+ }
122
+ /**
123
+ * Get the tool resources for the agent.
124
+ */
125
+ get resources() {
126
+ return {
127
+ mcp: [this._resource],
128
+ };
129
+ }
130
+ }
131
+ exports.MCPTool = MCPTool;
132
+ //# sourceMappingURL=MCPTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCPTool.js","sourceRoot":"","sources":["../../../src/utils/MCPTool.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC;;;GAGG;AACH,MAAa,OAAO;IAOlB;;;;;OAKG;IACH,YAAY,WAAmB,EAAE,SAAiB,EAAE,YAAuB;QACzE,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,YAAY,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,CAAC,qCAAqC;QACvE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IACD;;;OAGG;IACH,IAAY,SAAS;QACnB,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,eAAe,EAAE,IAAI,CAAC,gBAAgB;SACvC,CA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6BAA6B,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,yBAAY,IAAI,CAAC,QAAQ,EAAG;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO;YACL,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;SACtB,CAAC;IACJ,CAAC;CACF;AAvID,0BAuIC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MCPToolDefinition, MCPToolResource, ToolResources } from \"../index.js\";\n/**\n * A tool that connects to Model Context Protocol (MCP) servers.\n * Supports managing MCP server connections and allowed tools dynamically.\n */\nexport class MCPTool {\n private _serverLabel: string;\n private _serverUrl: string;\n private _allowedTools: string[];\n private _requireApproval?: \"always\" | \"never\";\n private _headers: Record<string, string>;\n\n /**\n * Constructor initializes the tool with MCP server configuration.\n * @param serverLabel - The label for the MCP server\n * @param serverUrl - The endpoint for the MCP server\n * @param allowedTools - List of allowed tools for MCP server\n */\n constructor(serverLabel: string, serverUrl: string, allowedTools?: string[]) {\n this._serverLabel = serverLabel;\n this._serverUrl = serverUrl;\n this._allowedTools = allowedTools || [];\n this._requireApproval = \"always\"; // Default to always require approval\n this._headers = {};\n }\n /**\n * Get the MCP tool resource.\n * @returns The MCP tool resource\n */\n private get _resource(): MCPToolResource {\n return {\n serverLabel: this._serverLabel,\n headers: this._headers,\n requireApproval: this._requireApproval,\n };\n }\n\n /**\n * Set the MCP tool definition.\n * @returns The MCP tool definition\n * */\n private get _definition(): MCPToolDefinition {\n return {\n type: \"mcp\",\n serverLabel: this._serverLabel,\n serverUrl: this._serverUrl,\n allowedTools: this._allowedTools.length > 0 ? this._allowedTools : undefined,\n };\n }\n\n /**\n * Get the MCP tool definition.\n * @returns A list containing the MCP tool definition\n */\n get definitions(): MCPToolDefinition[] {\n return [this._definition];\n }\n\n /**\n * Add a tool to the list of allowed tools.\n * @param toolName - The name of the tool to allow\n */\n allowTool(toolName: string): void {\n if (!this._allowedTools.includes(toolName)) {\n this._allowedTools.push(toolName);\n }\n }\n\n /**\n * Remove a tool from the list of allowed tools.\n * @param toolName - The name of the tool to remove from allowed tools\n * @throws Error if the tool is not in the allowed tools list\n */\n disallowTool(toolName: string): void {\n const index = this._allowedTools.indexOf(toolName);\n if (index > -1) {\n this._allowedTools.splice(index, 1);\n } else {\n throw new Error(`Tool '${toolName}' is not in the allowed tools list.`);\n }\n }\n\n /**\n * Update the approval mode for the MCP tool.\n * @param requireApproval - The require_approval setting to update\n */\n setApprovalMode(requireApproval?: \"always\" | \"never\"): void {\n this._requireApproval = requireApproval;\n }\n\n /**\n * Update the headers for the MCP tool.\n * @param key - The header key to update\n * @param value - The new value for the header key\n * @throws Error if the key is empty\n */\n updateHeaders(key: string, value: string): void {\n if (key) {\n this._headers[key] = value;\n } else {\n throw new Error(\"Header key cannot be empty.\");\n }\n }\n\n /**\n * Get the server label for the MCP tool.\n */\n get serverLabel(): string {\n return this._serverLabel;\n }\n\n /**\n * Get the server URL for the MCP tool.\n */\n get serverUrl(): string {\n return this._serverUrl;\n }\n\n /**\n * Get the list of allowed tools for the MCP server.\n */\n get allowedTools(): string[] {\n return [...this._allowedTools];\n }\n\n /**\n * Get the headers for the MCP tool.\n */\n get headers(): Record<string, string> {\n return { ...this._headers };\n }\n\n /**\n * Get the tool resources for the agent.\n */\n get resources(): ToolResources {\n return {\n mcp: [this._resource],\n };\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
- import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, MicrosoftFabricToolDefinition, BingCustomSearchToolDefinition, BingCustomSearchConfiguration, SharepointToolDefinition, BingGroundingSearchConfiguration, ConnectedAgentToolDefinition } from "./index.js";
1
+ import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingCustomSearchConfiguration, BingCustomSearchToolDefinition, BingGroundingToolDefinition, BingGroundingSearchConfiguration, ConnectedAgentToolDefinition, MicrosoftFabricToolDefinition, SharepointToolDefinition } from "../index.js";
2
+ import { MCPTool } from "./MCPTool.js";
2
3
  /**
3
4
  * Determines if the given output is of the specified type.
4
5
  *
@@ -143,6 +144,16 @@ export declare class ToolUtility {
143
144
  static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {
144
145
  definition: OpenApiToolDefinition;
145
146
  };
147
+ /**
148
+ * Creates an MCP tool with the provided configuration.
149
+ * @param options - Configuration options for the MCP tool
150
+ * @returns A new MCPTool instance
151
+ */
152
+ static createMCPTool(options: {
153
+ serverLabel: string;
154
+ serverUrl: string;
155
+ allowedTools?: string[];
156
+ }): MCPTool;
146
157
  }
147
158
  /**
148
159
  * Represents a set of tools with their definitions and resources.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAk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B,CAAC;KACzC;IAMD;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB;QAAE,UAAU,EAAE,4BAA4B,CAAA;KAAE;IAM/C;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,6BAA6B,CAAA;KAAE;IAMlF;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,wBAAwB,CAAA;KAAE;CAK3F"}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.ToolSet = exports.ToolUtility = exports.connectionToolType = void 0;
6
6
  exports.isOutputOfType = isOutputOfType;
7
+ const MCPTool_js_1 = require("./MCPTool.js");
7
8
  /**
8
9
  * Determines if the given output is of the specified type.
9
10
  *
@@ -252,6 +253,14 @@ class ToolUtility {
252
253
  },
253
254
  };
254
255
  }
256
+ /**
257
+ * Creates an MCP tool with the provided configuration.
258
+ * @param options - Configuration options for the MCP tool
259
+ * @returns A new MCPTool instance
260
+ */
261
+ static createMCPTool(options) {
262
+ return new MCPTool_js_1.MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);
263
+ }
255
264
  }
256
265
  exports.ToolUtility = ToolUtility;
257
266
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAqClC,wCAKC;AAfD,6CAAuC;AAEvC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4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,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAU,EACV,IAAY,EACZ,WAAmB;QAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,wBAAwB,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAoB;QAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxJD,0BAwJC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingCustomSearchConfiguration,\n BingCustomSearchToolDefinition,\n BingGroundingToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n MicrosoftFabricToolDefinition,\n SharepointToolDefinition,\n} from \"../index.js\";\nimport { MCPTool } from \"./MCPTool.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n // Ensure searchConfigurations is an array even if it's undefined\n const configs = searchConfigurations || [];\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: configs.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a connected agent tool\n *\n * @returns An object containing the definition for the connected agent tool.\n */\n static createConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n return {\n definition: {\n type: \"connected_agent\",\n connectedAgent: {\n id: id,\n name: name,\n description: description,\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n /**\n * Creates an MCP tool with the provided configuration.\n * @param options - Configuration options for the MCP tool\n * @returns A new MCPTool instance\n */\n static createMCPTool(options: {\n serverLabel: string;\n serverUrl: string;\n allowedTools?: string[];\n }): MCPTool {\n return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a connected agent tool to the tool set.\n *\n * @param id - The ID of the connected agent.\n * @param name - The name of the connected agent.\n * @param description - The description of the connected agent.\n * @returns An object containing the definition for the connected agent tool\n */\n addConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n const tool = ToolUtility.createConnectedAgentTool(id, name, description);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
@@ -11,13 +11,13 @@ import type { MessagesOperations } from "./classic/messages/index.js";
11
11
  import type { ThreadsOperations } from "./classic/threads/index.js";
12
12
  import type { PagedAsyncIterableIterator } from "./static-helpers/pagingHelpers.js";
13
13
  import type { Pipeline } from "@azure/core-rest-pipeline";
14
- import type { KeyCredential, TokenCredential } from "@azure/core-auth";
14
+ import type { TokenCredential } from "@azure/core-auth";
15
15
  export { AgentsClientOptionalParams } from "./api/agentsContext.js";
16
16
  export declare class AgentsClient {
17
17
  private _client;
18
18
  /** The pipeline used by this client to make requests */
19
19
  readonly pipeline: Pipeline;
20
- constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: AgentsClientOptionalParams);
20
+ constructor(endpointParam: string, credential: TokenCredential, options?: AgentsClientOptionalParams);
21
21
  /** The operation groups for vectorStoreFileBatches */
22
22
  readonly vectorStoreFileBatches: VectorStoreFileBatchesOperations;
23
23
  /** The operation groups for vectorStoreFiles */
@@ -1 +1 @@
1
- {"version":3,"file":"agentsClient.d.ts","sourceRoot":"","sources":["../../src/agentsClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,0BAA0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K,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext, AgentsClientOptionalParams } from \"./api/index.js\";\nimport { createAgents } from \"./api/index.js\";\nimport type { Agent, AgentDeletionStatus } from \"./models/models.js\";\nimport type {\n DeleteAgentOptionalParams,\n UpdateAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n CreateAgentOptionalParams,\n} from \"./api/options.js\";\nimport { deleteAgent, updateAgent, getAgent, listAgents, createAgent } from \"./api/operations.js\";\nimport type { VectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport { _getVectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport type { VectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport { _getVectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport type { VectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport { _getVectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport type { FilesOperations } from \"./classic/files/index.js\";\nimport { _getFilesOperations } from \"./classic/files/index.js\";\nimport type { RunStepsOperations } from \"./classic/runSteps/index.js\";\nimport { _getRunStepsOperations } from \"./classic/runSteps/index.js\";\nimport type { RunsOperations } from \"./classic/runs/index.js\";\nimport { _getRunsOperations } from \"./classic/runs/index.js\";\nimport type { MessagesOperations } from \"./classic/messages/index.js\";\nimport { _getMessagesOperations } from \"./classic/messages/index.js\";\nimport type { ThreadsOperations } from \"./classic/threads/index.js\";\nimport { _getThreadsOperations } from \"./classic/threads/index.js\";\nimport type { PagedAsyncIterableIterator } from \"./static-helpers/pagingHelpers.js\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\n\nexport { AgentsClientOptionalParams } from \"./api/agentsContext.js\";\n\nexport class AgentsClient {\n private _client: AgentsContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n constructor(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: AgentsClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createAgents(endpointParam, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.vectorStoreFileBatches = _getVectorStoreFileBatchesOperations(this._client);\n this.vectorStoreFiles = _getVectorStoreFilesOperations(this._client);\n this.vectorStores = _getVectorStoresOperations(this._client);\n this.files = _getFilesOperations(this._client);\n this.runSteps = _getRunStepsOperations(this._client);\n this.runs = _getRunsOperations(this._client);\n this.messages = _getMessagesOperations(this._client);\n this.threads = _getThreadsOperations(this._client);\n }\n\n /** The operation groups for vectorStoreFileBatches */\n public readonly vectorStoreFileBatches: VectorStoreFileBatchesOperations;\n /** The operation groups for vectorStoreFiles */\n public readonly vectorStoreFiles: VectorStoreFilesOperations;\n /** The operation groups for vectorStores */\n public readonly vectorStores: VectorStoresOperations;\n /** The operation groups for files */\n public readonly files: FilesOperations;\n /** The operation groups for runSteps */\n public readonly runSteps: RunStepsOperations;\n /** The operation groups for runs */\n public readonly runs: RunsOperations;\n /** The operation groups for messages */\n public readonly messages: MessagesOperations;\n /** The operation groups for threads */\n public readonly threads: ThreadsOperations;\n\n /** Deletes an agent. */\n deleteAgent(\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n ): Promise<AgentDeletionStatus> {\n return deleteAgent(this._client, assistantId, options);\n }\n\n /** Modifies an existing agent. */\n updateAgent(\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return updateAgent(this._client, assistantId, options);\n }\n\n /** Retrieves an existing agent. */\n getAgent(\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return getAgent(this._client, assistantId, options);\n }\n\n /** Gets a list of agents that were previously created. */\n listAgents(\n options: ListAgentsOptionalParams = { requestOptions: {} },\n ): PagedAsyncIterableIterator<Agent> {\n return listAgents(this._client, options);\n }\n\n /** Creates a new agent. */\n createAgent(\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return createAgent(this._client, model, options);\n }\n}\n"]}
1
+ {"version":3,"file":"agentsClient.js","sourceRoot":"","sources":["../../src/agentsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AAEjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOnE,MAAM,OAAO,YAAY;IAKvB,YACE,aAAqB,EACrB,UAA2B,EAC3B,UAAsC,EAAE;;QAExC,MAAM,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,0CAAE,eAAe,CAAC;QACrE,MAAM,eAAe,GAAG,iBAAiB;YACvC,CAAC,CAAC,GAAG,iBAAiB,kBAAkB;YACxC,CAAC,CAAC,iBAAiB,CAAC;QACtB,IAA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D,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,0DAA0D;IAC1D,UAAU,CACR,UAAoC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE1D,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,2BAA2B;IAC3B,WAAW,CACT,KAAa,EACb,UAAqC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE3D,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext, AgentsClientOptionalParams } from \"./api/index.js\";\nimport { createAgents } from \"./api/index.js\";\nimport type { Agent, AgentDeletionStatus } from \"./models/models.js\";\nimport type {\n DeleteAgentOptionalParams,\n UpdateAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n CreateAgentOptionalParams,\n} from \"./api/options.js\";\nimport { deleteAgent, updateAgent, getAgent, listAgents, createAgent } from \"./api/operations.js\";\nimport type { VectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport { _getVectorStoreFileBatchesOperations } from \"./classic/vectorStoreFileBatches/index.js\";\nimport type { VectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport { _getVectorStoreFilesOperations } from \"./classic/vectorStoreFiles/index.js\";\nimport type { VectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport { _getVectorStoresOperations } from \"./classic/vectorStores/index.js\";\nimport type { FilesOperations } from \"./classic/files/index.js\";\nimport { _getFilesOperations } from \"./classic/files/index.js\";\nimport type { RunStepsOperations } from \"./classic/runSteps/index.js\";\nimport { _getRunStepsOperations } from \"./classic/runSteps/index.js\";\nimport type { RunsOperations } from \"./classic/runs/index.js\";\nimport { _getRunsOperations } from \"./classic/runs/index.js\";\nimport type { MessagesOperations } from \"./classic/messages/index.js\";\nimport { _getMessagesOperations } from \"./classic/messages/index.js\";\nimport type { ThreadsOperations } from \"./classic/threads/index.js\";\nimport { _getThreadsOperations } from \"./classic/threads/index.js\";\nimport type { PagedAsyncIterableIterator } from \"./static-helpers/pagingHelpers.js\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport type { TokenCredential } from \"@azure/core-auth\";\n\nexport { AgentsClientOptionalParams } from \"./api/agentsContext.js\";\n\nexport class AgentsClient {\n private _client: AgentsContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n constructor(\n endpointParam: string,\n credential: TokenCredential,\n options: AgentsClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createAgents(endpointParam, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.vectorStoreFileBatches = _getVectorStoreFileBatchesOperations(this._client);\n this.vectorStoreFiles = _getVectorStoreFilesOperations(this._client);\n this.vectorStores = _getVectorStoresOperations(this._client);\n this.files = _getFilesOperations(this._client);\n this.runSteps = _getRunStepsOperations(this._client);\n this.runs = _getRunsOperations(this._client);\n this.messages = _getMessagesOperations(this._client);\n this.threads = _getThreadsOperations(this._client);\n }\n\n /** The operation groups for vectorStoreFileBatches */\n public readonly vectorStoreFileBatches: VectorStoreFileBatchesOperations;\n /** The operation groups for vectorStoreFiles */\n public readonly vectorStoreFiles: VectorStoreFilesOperations;\n /** The operation groups for vectorStores */\n public readonly vectorStores: VectorStoresOperations;\n /** The operation groups for files */\n public readonly files: FilesOperations;\n /** The operation groups for runSteps */\n public readonly runSteps: RunStepsOperations;\n /** The operation groups for runs */\n public readonly runs: RunsOperations;\n /** The operation groups for messages */\n public readonly messages: MessagesOperations;\n /** The operation groups for threads */\n public readonly threads: ThreadsOperations;\n\n /** Deletes an agent. */\n deleteAgent(\n assistantId: string,\n options: DeleteAgentOptionalParams = { requestOptions: {} },\n ): Promise<AgentDeletionStatus> {\n return deleteAgent(this._client, assistantId, options);\n }\n\n /** Modifies an existing agent. */\n updateAgent(\n assistantId: string,\n options: UpdateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return updateAgent(this._client, assistantId, options);\n }\n\n /** Retrieves an existing agent. */\n getAgent(\n assistantId: string,\n options: GetAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return getAgent(this._client, assistantId, options);\n }\n\n /** Gets a list of agents that were previously created. */\n listAgents(\n options: ListAgentsOptionalParams = { requestOptions: {} },\n ): PagedAsyncIterableIterator<Agent> {\n return listAgents(this._client, options);\n }\n\n /** Creates a new agent. */\n createAgent(\n model: string,\n options: CreateAgentOptionalParams = { requestOptions: {} },\n ): Promise<Agent> {\n return createAgent(this._client, model, options);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Client, ClientOptions } from "@azure-rest/core-client";
2
- import { KeyCredential, TokenCredential } from "@azure/core-auth";
2
+ import { TokenCredential } from "@azure/core-auth";
3
3
  export interface AgentsContext extends Client {
4
4
  /** The API version to use for this operation. */
5
5
  /** Known values of {@link KnownVersions} that the service accepts. */
@@ -11,5 +11,5 @@ export interface AgentsClientOptionalParams extends ClientOptions {
11
11
  /** Known values of {@link KnownVersions} that the service accepts. */
12
12
  apiVersion?: string;
13
13
  }
14
- export declare function createAgents(endpointParam: string, credential: KeyCredential | TokenCredential, options?: AgentsClientOptionalParams): AgentsContext;
14
+ export declare function createAgents(endpointParam: string, credential: TokenCredential, options?: AgentsClientOptionalParams): AgentsContext;
15
15
  //# sourceMappingURL=agentsContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentsContext.d.ts","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAa,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAmB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,0BAA2B,SAAQ,aAAa;IAC/D,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,OAAO,GAAE,0BAA+B,GACvC,aAAa,CA4Cf"}
1
+ {"version":3,"file":"agentsContext.d.ts","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAa,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,0BAA2B,SAAQ,aAAa;IAC/D,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,0BAA+B,GACvC,aAAa,CAkCf"}
@@ -3,41 +3,29 @@
3
3
  import { __rest } from "tslib";
4
4
  import { logger } from "../logger.js";
5
5
  import { getClient } from "@azure-rest/core-client";
6
- import { isKeyCredential } from "@azure/core-auth";
7
6
  export function createAgents(endpointParam, credential, options = {}) {
8
- var _a, _b, _c, _d, _e, _f;
9
- const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
10
- const userAgentInfo = `azsdk-js-ai-agents/1.0.0-beta.5`;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8
+ const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : String(endpointParam);
9
+ const prefixFromOptions = (_c = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _c === void 0 ? void 0 : _c.userAgentPrefix;
10
+ const userAgentInfo = `azsdk-js-ai-agents/1.1.0-beta.1`;
11
11
  const userAgentPrefix = prefixFromOptions
12
12
  ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
13
13
  : `azsdk-js-api ${userAgentInfo}`;
14
- const _g = Object.assign(Object.assign({}, options), { userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: (_c = (_b = options.loggingOptions) === null || _b === void 0 ? void 0 : _b.logger) !== null && _c !== void 0 ? _c : logger.info }, credentials: {
15
- scopes: (_e = (_d = options.credentials) === null || _d === void 0 ? void 0 : _d.scopes) !== null && _e !== void 0 ? _e : ["https://ai.azure.com/.default"],
16
- } }), { apiVersion: _ } = _g, updatedOptions = __rest(_g, ["apiVersion"]);
17
- const clientContext = getClient(endpointParam, credential, updatedOptions);
18
- if (isKeyCredential(credential)) {
19
- clientContext.pipeline.addPolicy({
20
- name: "customKeyCredentialPolicy",
21
- sendRequest(request, next) {
22
- request.headers.set("Authorization", "Bearer " + credential.key);
23
- return next(request);
24
- },
25
- });
26
- }
14
+ const _j = Object.assign(Object.assign({}, options), { userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info }, credentials: {
15
+ scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://ai.azure.com/.default"],
16
+ } }), { apiVersion: _ } = _j, updatedOptions = __rest(_j, ["apiVersion"]);
17
+ const clientContext = getClient(endpointUrl, credential, updatedOptions);
27
18
  clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
28
- const apiVersion = (_f = options.apiVersion) !== null && _f !== void 0 ? _f : "2025-05-15-preview";
19
+ const apiVersion = (_h = options.apiVersion) !== null && _h !== void 0 ? _h : "2025-05-15-preview";
29
20
  clientContext.pipeline.addPolicy({
30
21
  name: "ClientApiVersionPolicy",
31
22
  sendRequest: (req, next) => {
32
- var _a;
33
23
  // Use the apiVersion defined in request url directly
34
24
  // Append one if there is no apiVersion and we have one at client options
35
25
  const url = new URL(req.url);
36
- const defaultApiVersion = (_a = url.searchParams.get("api-version")) !== null && _a !== void 0 ? _a : apiVersion;
37
- // remove api-version from url
38
- url.searchParams.delete("api-version");
39
- // add api-version to url
40
- req.url = `${url.toString()}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${defaultApiVersion}`;
26
+ if (!url.searchParams.get("api-version")) {
27
+ req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
28
+ }
41
29
  return next(req);
42
30
  },
43
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AAenF,MAAM,UAAU,YAAY,CAC1B,aAAqB,EACrB,UAA2C,EAC3C,UAAsC,EAAE;;IAExC,MAAM,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,0CAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,iCAAiC,CAAC;IACxD,MAAM,eAAe,GAAG,iBAAiB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AC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,iBAAiB,GAAG,MAAA,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,mCAAI,UAAU,CAAC;YAC5E,8BAA8B;YAC9B,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACvC,yBAAyB;YACzB,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,GACzB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,iBAAiB,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,gCAAK,aAAa,KAAE,UAAU,GAAmB,CAAC;AAC3D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { KeyCredential, isKeyCredential, TokenCredential } from \"@azure/core-auth\";\n\nexport interface AgentsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface AgentsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createAgents(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: AgentsClientOptionalParams = {},\n): AgentsContext {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.0.0-beta.5`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointParam, credential, updatedOptions);\n\n if (isKeyCredential(credential)) {\n clientContext.pipeline.addPolicy({\n name: \"customKeyCredentialPolicy\",\n sendRequest(request, next) {\n request.headers.set(\"Authorization\", \"Bearer \" + credential.key);\n return next(request);\n },\n });\n }\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2025-05-15-preview\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n const defaultApiVersion = url.searchParams.get(\"api-version\") ?? apiVersion;\n // remove api-version from url\n url.searchParams.delete(\"api-version\");\n // add api-version to url\n req.url = `${url.toString()}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${defaultApiVersion}`;\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AgentsContext;\n}\n"]}
1
+ {"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAgB3E,MAAM,UAAU,YAAY,CAC1B,aAAqB,EACrB,UAA2B,EAC3B,UAAsC,EAAE;;IAExC,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IACjF,MAAM,iBAAiB,GAAG,MAAA,OAAO,a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,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,gCAAK,aAAa,KAAE,UAAU,GAAmB,CAAC;AAC3D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface AgentsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface AgentsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createAgents(\n endpointParam: string,\n credential: TokenCredential,\n options: AgentsClientOptionalParams = {},\n): AgentsContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.1.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2025-05-15-preview\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AgentsContext;\n}\n"]}