scorecard-ai-mcp 2.5.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (416) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +14 -225
  3. package/code-tool-types.d.mts +6 -7
  4. package/code-tool-types.d.mts.map +1 -1
  5. package/code-tool-types.d.ts +6 -7
  6. package/code-tool-types.d.ts.map +1 -1
  7. package/code-tool.d.mts +2 -2
  8. package/code-tool.d.mts.map +1 -1
  9. package/code-tool.d.ts +2 -2
  10. package/code-tool.d.ts.map +1 -1
  11. package/code-tool.js +54 -128
  12. package/code-tool.js.map +1 -1
  13. package/code-tool.mjs +54 -95
  14. package/code-tool.mjs.map +1 -1
  15. package/docs-search-tool.d.mts +15 -9
  16. package/docs-search-tool.d.mts.map +1 -1
  17. package/docs-search-tool.d.ts +15 -9
  18. package/docs-search-tool.d.ts.map +1 -1
  19. package/docs-search-tool.js +11 -3
  20. package/docs-search-tool.js.map +1 -1
  21. package/docs-search-tool.mjs +11 -3
  22. package/docs-search-tool.mjs.map +1 -1
  23. package/http.d.mts.map +1 -1
  24. package/http.d.ts.map +1 -1
  25. package/http.js +1 -18
  26. package/http.js.map +1 -1
  27. package/http.mjs +1 -18
  28. package/http.mjs.map +1 -1
  29. package/index.js +4 -40
  30. package/index.js.map +1 -1
  31. package/index.mjs +4 -40
  32. package/index.mjs.map +1 -1
  33. package/options.d.mts +0 -9
  34. package/options.d.mts.map +1 -1
  35. package/options.d.ts +0 -9
  36. package/options.d.ts.map +1 -1
  37. package/options.js +6 -361
  38. package/options.js.map +1 -1
  39. package/options.mjs +6 -361
  40. package/options.mjs.map +1 -1
  41. package/package.json +10 -66
  42. package/server.d.mts +3 -8
  43. package/server.d.mts.map +1 -1
  44. package/server.d.ts +3 -8
  45. package/server.d.ts.map +1 -1
  46. package/server.js +12 -65
  47. package/server.js.map +1 -1
  48. package/server.mjs +11 -62
  49. package/server.mjs.map +1 -1
  50. package/src/code-tool-types.ts +6 -5
  51. package/src/code-tool.ts +63 -117
  52. package/src/docs-search-tool.ts +15 -4
  53. package/src/http.ts +1 -19
  54. package/src/index.ts +5 -52
  55. package/src/options.ts +7 -388
  56. package/src/server.ts +12 -72
  57. package/src/stdio.ts +2 -3
  58. package/src/{tools/types.ts → types.ts} +1 -1
  59. package/stdio.d.mts +1 -2
  60. package/stdio.d.mts.map +1 -1
  61. package/stdio.d.ts +1 -2
  62. package/stdio.d.ts.map +1 -1
  63. package/stdio.js +2 -2
  64. package/stdio.js.map +1 -1
  65. package/stdio.mjs +2 -2
  66. package/stdio.mjs.map +1 -1
  67. package/{tools/types.d.mts → types.d.mts} +1 -1
  68. package/types.d.mts.map +1 -0
  69. package/{tools/types.d.ts → types.d.ts} +1 -1
  70. package/types.d.ts.map +1 -0
  71. package/types.js.map +1 -0
  72. package/types.mjs.map +1 -0
  73. package/code-tool-paths.cjs +0 -6
  74. package/code-tool-paths.cjs.map +0 -1
  75. package/code-tool-paths.d.cts +0 -2
  76. package/code-tool-paths.d.cts.map +0 -1
  77. package/code-tool-worker.d.mts +0 -5
  78. package/code-tool-worker.d.mts.map +0 -1
  79. package/code-tool-worker.d.ts +0 -5
  80. package/code-tool-worker.d.ts.map +0 -1
  81. package/code-tool-worker.js +0 -179
  82. package/code-tool-worker.js.map +0 -1
  83. package/code-tool-worker.mjs +0 -174
  84. package/code-tool-worker.mjs.map +0 -1
  85. package/compat.d.mts +0 -58
  86. package/compat.d.mts.map +0 -1
  87. package/compat.d.ts +0 -58
  88. package/compat.d.ts.map +0 -1
  89. package/compat.js +0 -387
  90. package/compat.js.map +0 -1
  91. package/compat.mjs +0 -378
  92. package/compat.mjs.map +0 -1
  93. package/dynamic-tools.d.mts +0 -12
  94. package/dynamic-tools.d.mts.map +0 -1
  95. package/dynamic-tools.d.ts +0 -12
  96. package/dynamic-tools.d.ts.map +0 -1
  97. package/dynamic-tools.js +0 -135
  98. package/dynamic-tools.js.map +0 -1
  99. package/dynamic-tools.mjs +0 -132
  100. package/dynamic-tools.mjs.map +0 -1
  101. package/filtering.d.mts +0 -3
  102. package/filtering.d.mts.map +0 -1
  103. package/filtering.d.ts +0 -3
  104. package/filtering.d.ts.map +0 -1
  105. package/filtering.js +0 -24
  106. package/filtering.js.map +0 -1
  107. package/filtering.mjs +0 -16
  108. package/filtering.mjs.map +0 -1
  109. package/src/code-tool-paths.cts +0 -3
  110. package/src/code-tool-worker.ts +0 -225
  111. package/src/compat.ts +0 -483
  112. package/src/dynamic-tools.ts +0 -159
  113. package/src/filtering.ts +0 -18
  114. package/src/tools/index.ts +0 -131
  115. package/src/tools/metrics/create-metrics.ts +0 -376
  116. package/src/tools/metrics/delete-metrics.ts +0 -54
  117. package/src/tools/metrics/get-metrics.ts +0 -39
  118. package/src/tools/metrics/list-metrics.ts +0 -51
  119. package/src/tools/metrics/update-metrics.ts +0 -376
  120. package/src/tools/projects/create-projects.ts +0 -57
  121. package/src/tools/projects/list-projects.ts +0 -62
  122. package/src/tools/records/create-records.ts +0 -71
  123. package/src/tools/records/delete-records.ts +0 -54
  124. package/src/tools/records/list-records.ts +0 -65
  125. package/src/tools/runs/create-runs.ts +0 -67
  126. package/src/tools/runs/get-runs.ts +0 -54
  127. package/src/tools/runs/list-runs.ts +0 -65
  128. package/src/tools/scores/upsert-scores.ts +0 -65
  129. package/src/tools/systems/delete-systems.ts +0 -54
  130. package/src/tools/systems/get-systems.ts +0 -54
  131. package/src/tools/systems/list-systems.ts +0 -65
  132. package/src/tools/systems/update-systems.ts +0 -64
  133. package/src/tools/systems/upsert-systems.ts +0 -66
  134. package/src/tools/systems/versions/get-systems-versions.ts +0 -56
  135. package/src/tools/systems/versions/upsert-systems-versions.ts +0 -64
  136. package/src/tools/testcases/create-testcases.ts +0 -67
  137. package/src/tools/testcases/delete-testcases.ts +0 -56
  138. package/src/tools/testcases/get-testcases.ts +0 -54
  139. package/src/tools/testcases/list-testcases.ts +0 -65
  140. package/src/tools/testcases/update-testcases.ts +0 -59
  141. package/src/tools/testsets/create-testsets.ts +0 -94
  142. package/src/tools/testsets/delete-testsets.ts +0 -54
  143. package/src/tools/testsets/get-testsets.ts +0 -54
  144. package/src/tools/testsets/list-testsets.ts +0 -65
  145. package/src/tools/testsets/update-testsets.ts +0 -94
  146. package/src/tools.ts +0 -1
  147. package/tools/index.d.mts +0 -10
  148. package/tools/index.d.mts.map +0 -1
  149. package/tools/index.d.ts +0 -10
  150. package/tools/index.d.ts.map +0 -1
  151. package/tools/index.js +0 -115
  152. package/tools/index.js.map +0 -1
  153. package/tools/index.mjs +0 -108
  154. package/tools/index.mjs.map +0 -1
  155. package/tools/metrics/create-metrics.d.mts +0 -45
  156. package/tools/metrics/create-metrics.d.mts.map +0 -1
  157. package/tools/metrics/create-metrics.d.ts +0 -45
  158. package/tools/metrics/create-metrics.d.ts.map +0 -1
  159. package/tools/metrics/create-metrics.js +0 -369
  160. package/tools/metrics/create-metrics.js.map +0 -1
  161. package/tools/metrics/create-metrics.mjs +0 -365
  162. package/tools/metrics/create-metrics.mjs.map +0 -1
  163. package/tools/metrics/delete-metrics.d.mts +0 -45
  164. package/tools/metrics/delete-metrics.d.mts.map +0 -1
  165. package/tools/metrics/delete-metrics.d.ts +0 -45
  166. package/tools/metrics/delete-metrics.d.ts.map +0 -1
  167. package/tools/metrics/delete-metrics.js +0 -50
  168. package/tools/metrics/delete-metrics.js.map +0 -1
  169. package/tools/metrics/delete-metrics.mjs +0 -46
  170. package/tools/metrics/delete-metrics.mjs.map +0 -1
  171. package/tools/metrics/get-metrics.d.mts +0 -45
  172. package/tools/metrics/get-metrics.d.mts.map +0 -1
  173. package/tools/metrics/get-metrics.d.ts +0 -45
  174. package/tools/metrics/get-metrics.d.ts.map +0 -1
  175. package/tools/metrics/get-metrics.js +0 -36
  176. package/tools/metrics/get-metrics.js.map +0 -1
  177. package/tools/metrics/get-metrics.mjs +0 -32
  178. package/tools/metrics/get-metrics.mjs.map +0 -1
  179. package/tools/metrics/list-metrics.d.mts +0 -45
  180. package/tools/metrics/list-metrics.d.mts.map +0 -1
  181. package/tools/metrics/list-metrics.d.ts +0 -45
  182. package/tools/metrics/list-metrics.d.ts.map +0 -1
  183. package/tools/metrics/list-metrics.js +0 -45
  184. package/tools/metrics/list-metrics.js.map +0 -1
  185. package/tools/metrics/list-metrics.mjs +0 -41
  186. package/tools/metrics/list-metrics.mjs.map +0 -1
  187. package/tools/metrics/update-metrics.d.mts +0 -45
  188. package/tools/metrics/update-metrics.d.mts.map +0 -1
  189. package/tools/metrics/update-metrics.d.ts +0 -45
  190. package/tools/metrics/update-metrics.d.ts.map +0 -1
  191. package/tools/metrics/update-metrics.js +0 -369
  192. package/tools/metrics/update-metrics.js.map +0 -1
  193. package/tools/metrics/update-metrics.mjs +0 -365
  194. package/tools/metrics/update-metrics.mjs.map +0 -1
  195. package/tools/projects/create-projects.d.mts +0 -45
  196. package/tools/projects/create-projects.d.mts.map +0 -1
  197. package/tools/projects/create-projects.d.ts +0 -45
  198. package/tools/projects/create-projects.d.ts.map +0 -1
  199. package/tools/projects/create-projects.js +0 -53
  200. package/tools/projects/create-projects.js.map +0 -1
  201. package/tools/projects/create-projects.mjs +0 -49
  202. package/tools/projects/create-projects.mjs.map +0 -1
  203. package/tools/projects/list-projects.d.mts +0 -45
  204. package/tools/projects/list-projects.d.mts.map +0 -1
  205. package/tools/projects/list-projects.d.ts +0 -45
  206. package/tools/projects/list-projects.d.ts.map +0 -1
  207. package/tools/projects/list-projects.js +0 -56
  208. package/tools/projects/list-projects.js.map +0 -1
  209. package/tools/projects/list-projects.mjs +0 -52
  210. package/tools/projects/list-projects.mjs.map +0 -1
  211. package/tools/records/create-records.d.mts +0 -45
  212. package/tools/records/create-records.d.mts.map +0 -1
  213. package/tools/records/create-records.d.ts +0 -45
  214. package/tools/records/create-records.d.ts.map +0 -1
  215. package/tools/records/create-records.js +0 -67
  216. package/tools/records/create-records.js.map +0 -1
  217. package/tools/records/create-records.mjs +0 -63
  218. package/tools/records/create-records.mjs.map +0 -1
  219. package/tools/records/delete-records.d.mts +0 -45
  220. package/tools/records/delete-records.d.mts.map +0 -1
  221. package/tools/records/delete-records.d.ts +0 -45
  222. package/tools/records/delete-records.d.ts.map +0 -1
  223. package/tools/records/delete-records.js +0 -50
  224. package/tools/records/delete-records.js.map +0 -1
  225. package/tools/records/delete-records.mjs +0 -46
  226. package/tools/records/delete-records.mjs.map +0 -1
  227. package/tools/records/list-records.d.mts +0 -45
  228. package/tools/records/list-records.d.mts.map +0 -1
  229. package/tools/records/list-records.d.ts +0 -45
  230. package/tools/records/list-records.d.ts.map +0 -1
  231. package/tools/records/list-records.js +0 -59
  232. package/tools/records/list-records.js.map +0 -1
  233. package/tools/records/list-records.mjs +0 -55
  234. package/tools/records/list-records.mjs.map +0 -1
  235. package/tools/runs/create-runs.d.mts +0 -45
  236. package/tools/runs/create-runs.d.mts.map +0 -1
  237. package/tools/runs/create-runs.d.ts +0 -45
  238. package/tools/runs/create-runs.d.ts.map +0 -1
  239. package/tools/runs/create-runs.js +0 -63
  240. package/tools/runs/create-runs.js.map +0 -1
  241. package/tools/runs/create-runs.mjs +0 -59
  242. package/tools/runs/create-runs.mjs.map +0 -1
  243. package/tools/runs/get-runs.d.mts +0 -45
  244. package/tools/runs/get-runs.d.mts.map +0 -1
  245. package/tools/runs/get-runs.d.ts +0 -45
  246. package/tools/runs/get-runs.d.ts.map +0 -1
  247. package/tools/runs/get-runs.js +0 -50
  248. package/tools/runs/get-runs.js.map +0 -1
  249. package/tools/runs/get-runs.mjs +0 -46
  250. package/tools/runs/get-runs.mjs.map +0 -1
  251. package/tools/runs/list-runs.d.mts +0 -45
  252. package/tools/runs/list-runs.d.mts.map +0 -1
  253. package/tools/runs/list-runs.d.ts +0 -45
  254. package/tools/runs/list-runs.d.ts.map +0 -1
  255. package/tools/runs/list-runs.js +0 -59
  256. package/tools/runs/list-runs.js.map +0 -1
  257. package/tools/runs/list-runs.mjs +0 -55
  258. package/tools/runs/list-runs.mjs.map +0 -1
  259. package/tools/scores/upsert-scores.d.mts +0 -45
  260. package/tools/scores/upsert-scores.d.mts.map +0 -1
  261. package/tools/scores/upsert-scores.d.ts +0 -45
  262. package/tools/scores/upsert-scores.d.ts.map +0 -1
  263. package/tools/scores/upsert-scores.js +0 -58
  264. package/tools/scores/upsert-scores.js.map +0 -1
  265. package/tools/scores/upsert-scores.mjs +0 -54
  266. package/tools/scores/upsert-scores.mjs.map +0 -1
  267. package/tools/systems/delete-systems.d.mts +0 -45
  268. package/tools/systems/delete-systems.d.mts.map +0 -1
  269. package/tools/systems/delete-systems.d.ts +0 -45
  270. package/tools/systems/delete-systems.d.ts.map +0 -1
  271. package/tools/systems/delete-systems.js +0 -50
  272. package/tools/systems/delete-systems.js.map +0 -1
  273. package/tools/systems/delete-systems.mjs +0 -46
  274. package/tools/systems/delete-systems.mjs.map +0 -1
  275. package/tools/systems/get-systems.d.mts +0 -45
  276. package/tools/systems/get-systems.d.mts.map +0 -1
  277. package/tools/systems/get-systems.d.ts +0 -45
  278. package/tools/systems/get-systems.d.ts.map +0 -1
  279. package/tools/systems/get-systems.js +0 -50
  280. package/tools/systems/get-systems.js.map +0 -1
  281. package/tools/systems/get-systems.mjs +0 -46
  282. package/tools/systems/get-systems.mjs.map +0 -1
  283. package/tools/systems/list-systems.d.mts +0 -45
  284. package/tools/systems/list-systems.d.mts.map +0 -1
  285. package/tools/systems/list-systems.d.ts +0 -45
  286. package/tools/systems/list-systems.d.ts.map +0 -1
  287. package/tools/systems/list-systems.js +0 -59
  288. package/tools/systems/list-systems.js.map +0 -1
  289. package/tools/systems/list-systems.mjs +0 -55
  290. package/tools/systems/list-systems.mjs.map +0 -1
  291. package/tools/systems/update-systems.d.mts +0 -45
  292. package/tools/systems/update-systems.d.mts.map +0 -1
  293. package/tools/systems/update-systems.d.ts +0 -45
  294. package/tools/systems/update-systems.d.ts.map +0 -1
  295. package/tools/systems/update-systems.js +0 -60
  296. package/tools/systems/update-systems.js.map +0 -1
  297. package/tools/systems/update-systems.mjs +0 -56
  298. package/tools/systems/update-systems.mjs.map +0 -1
  299. package/tools/systems/upsert-systems.d.mts +0 -45
  300. package/tools/systems/upsert-systems.d.mts.map +0 -1
  301. package/tools/systems/upsert-systems.d.ts +0 -45
  302. package/tools/systems/upsert-systems.d.ts.map +0 -1
  303. package/tools/systems/upsert-systems.js +0 -61
  304. package/tools/systems/upsert-systems.js.map +0 -1
  305. package/tools/systems/upsert-systems.mjs +0 -57
  306. package/tools/systems/upsert-systems.mjs.map +0 -1
  307. package/tools/systems/versions/get-systems-versions.d.mts +0 -45
  308. package/tools/systems/versions/get-systems-versions.d.mts.map +0 -1
  309. package/tools/systems/versions/get-systems-versions.d.ts +0 -45
  310. package/tools/systems/versions/get-systems-versions.d.ts.map +0 -1
  311. package/tools/systems/versions/get-systems-versions.js +0 -50
  312. package/tools/systems/versions/get-systems-versions.js.map +0 -1
  313. package/tools/systems/versions/get-systems-versions.mjs +0 -46
  314. package/tools/systems/versions/get-systems-versions.mjs.map +0 -1
  315. package/tools/systems/versions/upsert-systems-versions.d.mts +0 -45
  316. package/tools/systems/versions/upsert-systems-versions.d.mts.map +0 -1
  317. package/tools/systems/versions/upsert-systems-versions.d.ts +0 -45
  318. package/tools/systems/versions/upsert-systems-versions.d.ts.map +0 -1
  319. package/tools/systems/versions/upsert-systems-versions.js +0 -57
  320. package/tools/systems/versions/upsert-systems-versions.js.map +0 -1
  321. package/tools/systems/versions/upsert-systems-versions.mjs +0 -53
  322. package/tools/systems/versions/upsert-systems-versions.mjs.map +0 -1
  323. package/tools/testcases/create-testcases.d.mts +0 -45
  324. package/tools/testcases/create-testcases.d.mts.map +0 -1
  325. package/tools/testcases/create-testcases.d.ts +0 -45
  326. package/tools/testcases/create-testcases.d.ts.map +0 -1
  327. package/tools/testcases/create-testcases.js +0 -63
  328. package/tools/testcases/create-testcases.js.map +0 -1
  329. package/tools/testcases/create-testcases.mjs +0 -59
  330. package/tools/testcases/create-testcases.mjs.map +0 -1
  331. package/tools/testcases/delete-testcases.d.mts +0 -45
  332. package/tools/testcases/delete-testcases.d.mts.map +0 -1
  333. package/tools/testcases/delete-testcases.d.ts +0 -45
  334. package/tools/testcases/delete-testcases.d.ts.map +0 -1
  335. package/tools/testcases/delete-testcases.js +0 -52
  336. package/tools/testcases/delete-testcases.js.map +0 -1
  337. package/tools/testcases/delete-testcases.mjs +0 -48
  338. package/tools/testcases/delete-testcases.mjs.map +0 -1
  339. package/tools/testcases/get-testcases.d.mts +0 -45
  340. package/tools/testcases/get-testcases.d.mts.map +0 -1
  341. package/tools/testcases/get-testcases.d.ts +0 -45
  342. package/tools/testcases/get-testcases.d.ts.map +0 -1
  343. package/tools/testcases/get-testcases.js +0 -50
  344. package/tools/testcases/get-testcases.js.map +0 -1
  345. package/tools/testcases/get-testcases.mjs +0 -46
  346. package/tools/testcases/get-testcases.mjs.map +0 -1
  347. package/tools/testcases/list-testcases.d.mts +0 -45
  348. package/tools/testcases/list-testcases.d.mts.map +0 -1
  349. package/tools/testcases/list-testcases.d.ts +0 -45
  350. package/tools/testcases/list-testcases.d.ts.map +0 -1
  351. package/tools/testcases/list-testcases.js +0 -59
  352. package/tools/testcases/list-testcases.js.map +0 -1
  353. package/tools/testcases/list-testcases.mjs +0 -55
  354. package/tools/testcases/list-testcases.mjs.map +0 -1
  355. package/tools/testcases/update-testcases.d.mts +0 -45
  356. package/tools/testcases/update-testcases.d.mts.map +0 -1
  357. package/tools/testcases/update-testcases.d.ts +0 -45
  358. package/tools/testcases/update-testcases.d.ts.map +0 -1
  359. package/tools/testcases/update-testcases.js +0 -55
  360. package/tools/testcases/update-testcases.js.map +0 -1
  361. package/tools/testcases/update-testcases.mjs +0 -51
  362. package/tools/testcases/update-testcases.mjs.map +0 -1
  363. package/tools/testsets/create-testsets.d.mts +0 -45
  364. package/tools/testsets/create-testsets.d.mts.map +0 -1
  365. package/tools/testsets/create-testsets.d.ts +0 -45
  366. package/tools/testsets/create-testsets.d.ts.map +0 -1
  367. package/tools/testsets/create-testsets.js +0 -89
  368. package/tools/testsets/create-testsets.js.map +0 -1
  369. package/tools/testsets/create-testsets.mjs +0 -85
  370. package/tools/testsets/create-testsets.mjs.map +0 -1
  371. package/tools/testsets/delete-testsets.d.mts +0 -45
  372. package/tools/testsets/delete-testsets.d.mts.map +0 -1
  373. package/tools/testsets/delete-testsets.d.ts +0 -45
  374. package/tools/testsets/delete-testsets.d.ts.map +0 -1
  375. package/tools/testsets/delete-testsets.js +0 -50
  376. package/tools/testsets/delete-testsets.js.map +0 -1
  377. package/tools/testsets/delete-testsets.mjs +0 -46
  378. package/tools/testsets/delete-testsets.mjs.map +0 -1
  379. package/tools/testsets/get-testsets.d.mts +0 -45
  380. package/tools/testsets/get-testsets.d.mts.map +0 -1
  381. package/tools/testsets/get-testsets.d.ts +0 -45
  382. package/tools/testsets/get-testsets.d.ts.map +0 -1
  383. package/tools/testsets/get-testsets.js +0 -50
  384. package/tools/testsets/get-testsets.js.map +0 -1
  385. package/tools/testsets/get-testsets.mjs +0 -46
  386. package/tools/testsets/get-testsets.mjs.map +0 -1
  387. package/tools/testsets/list-testsets.d.mts +0 -45
  388. package/tools/testsets/list-testsets.d.mts.map +0 -1
  389. package/tools/testsets/list-testsets.d.ts +0 -45
  390. package/tools/testsets/list-testsets.d.ts.map +0 -1
  391. package/tools/testsets/list-testsets.js +0 -59
  392. package/tools/testsets/list-testsets.js.map +0 -1
  393. package/tools/testsets/list-testsets.mjs +0 -55
  394. package/tools/testsets/list-testsets.mjs.map +0 -1
  395. package/tools/testsets/update-testsets.d.mts +0 -45
  396. package/tools/testsets/update-testsets.d.mts.map +0 -1
  397. package/tools/testsets/update-testsets.d.ts +0 -45
  398. package/tools/testsets/update-testsets.d.ts.map +0 -1
  399. package/tools/testsets/update-testsets.js +0 -89
  400. package/tools/testsets/update-testsets.js.map +0 -1
  401. package/tools/testsets/update-testsets.mjs +0 -85
  402. package/tools/testsets/update-testsets.mjs.map +0 -1
  403. package/tools/types.d.mts.map +0 -1
  404. package/tools/types.d.ts.map +0 -1
  405. package/tools/types.js.map +0 -1
  406. package/tools/types.mjs.map +0 -1
  407. package/tools.d.mts +0 -2
  408. package/tools.d.mts.map +0 -1
  409. package/tools.d.ts +0 -2
  410. package/tools.d.ts.map +0 -1
  411. package/tools.js +0 -18
  412. package/tools.js.map +0 -1
  413. package/tools.mjs +0 -2
  414. package/tools.mjs.map +0 -1
  415. /package/{tools/types.js → types.js} +0 -0
  416. /package/{tools/types.mjs → types.mjs} +0 -0
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2025 Scorecard
189
+ Copyright 2026 Scorecard
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -26,7 +26,7 @@ For clients with a configuration JSON, it might look something like this:
26
26
  "mcpServers": {
27
27
  "scorecard_ai_api": {
28
28
  "command": "npx",
29
- "args": ["-y", "scorecard-ai-mcp", "--client=claude", "--tools=dynamic"],
29
+ "args": ["-y", "scorecard-ai-mcp"],
30
30
  "env": {
31
31
  "SCORECARD_API_KEY": "My API Key",
32
32
  "SCORECARD_ENVIRONMENT": "production"
@@ -56,113 +56,25 @@ If you use Claude Code, you can install the MCP server by running the command be
56
56
  environment variables in Claude Code's `.claude.json`, which can be found in your home directory.
57
57
 
58
58
  ```
59
- claude mcp add --transport stdio scorecard_ai_api --env SCORECARD_API_KEY="Your SCORECARD_API_KEY here." -- npx -y scorecard-ai-mcp
59
+ claude mcp add scorecard_ai_mcp_api --env SCORECARD_API_KEY="Your SCORECARD_API_KEY here." -- npx -y scorecard-ai-mcp
60
60
  ```
61
61
 
62
- ## Exposing endpoints to your MCP Client
62
+ ## Code Mode
63
63
 
64
- There are three ways to expose endpoints as tools in the MCP server:
64
+ This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
65
+ your agent will write code against the TypeScript SDK, which will then be executed in an
66
+ isolated sandbox. To accomplish this, the server will expose two tools to your agent:
65
67
 
66
- 1. Exposing one tool per endpoint, and filtering as necessary
67
- 2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
68
- 3. Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
68
+ - The first tool is a docs search tool, which can be used to generically query for
69
+ documentation about your API/SDK.
69
70
 
70
- ### Filtering endpoints and tools
71
+ - The second tool is a code tool, where the agent can write code against the TypeScript SDK.
72
+ The code will be executed in a sandbox environment without web or filesystem access. Then,
73
+ anything the code returns or prints will be returned to the agent as the result of the
74
+ tool call.
71
75
 
72
- You can run the package on the command line to discover and filter the set of tools that are exposed by the
73
- MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
74
- context window.
75
-
76
- You can filter by multiple aspects:
77
-
78
- - `--tool` includes a specific tool by name
79
- - `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
80
- - `--operation` includes just read (get/list) or just write operations
81
-
82
- ### Dynamic tools
83
-
84
- If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
85
- expose the following tools:
86
-
87
- 1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
88
- 2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
89
- 3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
90
-
91
- This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
92
- of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
93
- search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
94
- can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
95
- you can opt-in to explicit tools, the dynamic tools, or both.
96
-
97
- See more information with `--help`.
98
-
99
- All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
100
-
101
- Use `--list` to see the list of available tools, or see below.
102
-
103
- ### Code execution
104
-
105
- If you specify `--tools=code` to the MCP server, it will expose just two tools:
106
-
107
- - `search_docs` - Searches the API documentation and returns a list of markdown results
108
- - `execute` - Runs code against the TypeScript client
109
-
110
- This allows the LLM to implement more complex logic by chaining together many API calls without loading
111
- intermediary results into its context window.
112
-
113
- The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.
114
-
115
- ### Specifying the MCP Client
116
-
117
- Different clients have varying abilities to handle arbitrary tools and schemas.
118
-
119
- You can specify the client you are using with the `--client` argument, and the MCP server will automatically
120
- serve tools and schemas that are more compatible with that client.
121
-
122
- - `--client=<type>`: Set all capabilities based on a known MCP client
123
-
124
- - Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
125
- - Example: `--client=cursor`
126
-
127
- Additionally, if you have a client not on the above list, or the client has gotten better
128
- over time, you can manually enable or disable certain capabilities:
129
-
130
- - `--capability=<name>`: Specify individual client capabilities
131
- - Available capabilities:
132
- - `top-level-unions`: Enable support for top-level unions in tool schemas
133
- - `valid-json`: Enable JSON string parsing for arguments
134
- - `refs`: Enable support for $ref pointers in schemas
135
- - `unions`: Enable support for union types (anyOf) in schemas
136
- - `formats`: Enable support for format validations in schemas (e.g. date-time, email)
137
- - `tool-name-length=N`: Set maximum tool name length to N characters
138
- - Example: `--capability=top-level-unions --capability=tool-name-length=40`
139
- - Example: `--capability=top-level-unions,tool-name-length=40`
140
-
141
- ### Examples
142
-
143
- 1. Filter for read operations on cards:
144
-
145
- ```bash
146
- --resource=cards --operation=read
147
- ```
148
-
149
- 2. Exclude specific tools while including others:
150
-
151
- ```bash
152
- --resource=cards --no-tool=create_cards
153
- ```
154
-
155
- 3. Configure for Cursor client with custom max tool name length:
156
-
157
- ```bash
158
- --client=cursor --capability=tool-name-length=40
159
- ```
160
-
161
- 4. Complex filtering with multiple criteria:
162
-
163
- ```bash
164
- --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
165
- ```
76
+ Using this scheme, agents are capable of performing very complex tasks deterministically
77
+ and repeatably.
166
78
 
167
79
  ## Running remotely
168
80
 
@@ -189,126 +101,3 @@ A configuration JSON for this server might look like this, assuming the server i
189
101
  }
190
102
  }
191
103
  ```
192
-
193
- The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
194
- For example, to exclude specific tools while including others, use the URL:
195
-
196
- ```
197
- http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
198
- ```
199
-
200
- Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
201
-
202
- ```
203
- http://localhost:3000?client=cursor&capability=tool-name-length%3D40
204
- ```
205
-
206
- ## Importing the tools and server individually
207
-
208
- ```js
209
- // Import the server, generated endpoints, or the init function
210
- import { server, endpoints, init } from "scorecard-ai-mcp/server";
211
-
212
- // import a specific tool
213
- import createProjects from "scorecard-ai-mcp/tools/projects/create-projects";
214
-
215
- // initialize the server and all endpoints
216
- init({ server, endpoints });
217
-
218
- // manually start server
219
- const transport = new StdioServerTransport();
220
- await server.connect(transport);
221
-
222
- // or initialize your own server with specific tools
223
- const myServer = new McpServer(...);
224
-
225
- // define your own endpoint
226
- const myCustomEndpoint = {
227
- tool: {
228
- name: 'my_custom_tool',
229
- description: 'My custom tool',
230
- inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
231
- },
232
- handler: async (client: client, args: any) => {
233
- return { myResponse: 'Hello world!' };
234
- })
235
- };
236
-
237
- // initialize the server with your custom endpoints
238
- init({ server: myServer, endpoints: [createProjects, myCustomEndpoint] });
239
- ```
240
-
241
- ## Available Tools
242
-
243
- The following tools are available in this MCP server.
244
-
245
- ### Resource `projects`:
246
-
247
- - `create_projects` (`write`): Create a new Project.
248
- - `list_projects` (`read`): Retrieve a paginated list of all Projects. Projects are ordered by creation date, with oldest Projects first.
249
-
250
- ### Resource `testsets`:
251
-
252
- - `create_testsets` (`write`): Create a new Testset for a Project. The Testset will be created in the Project specified in the path.
253
- - `update_testsets` (`write`): Update a Testset. Only the fields provided in the request body will be updated.
254
- If a field is provided, the new content will replace the existing content.
255
- If a field is not provided, the existing content will remain unchanged.
256
-
257
- When updating the schema:
258
-
259
- - If field mappings are not provided and existing mappings reference fields that no longer exist, those mappings will be automatically removed
260
- - To preserve all existing mappings, ensure all referenced fields remain in the updated schema
261
- - For complete control, provide both schema and fieldMapping when updating the schema
262
-
263
- - `list_testsets` (`read`): Retrieve a paginated list of Testsets belonging to a Project.
264
- - `delete_testsets` (`write`): Delete Testset
265
- - `get_testsets` (`read`): Get Testset
266
-
267
- ### Resource `testcases`:
268
-
269
- - `create_testcases` (`write`): Create multiple Testcases in the specified Testset.
270
- - `update_testcases` (`write`): Replace the data of an existing Testcase while keeping its ID.
271
- - `list_testcases` (`read`): Retrieve a paginated list of Testcases belonging to a Testset.
272
- - `delete_testcases` (`write`): Delete multiple Testcases by their IDs.
273
- - `get_testcases` (`read`): Retrieve a specific Testcase by ID.
274
-
275
- ### Resource `runs`:
276
-
277
- - `create_runs` (`write`): Create a new Run.
278
- - `list_runs` (`read`): Retrieve a paginated list of all Runs for a Project. Runs are ordered by creation date, most recent first.
279
- - `get_runs` (`read`): Retrieve a specific Run by ID.
280
-
281
- ### Resource `metrics`:
282
-
283
- - `create_metrics` (`write`): Create a new Metric for evaluating system outputs. The structure of a metric depends on the evalType and outputType of the metric.
284
- - `update_metrics` (`write`): Update an existing Metric. You must specify the evalType and outputType of the metric. The structure of a metric depends on the evalType and outputType of the metric.
285
- - `list_metrics` (`read`): List Metrics configured for the specified Project. Metrics are returned in reverse chronological order.
286
- - `delete_metrics` (`write`): Delete a specific Metric by ID. The metric will be removed from metric groups and monitors.
287
- - `get_metrics` (`read`): Retrieve a specific Metric by ID.
288
-
289
- ### Resource `records`:
290
-
291
- - `create_records` (`write`): Create a new Record in a Run.
292
- - `list_records` (`read`): Retrieve a paginated list of Records for a Run, including all scores for each record.
293
- - `delete_records` (`write`): Delete a specific Record by ID.
294
-
295
- ### Resource `scores`:
296
-
297
- - `upsert_scores` (`write`): Create or update a Score for a given Record and MetricConfig. If a Score with the specified Record ID and MetricConfig ID already exists, it will be updated. Otherwise, a new Score will be created. The score provided should conform to the schema defined by the MetricConfig; otherwise, validation errors will be reported.
298
-
299
- ### Resource `systems`:
300
-
301
- - `update_systems` (`write`): Update an existing system. Only the fields provided in the request body will be updated.
302
- If a field is provided, the new content will replace the existing content.
303
- If a field is not provided, the existing content will remain unchanged.
304
- - `list_systems` (`read`): Retrieve a paginated list of all systems. Systems are ordered by creation date.
305
- - `delete_systems` (`write`): Delete a system definition by ID. This will not delete associated system versions.
306
- - `get_systems` (`read`): Retrieve a specific system by ID.
307
- - `upsert_systems` (`write`): Create a new system. If one with the same name in the project exists, it updates it instead.
308
-
309
- ### Resource `systems.versions`:
310
-
311
- - `get_systems_versions` (`read`): Retrieve a specific system version by ID.
312
- - `upsert_systems_versions` (`write`): Create a new system version if it does not already exist. Does **not** set the created version to be the system's production version.
313
-
314
- If there is already a system version with the same config, its name will be updated.
@@ -1,14 +1,13 @@
1
1
  import { ClientOptions } from 'scorecard-ai';
2
2
  export type WorkerInput = {
3
- opts: ClientOptions;
3
+ project_name: string;
4
4
  code: string;
5
+ client_opts: ClientOptions;
5
6
  };
6
- export type WorkerSuccess = {
7
+ export type WorkerOutput = {
8
+ is_error: boolean;
7
9
  result: unknown | null;
8
- logLines: string[];
9
- errLines: string[];
10
- };
11
- export type WorkerError = {
12
- message: string | undefined;
10
+ log_lines: string[];
11
+ err_lines: string[];
13
12
  };
14
13
  //# sourceMappingURL=code-tool-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
@@ -1,14 +1,13 @@
1
1
  import { ClientOptions } from 'scorecard-ai';
2
2
  export type WorkerInput = {
3
- opts: ClientOptions;
3
+ project_name: string;
4
4
  code: string;
5
+ client_opts: ClientOptions;
5
6
  };
6
- export type WorkerSuccess = {
7
+ export type WorkerOutput = {
8
+ is_error: boolean;
7
9
  result: unknown | null;
8
- logLines: string[];
9
- errLines: string[];
10
- };
11
- export type WorkerError = {
12
- message: string | undefined;
10
+ log_lines: string[];
11
+ err_lines: string[];
13
12
  };
14
13
  //# sourceMappingURL=code-tool-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
package/code-tool.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Endpoint } from "./tools/types.mjs";
1
+ import { McpTool } from "./types.mjs";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
@@ -8,5 +8,5 @@ import { Endpoint } from "./tools/types.mjs";
8
8
  *
9
9
  * @param endpoints - The endpoints to include in the list.
10
10
  */
11
- export declare function codeTool(): Promise<Endpoint>;
11
+ export declare function codeTool(): McpTool;
12
12
  //# sourceMappingURL=code-tool.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAgB,QAAQ,EAA4B;AAM3D;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA8HlD"}
1
+ {"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AA0BhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAuDlC"}
package/code-tool.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Endpoint } from "./tools/types.js";
1
+ import { McpTool } from "./types.js";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
@@ -8,5 +8,5 @@ import { Endpoint } from "./tools/types.js";
8
8
  *
9
9
  * @param endpoints - The endpoints to include in the list.
10
10
  */
11
- export declare function codeTool(): Promise<Endpoint>;
11
+ export declare function codeTool(): McpTool;
12
12
  //# sourceMappingURL=code-tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAgB,QAAQ,EAA4B;AAM3D;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA8HlD"}
1
+ {"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AA0BhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAuDlC"}
package/code-tool.js CHANGED
@@ -1,42 +1,28 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
3
  Object.defineProperty(exports, "__esModule", { value: true });
37
4
  exports.codeTool = codeTool;
38
- const node_path_1 = require("node:path");
39
- const node_url_1 = require("node:url");
5
+ const types_1 = require("./types.js");
6
+ const server_1 = require("./server.js");
7
+ const prompt = `Runs JavaScript code to interact with the Scorecard API.
8
+
9
+ You are a skilled programmer writing code to interface with the service.
10
+ Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
11
+ For example:
12
+
13
+ \`\`\`
14
+ async function run(client) {
15
+ const run = await client.runs.create('314', { metricIds: ['789', '101'], testsetId: '246' });
16
+
17
+ console.log(run.id);
18
+ }
19
+ \`\`\`
20
+
21
+ You will be returned anything that your function returns, plus the results of any console.log statements.
22
+ Do not add try-catch blocks for single API calls. The tool will handle errors for you.
23
+ Do not add comments unless necessary for generating better code.
24
+ Code will run in a container, and cannot interact with the network outside of the given SDK client.
25
+ Variables will not persist between calls, so make sure to return or log any data you might need later.`;
40
26
  /**
41
27
  * A tool that runs code against a copy of the SDK.
42
28
  *
@@ -46,109 +32,49 @@ const node_url_1 = require("node:url");
46
32
  *
47
33
  * @param endpoints - The endpoints to include in the list.
48
34
  */
49
- async function codeTool() {
35
+ function codeTool() {
50
36
  const metadata = { resource: 'all', operation: 'write', tags: [] };
51
37
  const tool = {
52
38
  name: 'execute',
53
- description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client named "client", and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
39
+ description: prompt,
54
40
  inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
55
41
  };
56
- // Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
57
- const { newDenoHTTPWorker } = await Promise.resolve().then(() => __importStar(require('@valtown/deno-http-worker')));
58
- const { workerPath } = await Promise.resolve().then(() => __importStar(require('./code-tool-paths.cjs')));
59
42
  const handler = async (client, args) => {
60
- const baseURLHostname = new URL(client.baseURL).hostname;
61
- const { code } = args;
62
- const worker = await newDenoHTTPWorker((0, node_url_1.pathToFileURL)(workerPath), {
63
- runFlags: [
64
- `--node-modules-dir=manual`,
65
- `--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
66
- `--allow-net=${baseURLHostname}`,
67
- // Allow environment variables because instantiating the client will try to read from them,
68
- // even though they are not set.
69
- '--allow-env',
70
- ],
71
- printOutput: true,
72
- spawnOptions: {
73
- cwd: (0, node_path_1.dirname)(workerPath),
43
+ const code = args.code;
44
+ // this is not required, but passing a Stainless API key for the matching project_name
45
+ // will allow you to run code-mode queries against non-published versions of your SDK.
46
+ const stainlessAPIKey = (0, server_1.readEnv)('STAINLESS_API_KEY');
47
+ const codeModeEndpoint = (0, server_1.readEnv)('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
48
+ const res = await fetch(codeModeEndpoint, {
49
+ method: 'POST',
50
+ headers: {
51
+ ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
52
+ 'Content-Type': 'application/json',
53
+ client_envs: JSON.stringify({
54
+ SCORECARD_API_KEY: client.apiKey || (0, server_1.readEnvOrError)('SCORECARD_API_KEY'),
55
+ SCORECARD_BASE_URL: client.baseURL || (0, server_1.readEnv)('SCORECARD_BASE_URL'),
56
+ }),
74
57
  },
58
+ body: JSON.stringify({
59
+ project_name: 'scorecard',
60
+ code,
61
+ client_opts: { environment: ((0, server_1.readEnv)('SCORECARD_ENVIRONMENT') || undefined) },
62
+ }),
75
63
  });
76
- try {
77
- const resp = await new Promise((resolve, reject) => {
78
- worker.addEventListener('exit', (exitCode) => {
79
- reject(new Error(`Worker exited with code ${exitCode}`));
80
- });
81
- const opts = {
82
- baseURL: client.baseURL,
83
- apiKey: client.apiKey,
84
- defaultHeaders: {
85
- 'X-Stainless-MCP': 'true',
86
- },
87
- };
88
- const req = worker.request('http://localhost', {
89
- headers: {
90
- 'content-type': 'application/json',
91
- },
92
- method: 'POST',
93
- }, (resp) => {
94
- const body = [];
95
- resp.on('error', (err) => {
96
- reject(err);
97
- });
98
- resp.on('data', (chunk) => {
99
- body.push(chunk);
100
- });
101
- resp.on('end', () => {
102
- resolve(new Response(Buffer.concat(body).toString(), {
103
- status: resp.statusCode ?? 200,
104
- headers: resp.headers,
105
- }));
106
- });
107
- });
108
- const body = JSON.stringify({
109
- opts,
110
- code,
111
- });
112
- req.write(body, (err) => {
113
- if (err != null) {
114
- reject(err);
115
- }
116
- });
117
- req.end();
118
- });
119
- if (resp.status === 200) {
120
- const { result, logLines, errLines } = (await resp.json());
121
- const returnOutput = result == null ? null : ({
122
- type: 'text',
123
- text: typeof result === 'string' ? result : JSON.stringify(result),
124
- });
125
- const logOutput = logLines.length === 0 ?
126
- null
127
- : {
128
- type: 'text',
129
- text: logLines.join('\n'),
130
- };
131
- const errOutput = errLines.length === 0 ?
132
- null
133
- : {
134
- type: 'text',
135
- text: 'Error output:\n' + errLines.join('\n'),
136
- };
137
- return {
138
- content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
139
- };
140
- }
141
- else {
142
- const { message } = (await resp.json());
143
- return {
144
- content: message == null ? [] : [{ type: 'text', text: message }],
145
- isError: true,
146
- };
147
- }
64
+ if (!res.ok) {
65
+ throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
148
66
  }
149
- finally {
150
- worker.terminate();
67
+ const { is_error, result, log_lines, err_lines } = (await res.json());
68
+ const hasLogs = log_lines.length > 0 || err_lines.length > 0;
69
+ const output = {
70
+ result,
71
+ ...(log_lines.length > 0 && { log_lines }),
72
+ ...(err_lines.length > 0 && { err_lines }),
73
+ };
74
+ if (is_error) {
75
+ return (0, types_1.asErrorResult)(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
151
76
  }
77
+ return (0, types_1.asTextContentResult)(output);
152
78
  };
153
79
  return { metadata, tool, handler };
154
80
  }
package/code-tool.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBtF,4BA8HC;AAhJD,yCAAoC;AACpC,uCAAyC;AAQzC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EACT,6iCAA6iC;QAC/iC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC1E,CAAC;IAEF,2GAA2G;IAC3G,MAAM,EAAE,iBAAiB,EAAE,GAAG,wDAAa,2BAA2B,GAAC,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,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