scorecard-ai-mcp 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/README.md +38 -1
  2. package/code-tool-types.d.mts +2 -0
  3. package/code-tool-types.d.mts.map +1 -1
  4. package/code-tool-types.d.ts +2 -0
  5. package/code-tool-types.d.ts.map +1 -1
  6. package/code-tool.d.mts +45 -3
  7. package/code-tool.d.mts.map +1 -1
  8. package/code-tool.d.ts +45 -3
  9. package/code-tool.d.ts.map +1 -1
  10. package/code-tool.js +24 -132
  11. package/code-tool.js.map +1 -1
  12. package/code-tool.mjs +24 -99
  13. package/code-tool.mjs.map +1 -1
  14. package/docs-search-tool.d.mts +12 -6
  15. package/docs-search-tool.d.mts.map +1 -1
  16. package/docs-search-tool.d.ts +12 -6
  17. package/docs-search-tool.d.ts.map +1 -1
  18. package/docs-search-tool.js +10 -2
  19. package/docs-search-tool.js.map +1 -1
  20. package/docs-search-tool.mjs +10 -2
  21. package/docs-search-tool.mjs.map +1 -1
  22. package/dynamic-tools.d.mts +1 -1
  23. package/dynamic-tools.d.ts +1 -1
  24. package/dynamic-tools.js +1 -1
  25. package/dynamic-tools.mjs +1 -1
  26. package/filtering.d.mts +1 -0
  27. package/filtering.d.mts.map +1 -1
  28. package/filtering.d.ts +1 -0
  29. package/filtering.d.ts.map +1 -1
  30. package/filtering.js +4 -0
  31. package/filtering.js.map +1 -1
  32. package/filtering.mjs +3 -0
  33. package/filtering.mjs.map +1 -1
  34. package/headers.d.mts.map +1 -1
  35. package/headers.d.ts.map +1 -1
  36. package/headers.js +1 -1
  37. package/headers.js.map +1 -1
  38. package/headers.mjs +1 -1
  39. package/headers.mjs.map +1 -1
  40. package/http.js +2 -2
  41. package/http.js.map +1 -1
  42. package/http.mjs +2 -2
  43. package/http.mjs.map +1 -1
  44. package/options.d.mts.map +1 -1
  45. package/options.d.ts.map +1 -1
  46. package/options.js +6 -3
  47. package/options.js.map +1 -1
  48. package/options.mjs +6 -3
  49. package/options.mjs.map +1 -1
  50. package/package.json +6 -20
  51. package/server.js +1 -1
  52. package/server.mjs +1 -1
  53. package/src/code-tool-types.ts +5 -1
  54. package/src/code-tool.ts +34 -121
  55. package/src/docs-search-tool.ts +14 -3
  56. package/src/dynamic-tools.ts +1 -1
  57. package/src/filtering.ts +4 -0
  58. package/src/headers.ts +3 -1
  59. package/src/http.ts +2 -2
  60. package/src/options.ts +10 -3
  61. package/src/server.ts +1 -1
  62. package/src/tools/index.ts +2 -0
  63. package/src/tools/metrics/create-metrics.ts +9 -2
  64. package/src/tools/metrics/delete-metrics.ts +54 -0
  65. package/src/tools/metrics/get-metrics.ts +9 -2
  66. package/src/tools/metrics/list-metrics.ts +9 -2
  67. package/src/tools/metrics/update-metrics.ts +9 -2
  68. package/src/tools/projects/create-projects.ts +10 -3
  69. package/src/tools/projects/list-projects.ts +10 -3
  70. package/src/tools/records/create-records.ts +10 -3
  71. package/src/tools/records/delete-records.ts +10 -3
  72. package/src/tools/records/list-records.ts +10 -3
  73. package/src/tools/runs/create-runs.ts +10 -3
  74. package/src/tools/runs/get-runs.ts +10 -3
  75. package/src/tools/runs/list-runs.ts +10 -3
  76. package/src/tools/scores/upsert-scores.ts +12 -3
  77. package/src/tools/systems/delete-systems.ts +10 -3
  78. package/src/tools/systems/get-systems.ts +10 -3
  79. package/src/tools/systems/list-systems.ts +10 -3
  80. package/src/tools/systems/update-systems.ts +10 -3
  81. package/src/tools/systems/upsert-systems.ts +10 -3
  82. package/src/tools/systems/versions/get-systems-versions.ts +12 -5
  83. package/src/tools/systems/versions/upsert-systems-versions.ts +12 -5
  84. package/src/tools/testcases/create-testcases.ts +10 -3
  85. package/src/tools/testcases/delete-testcases.ts +10 -3
  86. package/src/tools/testcases/get-testcases.ts +10 -3
  87. package/src/tools/testcases/list-testcases.ts +10 -3
  88. package/src/tools/testcases/update-testcases.ts +10 -3
  89. package/src/tools/testsets/create-testsets.ts +10 -3
  90. package/src/tools/testsets/delete-testsets.ts +10 -3
  91. package/src/tools/testsets/get-testsets.ts +10 -3
  92. package/src/tools/testsets/list-testsets.ts +10 -3
  93. package/src/tools/testsets/update-testsets.ts +10 -3
  94. package/src/tools/types.ts +12 -0
  95. package/tools/index.d.mts.map +1 -1
  96. package/tools/index.d.ts.map +1 -1
  97. package/tools/index.js +2 -0
  98. package/tools/index.js.map +1 -1
  99. package/tools/index.mjs +2 -0
  100. package/tools/index.mjs.map +1 -1
  101. package/tools/metrics/create-metrics.d.mts +12 -6
  102. package/tools/metrics/create-metrics.d.mts.map +1 -1
  103. package/tools/metrics/create-metrics.d.ts +12 -6
  104. package/tools/metrics/create-metrics.d.ts.map +1 -1
  105. package/tools/metrics/create-metrics.js +13 -1
  106. package/tools/metrics/create-metrics.js.map +1 -1
  107. package/tools/metrics/create-metrics.mjs +11 -2
  108. package/tools/metrics/create-metrics.mjs.map +1 -1
  109. package/tools/metrics/delete-metrics.d.mts +51 -0
  110. package/tools/metrics/delete-metrics.d.mts.map +1 -0
  111. package/tools/metrics/delete-metrics.d.ts +51 -0
  112. package/tools/metrics/delete-metrics.d.ts.map +1 -0
  113. package/tools/metrics/delete-metrics.js +54 -0
  114. package/tools/metrics/delete-metrics.js.map +1 -0
  115. package/tools/metrics/delete-metrics.mjs +47 -0
  116. package/tools/metrics/delete-metrics.mjs.map +1 -0
  117. package/tools/metrics/get-metrics.d.mts +12 -6
  118. package/tools/metrics/get-metrics.d.mts.map +1 -1
  119. package/tools/metrics/get-metrics.d.ts +12 -6
  120. package/tools/metrics/get-metrics.d.ts.map +1 -1
  121. package/tools/metrics/get-metrics.js +13 -1
  122. package/tools/metrics/get-metrics.js.map +1 -1
  123. package/tools/metrics/get-metrics.mjs +11 -2
  124. package/tools/metrics/get-metrics.mjs.map +1 -1
  125. package/tools/metrics/list-metrics.d.mts +12 -6
  126. package/tools/metrics/list-metrics.d.mts.map +1 -1
  127. package/tools/metrics/list-metrics.d.ts +12 -6
  128. package/tools/metrics/list-metrics.d.ts.map +1 -1
  129. package/tools/metrics/list-metrics.js +13 -1
  130. package/tools/metrics/list-metrics.js.map +1 -1
  131. package/tools/metrics/list-metrics.mjs +11 -2
  132. package/tools/metrics/list-metrics.mjs.map +1 -1
  133. package/tools/metrics/update-metrics.d.mts +12 -6
  134. package/tools/metrics/update-metrics.d.mts.map +1 -1
  135. package/tools/metrics/update-metrics.d.ts +12 -6
  136. package/tools/metrics/update-metrics.d.ts.map +1 -1
  137. package/tools/metrics/update-metrics.js +13 -1
  138. package/tools/metrics/update-metrics.js.map +1 -1
  139. package/tools/metrics/update-metrics.mjs +11 -2
  140. package/tools/metrics/update-metrics.mjs.map +1 -1
  141. package/tools/projects/create-projects.d.mts +12 -6
  142. package/tools/projects/create-projects.d.mts.map +1 -1
  143. package/tools/projects/create-projects.d.ts +12 -6
  144. package/tools/projects/create-projects.d.ts.map +1 -1
  145. package/tools/projects/create-projects.js +13 -1
  146. package/tools/projects/create-projects.js.map +1 -1
  147. package/tools/projects/create-projects.mjs +12 -3
  148. package/tools/projects/create-projects.mjs.map +1 -1
  149. package/tools/projects/list-projects.d.mts +12 -6
  150. package/tools/projects/list-projects.d.mts.map +1 -1
  151. package/tools/projects/list-projects.d.ts +12 -6
  152. package/tools/projects/list-projects.d.ts.map +1 -1
  153. package/tools/projects/list-projects.js +13 -1
  154. package/tools/projects/list-projects.js.map +1 -1
  155. package/tools/projects/list-projects.mjs +12 -3
  156. package/tools/projects/list-projects.mjs.map +1 -1
  157. package/tools/records/create-records.d.mts +12 -6
  158. package/tools/records/create-records.d.mts.map +1 -1
  159. package/tools/records/create-records.d.ts +12 -6
  160. package/tools/records/create-records.d.ts.map +1 -1
  161. package/tools/records/create-records.js +13 -1
  162. package/tools/records/create-records.js.map +1 -1
  163. package/tools/records/create-records.mjs +12 -3
  164. package/tools/records/create-records.mjs.map +1 -1
  165. package/tools/records/delete-records.d.mts +12 -6
  166. package/tools/records/delete-records.d.mts.map +1 -1
  167. package/tools/records/delete-records.d.ts +12 -6
  168. package/tools/records/delete-records.d.ts.map +1 -1
  169. package/tools/records/delete-records.js +13 -1
  170. package/tools/records/delete-records.js.map +1 -1
  171. package/tools/records/delete-records.mjs +12 -3
  172. package/tools/records/delete-records.mjs.map +1 -1
  173. package/tools/records/list-records.d.mts +12 -6
  174. package/tools/records/list-records.d.mts.map +1 -1
  175. package/tools/records/list-records.d.ts +12 -6
  176. package/tools/records/list-records.d.ts.map +1 -1
  177. package/tools/records/list-records.js +13 -1
  178. package/tools/records/list-records.js.map +1 -1
  179. package/tools/records/list-records.mjs +12 -3
  180. package/tools/records/list-records.mjs.map +1 -1
  181. package/tools/runs/create-runs.d.mts +12 -6
  182. package/tools/runs/create-runs.d.mts.map +1 -1
  183. package/tools/runs/create-runs.d.ts +12 -6
  184. package/tools/runs/create-runs.d.ts.map +1 -1
  185. package/tools/runs/create-runs.js +13 -1
  186. package/tools/runs/create-runs.js.map +1 -1
  187. package/tools/runs/create-runs.mjs +12 -3
  188. package/tools/runs/create-runs.mjs.map +1 -1
  189. package/tools/runs/get-runs.d.mts +12 -6
  190. package/tools/runs/get-runs.d.mts.map +1 -1
  191. package/tools/runs/get-runs.d.ts +12 -6
  192. package/tools/runs/get-runs.d.ts.map +1 -1
  193. package/tools/runs/get-runs.js +13 -1
  194. package/tools/runs/get-runs.js.map +1 -1
  195. package/tools/runs/get-runs.mjs +12 -3
  196. package/tools/runs/get-runs.mjs.map +1 -1
  197. package/tools/runs/list-runs.d.mts +12 -6
  198. package/tools/runs/list-runs.d.mts.map +1 -1
  199. package/tools/runs/list-runs.d.ts +12 -6
  200. package/tools/runs/list-runs.d.ts.map +1 -1
  201. package/tools/runs/list-runs.js +13 -1
  202. package/tools/runs/list-runs.js.map +1 -1
  203. package/tools/runs/list-runs.mjs +12 -3
  204. package/tools/runs/list-runs.mjs.map +1 -1
  205. package/tools/scores/upsert-scores.d.mts +12 -6
  206. package/tools/scores/upsert-scores.d.mts.map +1 -1
  207. package/tools/scores/upsert-scores.d.ts +12 -6
  208. package/tools/scores/upsert-scores.d.ts.map +1 -1
  209. package/tools/scores/upsert-scores.js +13 -1
  210. package/tools/scores/upsert-scores.js.map +1 -1
  211. package/tools/scores/upsert-scores.mjs +12 -3
  212. package/tools/scores/upsert-scores.mjs.map +1 -1
  213. package/tools/systems/delete-systems.d.mts +12 -6
  214. package/tools/systems/delete-systems.d.mts.map +1 -1
  215. package/tools/systems/delete-systems.d.ts +12 -6
  216. package/tools/systems/delete-systems.d.ts.map +1 -1
  217. package/tools/systems/delete-systems.js +13 -1
  218. package/tools/systems/delete-systems.js.map +1 -1
  219. package/tools/systems/delete-systems.mjs +12 -3
  220. package/tools/systems/delete-systems.mjs.map +1 -1
  221. package/tools/systems/get-systems.d.mts +12 -6
  222. package/tools/systems/get-systems.d.mts.map +1 -1
  223. package/tools/systems/get-systems.d.ts +12 -6
  224. package/tools/systems/get-systems.d.ts.map +1 -1
  225. package/tools/systems/get-systems.js +13 -1
  226. package/tools/systems/get-systems.js.map +1 -1
  227. package/tools/systems/get-systems.mjs +12 -3
  228. package/tools/systems/get-systems.mjs.map +1 -1
  229. package/tools/systems/list-systems.d.mts +12 -6
  230. package/tools/systems/list-systems.d.mts.map +1 -1
  231. package/tools/systems/list-systems.d.ts +12 -6
  232. package/tools/systems/list-systems.d.ts.map +1 -1
  233. package/tools/systems/list-systems.js +13 -1
  234. package/tools/systems/list-systems.js.map +1 -1
  235. package/tools/systems/list-systems.mjs +12 -3
  236. package/tools/systems/list-systems.mjs.map +1 -1
  237. package/tools/systems/update-systems.d.mts +12 -6
  238. package/tools/systems/update-systems.d.mts.map +1 -1
  239. package/tools/systems/update-systems.d.ts +12 -6
  240. package/tools/systems/update-systems.d.ts.map +1 -1
  241. package/tools/systems/update-systems.js +13 -1
  242. package/tools/systems/update-systems.js.map +1 -1
  243. package/tools/systems/update-systems.mjs +12 -3
  244. package/tools/systems/update-systems.mjs.map +1 -1
  245. package/tools/systems/upsert-systems.d.mts +12 -6
  246. package/tools/systems/upsert-systems.d.mts.map +1 -1
  247. package/tools/systems/upsert-systems.d.ts +12 -6
  248. package/tools/systems/upsert-systems.d.ts.map +1 -1
  249. package/tools/systems/upsert-systems.js +13 -1
  250. package/tools/systems/upsert-systems.js.map +1 -1
  251. package/tools/systems/upsert-systems.mjs +12 -3
  252. package/tools/systems/upsert-systems.mjs.map +1 -1
  253. package/tools/systems/versions/get-systems-versions.d.mts +12 -6
  254. package/tools/systems/versions/get-systems-versions.d.mts.map +1 -1
  255. package/tools/systems/versions/get-systems-versions.d.ts +12 -6
  256. package/tools/systems/versions/get-systems-versions.d.ts.map +1 -1
  257. package/tools/systems/versions/get-systems-versions.js +13 -1
  258. package/tools/systems/versions/get-systems-versions.js.map +1 -1
  259. package/tools/systems/versions/get-systems-versions.mjs +12 -3
  260. package/tools/systems/versions/get-systems-versions.mjs.map +1 -1
  261. package/tools/systems/versions/upsert-systems-versions.d.mts +12 -6
  262. package/tools/systems/versions/upsert-systems-versions.d.mts.map +1 -1
  263. package/tools/systems/versions/upsert-systems-versions.d.ts +12 -6
  264. package/tools/systems/versions/upsert-systems-versions.d.ts.map +1 -1
  265. package/tools/systems/versions/upsert-systems-versions.js +13 -1
  266. package/tools/systems/versions/upsert-systems-versions.js.map +1 -1
  267. package/tools/systems/versions/upsert-systems-versions.mjs +12 -3
  268. package/tools/systems/versions/upsert-systems-versions.mjs.map +1 -1
  269. package/tools/testcases/create-testcases.d.mts +12 -6
  270. package/tools/testcases/create-testcases.d.mts.map +1 -1
  271. package/tools/testcases/create-testcases.d.ts +12 -6
  272. package/tools/testcases/create-testcases.d.ts.map +1 -1
  273. package/tools/testcases/create-testcases.js +13 -1
  274. package/tools/testcases/create-testcases.js.map +1 -1
  275. package/tools/testcases/create-testcases.mjs +12 -3
  276. package/tools/testcases/create-testcases.mjs.map +1 -1
  277. package/tools/testcases/delete-testcases.d.mts +12 -6
  278. package/tools/testcases/delete-testcases.d.mts.map +1 -1
  279. package/tools/testcases/delete-testcases.d.ts +12 -6
  280. package/tools/testcases/delete-testcases.d.ts.map +1 -1
  281. package/tools/testcases/delete-testcases.js +13 -1
  282. package/tools/testcases/delete-testcases.js.map +1 -1
  283. package/tools/testcases/delete-testcases.mjs +12 -3
  284. package/tools/testcases/delete-testcases.mjs.map +1 -1
  285. package/tools/testcases/get-testcases.d.mts +12 -6
  286. package/tools/testcases/get-testcases.d.mts.map +1 -1
  287. package/tools/testcases/get-testcases.d.ts +12 -6
  288. package/tools/testcases/get-testcases.d.ts.map +1 -1
  289. package/tools/testcases/get-testcases.js +13 -1
  290. package/tools/testcases/get-testcases.js.map +1 -1
  291. package/tools/testcases/get-testcases.mjs +12 -3
  292. package/tools/testcases/get-testcases.mjs.map +1 -1
  293. package/tools/testcases/list-testcases.d.mts +12 -6
  294. package/tools/testcases/list-testcases.d.mts.map +1 -1
  295. package/tools/testcases/list-testcases.d.ts +12 -6
  296. package/tools/testcases/list-testcases.d.ts.map +1 -1
  297. package/tools/testcases/list-testcases.js +13 -1
  298. package/tools/testcases/list-testcases.js.map +1 -1
  299. package/tools/testcases/list-testcases.mjs +12 -3
  300. package/tools/testcases/list-testcases.mjs.map +1 -1
  301. package/tools/testcases/update-testcases.d.mts +12 -6
  302. package/tools/testcases/update-testcases.d.mts.map +1 -1
  303. package/tools/testcases/update-testcases.d.ts +12 -6
  304. package/tools/testcases/update-testcases.d.ts.map +1 -1
  305. package/tools/testcases/update-testcases.js +13 -1
  306. package/tools/testcases/update-testcases.js.map +1 -1
  307. package/tools/testcases/update-testcases.mjs +12 -3
  308. package/tools/testcases/update-testcases.mjs.map +1 -1
  309. package/tools/testsets/create-testsets.d.mts +12 -6
  310. package/tools/testsets/create-testsets.d.mts.map +1 -1
  311. package/tools/testsets/create-testsets.d.ts +12 -6
  312. package/tools/testsets/create-testsets.d.ts.map +1 -1
  313. package/tools/testsets/create-testsets.js +13 -1
  314. package/tools/testsets/create-testsets.js.map +1 -1
  315. package/tools/testsets/create-testsets.mjs +12 -3
  316. package/tools/testsets/create-testsets.mjs.map +1 -1
  317. package/tools/testsets/delete-testsets.d.mts +12 -6
  318. package/tools/testsets/delete-testsets.d.mts.map +1 -1
  319. package/tools/testsets/delete-testsets.d.ts +12 -6
  320. package/tools/testsets/delete-testsets.d.ts.map +1 -1
  321. package/tools/testsets/delete-testsets.js +13 -1
  322. package/tools/testsets/delete-testsets.js.map +1 -1
  323. package/tools/testsets/delete-testsets.mjs +12 -3
  324. package/tools/testsets/delete-testsets.mjs.map +1 -1
  325. package/tools/testsets/get-testsets.d.mts +12 -6
  326. package/tools/testsets/get-testsets.d.mts.map +1 -1
  327. package/tools/testsets/get-testsets.d.ts +12 -6
  328. package/tools/testsets/get-testsets.d.ts.map +1 -1
  329. package/tools/testsets/get-testsets.js +13 -1
  330. package/tools/testsets/get-testsets.js.map +1 -1
  331. package/tools/testsets/get-testsets.mjs +12 -3
  332. package/tools/testsets/get-testsets.mjs.map +1 -1
  333. package/tools/testsets/list-testsets.d.mts +12 -6
  334. package/tools/testsets/list-testsets.d.mts.map +1 -1
  335. package/tools/testsets/list-testsets.d.ts +12 -6
  336. package/tools/testsets/list-testsets.d.ts.map +1 -1
  337. package/tools/testsets/list-testsets.js +13 -1
  338. package/tools/testsets/list-testsets.js.map +1 -1
  339. package/tools/testsets/list-testsets.mjs +12 -3
  340. package/tools/testsets/list-testsets.mjs.map +1 -1
  341. package/tools/testsets/update-testsets.d.mts +12 -6
  342. package/tools/testsets/update-testsets.d.mts.map +1 -1
  343. package/tools/testsets/update-testsets.d.ts +12 -6
  344. package/tools/testsets/update-testsets.d.ts.map +1 -1
  345. package/tools/testsets/update-testsets.js +13 -1
  346. package/tools/testsets/update-testsets.js.map +1 -1
  347. package/tools/testsets/update-testsets.mjs +12 -3
  348. package/tools/testsets/update-testsets.mjs.map +1 -1
  349. package/tools/types.d.mts +1 -0
  350. package/tools/types.d.mts.map +1 -1
  351. package/tools/types.d.ts +1 -0
  352. package/tools/types.d.ts.map +1 -1
  353. package/tools/types.js +12 -0
  354. package/tools/types.js.map +1 -1
  355. package/tools/types.mjs +11 -0
  356. package/tools/types.mjs.map +1 -1
  357. package/code-tool-paths.cjs +0 -6
  358. package/code-tool-paths.cjs.map +0 -1
  359. package/code-tool-paths.d.cts +0 -2
  360. package/code-tool-paths.d.cts.map +0 -1
  361. package/code-tool-worker.d.mts +0 -5
  362. package/code-tool-worker.d.mts.map +0 -1
  363. package/code-tool-worker.d.ts +0 -5
  364. package/code-tool-worker.d.ts.map +0 -1
  365. package/code-tool-worker.js +0 -45
  366. package/code-tool-worker.js.map +0 -1
  367. package/code-tool-worker.mjs +0 -40
  368. package/code-tool-worker.mjs.map +0 -1
  369. package/src/code-tool-paths.cts +0 -3
  370. package/src/code-tool-worker.ts +0 -46
package/README.md CHANGED
@@ -36,12 +36,36 @@ For clients with a configuration JSON, it might look something like this:
36
36
  }
37
37
  ```
38
38
 
39
+ ### Cursor
40
+
41
+ If you use Cursor, you can install the MCP server by using the button below. You will need to set your environment variables
42
+ in Cursor's `mcp.json`, which can be found in Cursor Settings > Tools & MCP > New MCP Server.
43
+
44
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=scorecard-ai-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNjb3JlY2FyZC1haS1tY3AiXSwiZW52Ijp7IlNDT1JFQ0FSRF9BUElfS0VZIjoiU2V0IHlvdXIgU0NPUkVDQVJEX0FQSV9LRVkgaGVyZS4ifX0)
45
+
46
+ ### VS Code
47
+
48
+ If you use MCP, you can install the MCP server by clicking the link below. You will need to set your environment variables
49
+ in VS Code's `mcp.json`, which can be found via Command Palette > MCP: Open User Configuration.
50
+
51
+ [Open VS Code](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22scorecard-ai-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22scorecard-ai-mcp%22%5D%2C%22env%22%3A%7B%22SCORECARD_API_KEY%22%3A%22Set%20your%20SCORECARD_API_KEY%20here.%22%7D%7D)
52
+
53
+ ### Claude Code
54
+
55
+ If you use Claude Code, you can install the MCP server by running the command below in your terminal. You will need to set your
56
+ environment variables in Claude Code's `.claude.json`, which can be found in your home directory.
57
+
58
+ ```
59
+ claude mcp add --transport stdio scorecard_ai_api --env SCORECARD_API_KEY="Your SCORECARD_API_KEY here." -- npx -y scorecard-ai-mcp
60
+ ```
61
+
39
62
  ## Exposing endpoints to your MCP Client
40
63
 
41
- There are two ways to expose endpoints as tools in the MCP server:
64
+ There are three ways to expose endpoints as tools in the MCP server:
42
65
 
43
66
  1. Exposing one tool per endpoint, and filtering as necessary
44
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
45
69
 
46
70
  ### Filtering endpoints and tools
47
71
 
@@ -76,6 +100,18 @@ All of these command-line options can be repeated, combined together, and have c
76
100
 
77
101
  Use `--list` to see the list of available tools, or see below.
78
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
+
79
115
  ### Specifying the MCP Client
80
116
 
81
117
  Different clients have varying abilities to handle arbitrary tools and schemas.
@@ -247,6 +283,7 @@ The following tools are available in this MCP server.
247
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.
248
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.
249
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.
250
287
  - `get_metrics` (`read`): Retrieve a specific Metric by ID.
251
288
 
252
289
  ### Resource `records`:
@@ -10,5 +10,7 @@ export type WorkerSuccess = {
10
10
  };
11
11
  export type WorkerError = {
12
12
  message: string | undefined;
13
+ logLines: string[];
14
+ errLines: string[];
13
15
  };
14
16
  //# 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,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;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
@@ -10,5 +10,7 @@ export type WorkerSuccess = {
10
10
  };
11
11
  export type WorkerError = {
12
12
  message: string | undefined;
13
+ logLines: string[];
14
+ errLines: string[];
13
15
  };
14
16
  //# 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,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;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
package/code-tool.d.mts CHANGED
@@ -1,12 +1,54 @@
1
- import { Endpoint } from "./tools/types.mjs";
1
+ import { Metadata, ToolCallResult } from "./tools/types.mjs";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
5
- * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
5
+ * Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
6
6
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
7
7
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
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(): Promise<{
12
+ metadata: Metadata;
13
+ tool: {
14
+ inputSchema: {
15
+ [x: string]: unknown;
16
+ type: "object";
17
+ properties?: {
18
+ [x: string]: object;
19
+ } | undefined;
20
+ required?: string[] | undefined;
21
+ };
22
+ name: string;
23
+ description?: string | undefined;
24
+ outputSchema?: {
25
+ [x: string]: unknown;
26
+ type: "object";
27
+ properties?: {
28
+ [x: string]: object;
29
+ } | undefined;
30
+ required?: string[] | undefined;
31
+ } | undefined;
32
+ annotations?: {
33
+ title?: string | undefined;
34
+ readOnlyHint?: boolean | undefined;
35
+ destructiveHint?: boolean | undefined;
36
+ idempotentHint?: boolean | undefined;
37
+ openWorldHint?: boolean | undefined;
38
+ } | undefined;
39
+ execution?: {
40
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
41
+ } | undefined;
42
+ _meta?: {
43
+ [x: string]: unknown;
44
+ } | undefined;
45
+ icons?: {
46
+ src: string;
47
+ mimeType?: string | undefined;
48
+ sizes?: string[] | undefined;
49
+ }[] | undefined;
50
+ title?: string | undefined;
51
+ };
52
+ handler: (_: unknown, args: any) => Promise<ToolCallResult>;
53
+ }>;
12
54
  //# 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,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
1
+ {"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAE,cAAc,EAAuB;AAIxD;;;;;;;;GAQG;AACH,wBAAsB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQF,OAAO,QAAQ,GAAG,KAAG,OAAO,CAAC,cAAc,CAAC;GAmCvE"}
package/code-tool.d.ts CHANGED
@@ -1,12 +1,54 @@
1
- import { Endpoint } from "./tools/types.js";
1
+ import { Metadata, ToolCallResult } from "./tools/types.js";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
5
- * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
5
+ * Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
6
6
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
7
7
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
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(): Promise<{
12
+ metadata: Metadata;
13
+ tool: {
14
+ inputSchema: {
15
+ [x: string]: unknown;
16
+ type: "object";
17
+ properties?: {
18
+ [x: string]: object;
19
+ } | undefined;
20
+ required?: string[] | undefined;
21
+ };
22
+ name: string;
23
+ description?: string | undefined;
24
+ outputSchema?: {
25
+ [x: string]: unknown;
26
+ type: "object";
27
+ properties?: {
28
+ [x: string]: object;
29
+ } | undefined;
30
+ required?: string[] | undefined;
31
+ } | undefined;
32
+ annotations?: {
33
+ title?: string | undefined;
34
+ readOnlyHint?: boolean | undefined;
35
+ destructiveHint?: boolean | undefined;
36
+ idempotentHint?: boolean | undefined;
37
+ openWorldHint?: boolean | undefined;
38
+ } | undefined;
39
+ execution?: {
40
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
41
+ } | undefined;
42
+ _meta?: {
43
+ [x: string]: unknown;
44
+ } | undefined;
45
+ icons?: {
46
+ src: string;
47
+ mimeType?: string | undefined;
48
+ sizes?: string[] | undefined;
49
+ }[] | undefined;
50
+ title?: string | undefined;
51
+ };
52
+ handler: (_: unknown, args: any) => Promise<ToolCallResult>;
53
+ }>;
12
54
  //# 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,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
1
+ {"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAE,cAAc,EAAuB;AAIxD;;;;;;;;GAQG;AACH,wBAAsB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQF,OAAO,QAAQ,GAAG,KAAG,OAAO,CAAC,cAAc,CAAC;GAmCvE"}
package/code-tool.js CHANGED
@@ -1,46 +1,13 @@
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("./tools/types.js");
6
+ const server_1 = require("./server.js");
40
7
  /**
41
8
  * A tool that runs code against a copy of the SDK.
42
9
  *
43
- * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
10
+ * Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
44
11
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
45
12
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
46
13
  *
@@ -50,107 +17,32 @@ async function codeTool() {
50
17
  const metadata = { resource: 'all', operation: 'write', tags: [] };
51
18
  const tool = {
52
19
  name: 'execute',
53
- description: 'Runs Typescript code to interact with the API.\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, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\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.',
20
+ 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 SDK 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.',
54
21
  inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
55
22
  };
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
- 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),
23
+ const handler = async (_, args) => {
24
+ const code = args.code;
25
+ // this is not required, but passing a Stainless API key for the matching project_name
26
+ // will allow you to run code-mode queries against non-published versions of your SDK.
27
+ const stainlessAPIKey = (0, server_1.readEnv)('STAINLESS_API_KEY');
28
+ const codeModeEndpoint = (0, server_1.readEnv)('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
29
+ const res = await fetch(codeModeEndpoint, {
30
+ method: 'POST',
31
+ headers: {
32
+ ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
33
+ 'Content-Type': 'application/json',
34
+ client_envs: JSON.stringify({ SCORECARD_API_KEY: (0, server_1.readEnv)('SCORECARD_API_KEY') }),
74
35
  },
36
+ body: JSON.stringify({
37
+ project_name: 'scorecard',
38
+ client_opts: { environment: ((0, server_1.readEnv)('SCORECARD_ENVIRONMENT') || undefined) },
39
+ code,
40
+ }),
75
41
  });
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 && err !== undefined) {
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
- : result === undefined ? null
123
- : {
124
- type: 'text',
125
- text: typeof result === 'string' ? result : JSON.stringify(result),
126
- };
127
- const logOutput = logLines.length === 0 ?
128
- null
129
- : {
130
- type: 'text',
131
- text: logLines.join('\n'),
132
- };
133
- const errOutput = errLines.length === 0 ?
134
- null
135
- : {
136
- type: 'text',
137
- text: 'Error output:\n' + errLines.join('\n'),
138
- };
139
- return {
140
- content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
141
- };
142
- }
143
- else {
144
- const { message } = (await resp.json());
145
- throw new Error(message);
146
- }
147
- }
148
- catch (e) {
149
- throw e;
150
- }
151
- finally {
152
- worker.terminate();
42
+ if (!res.ok) {
43
+ throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
153
44
  }
45
+ return (0, types_1.asTextContentResult)((await res.json()));
154
46
  };
155
47
  return { metadata, tool, handler };
156
48
  }
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,4BA6HC;AA/ID,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,khCAAkhC;QACphC,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,GAAG,wDAAa,uBAAuB,GAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,KAAK,EAAE,MAAiB,EAAE,IAAa,EAAE,EAAE;QACzD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;QACzD,MAAM,EAAE,IAAI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CAC/E,CAAC;QACJ,CAAC;QAED,OAAO,IAAA,2BAAmB,EAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAkB,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
package/code-tool.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { dirname } from 'node:path';
3
- import { pathToFileURL } from 'node:url';
2
+ import { asTextContentResult } from "./tools/types.mjs";
3
+ import { readEnv } from "./server.mjs";
4
4
  /**
5
5
  * A tool that runs code against a copy of the SDK.
6
6
  *
7
- * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
7
+ * Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
8
8
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
9
9
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
10
10
  *
@@ -14,107 +14,32 @@ export async function codeTool() {
14
14
  const metadata = { resource: 'all', operation: 'write', tags: [] };
15
15
  const tool = {
16
16
  name: 'execute',
17
- description: 'Runs Typescript code to interact with the API.\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, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\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.',
17
+ 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 SDK 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.',
18
18
  inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
19
19
  };
20
- // Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
21
- const { newDenoHTTPWorker } = await import('@valtown/deno-http-worker');
22
- const { workerPath } = await import('./code-tool-paths.cjs');
23
- const handler = async (client, args) => {
24
- const baseURLHostname = new URL(client.baseURL).hostname;
25
- const { code } = args;
26
- const worker = await newDenoHTTPWorker(pathToFileURL(workerPath), {
27
- runFlags: [
28
- `--node-modules-dir=manual`,
29
- `--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
30
- `--allow-net=${baseURLHostname}`,
31
- // Allow environment variables because instantiating the client will try to read from them,
32
- // even though they are not set.
33
- '--allow-env',
34
- ],
35
- printOutput: true,
36
- spawnOptions: {
37
- cwd: dirname(workerPath),
20
+ const handler = async (_, args) => {
21
+ const code = args.code;
22
+ // this is not required, but passing a Stainless API key for the matching project_name
23
+ // will allow you to run code-mode queries against non-published versions of your SDK.
24
+ const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
25
+ const codeModeEndpoint = readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
26
+ const res = await fetch(codeModeEndpoint, {
27
+ method: 'POST',
28
+ headers: {
29
+ ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
30
+ 'Content-Type': 'application/json',
31
+ client_envs: JSON.stringify({ SCORECARD_API_KEY: readEnv('SCORECARD_API_KEY') }),
38
32
  },
33
+ body: JSON.stringify({
34
+ project_name: 'scorecard',
35
+ client_opts: { environment: (readEnv('SCORECARD_ENVIRONMENT') || undefined) },
36
+ code,
37
+ }),
39
38
  });
40
- try {
41
- const resp = await new Promise((resolve, reject) => {
42
- worker.addEventListener('exit', (exitCode) => {
43
- reject(new Error(`Worker exited with code ${exitCode}`));
44
- });
45
- const opts = {
46
- baseURL: client.baseURL,
47
- apiKey: client.apiKey,
48
- defaultHeaders: {
49
- 'X-Stainless-MCP': 'true',
50
- },
51
- };
52
- const req = worker.request('http://localhost', {
53
- headers: {
54
- 'content-type': 'application/json',
55
- },
56
- method: 'POST',
57
- }, (resp) => {
58
- const body = [];
59
- resp.on('error', (err) => {
60
- reject(err);
61
- });
62
- resp.on('data', (chunk) => {
63
- body.push(chunk);
64
- });
65
- resp.on('end', () => {
66
- resolve(new Response(Buffer.concat(body).toString(), {
67
- status: resp.statusCode ?? 200,
68
- headers: resp.headers,
69
- }));
70
- });
71
- });
72
- const body = JSON.stringify({
73
- opts,
74
- code,
75
- });
76
- req.write(body, (err) => {
77
- if (err !== null && err !== undefined) {
78
- reject(err);
79
- }
80
- });
81
- req.end();
82
- });
83
- if (resp.status === 200) {
84
- const { result, logLines, errLines } = (await resp.json());
85
- const returnOutput = result === null ? null
86
- : result === undefined ? null
87
- : {
88
- type: 'text',
89
- text: typeof result === 'string' ? result : JSON.stringify(result),
90
- };
91
- const logOutput = logLines.length === 0 ?
92
- null
93
- : {
94
- type: 'text',
95
- text: logLines.join('\n'),
96
- };
97
- const errOutput = errLines.length === 0 ?
98
- null
99
- : {
100
- type: 'text',
101
- text: 'Error output:\n' + errLines.join('\n'),
102
- };
103
- return {
104
- content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
105
- };
106
- }
107
- else {
108
- const { message } = (await resp.json());
109
- throw new Error(message);
110
- }
111
- }
112
- catch (e) {
113
- throw e;
114
- }
115
- finally {
116
- worker.terminate();
39
+ if (!res.ok) {
40
+ throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
117
41
  }
42
+ return asTextContentResult((await res.json()));
118
43
  };
119
44
  return { metadata, tool, handler };
120
45
  }
package/code-tool.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,EAAE,MAAM,WAAW;OAC5B,EAAE,aAAa,EAAE,MAAM,UAAU;AAQxC;;;;;;;;GAQG;AACH,MAAM,CAAC,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,khCAAkhC;QACphC,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,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,KAAK,EAAE,MAAiB,EAAE,IAAa,EAAE,EAAE;QACzD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;QACzD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAwB,CAAC;QAE1C,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;YAChE,QAAQ,EAAE;gBACR,2BAA2B;gBAC3B,qCAAqC,UAAU,CAAC,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC,GAAG;gBACjG,eAAe,eAAe,EAAE;gBAChC,2FAA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7
7
  metadata: Metadata;
8
8
  tool: {
9
- [x: string]: unknown;
10
- name: string;
11
9
  inputSchema: {
12
10
  [x: string]: unknown;
13
11
  type: "object";
14
12
  properties?: {
15
- [x: string]: unknown;
13
+ [x: string]: object;
16
14
  } | undefined;
17
15
  required?: string[] | undefined;
18
16
  };
19
- title?: string | undefined;
17
+ name: string;
20
18
  description?: string | undefined;
21
19
  outputSchema?: {
22
20
  [x: string]: unknown;
23
21
  type: "object";
24
22
  properties?: {
25
- [x: string]: unknown;
23
+ [x: string]: object;
26
24
  } | undefined;
27
25
  required?: string[] | undefined;
28
26
  } | undefined;
29
27
  annotations?: {
30
- [x: string]: unknown;
31
28
  title?: string | undefined;
32
29
  readOnlyHint?: boolean | undefined;
33
30
  destructiveHint?: boolean | undefined;
34
31
  idempotentHint?: boolean | undefined;
35
32
  openWorldHint?: boolean | undefined;
36
33
  } | undefined;
34
+ execution?: {
35
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
36
+ } | undefined;
37
37
  _meta?: {
38
38
  [x: string]: unknown;
39
39
  } | undefined;
40
+ icons?: {
41
+ src: string;
42
+ mimeType?: string | undefined;
43
+ sizes?: string[] | undefined;
44
+ }[] | undefined;
45
+ title?: string | undefined;
40
46
  };
41
47
  handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
42
48
  };