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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scorecard-ai-mcp",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "mcpName": "io.scorecard/mcp",
5
5
  "description": "The official MCP Server for the Scorecard API",
6
6
  "author": "Scorecard <team@scorecard.io>",
@@ -28,14 +28,16 @@
28
28
  "fix": "eslint --fix --ext ts,js ."
29
29
  },
30
30
  "dependencies": {
31
- "scorecard-ai": "^2.4.1",
31
+ "scorecard-ai": "^2.6.0",
32
32
  "@cloudflare/cabidela": "^0.2.4",
33
- "@modelcontextprotocol/sdk": "^1.11.5",
33
+ "@modelcontextprotocol/sdk": "^1.24.0",
34
34
  "@valtown/deno-http-worker": "^0.0.21",
35
35
  "cors": "^2.8.5",
36
36
  "express": "^5.1.0",
37
- "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz",
37
+ "fuse.js": "^7.1.0",
38
+ "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.8/jq-web.tar.gz",
38
39
  "qs": "^6.14.0",
40
+ "typescript": "5.8.3",
39
41
  "yargs": "^17.7.2",
40
42
  "zod": "^3.25.20",
41
43
  "zod-to-json-schema": "^3.24.5",
@@ -57,12 +59,6 @@
57
59
  "types": "./index.d.mts",
58
60
  "default": "./index.mjs"
59
61
  },
60
- "./code-tool-paths": {
61
- "require": "./code-tool-paths.cjs"
62
- },
63
- "./code-tool-paths.cjs": {
64
- "default": "./code-tool-paths.cjs"
65
- },
66
62
  "./code-tool-types": {
67
63
  "import": "./code-tool-types.mjs",
68
64
  "require": "./code-tool-types.js"
@@ -73,16 +69,6 @@
73
69
  "./code-tool-types.mjs": {
74
70
  "default": "./code-tool-types.mjs"
75
71
  },
76
- "./code-tool-worker": {
77
- "import": "./code-tool-worker.mjs",
78
- "require": "./code-tool-worker.js"
79
- },
80
- "./code-tool-worker.js": {
81
- "default": "./code-tool-worker.js"
82
- },
83
- "./code-tool-worker.mjs": {
84
- "default": "./code-tool-worker.mjs"
85
- },
86
72
  "./code-tool": {
87
73
  "import": "./code-tool.mjs",
88
74
  "require": "./code-tool.js"
package/server.js CHANGED
@@ -22,7 +22,7 @@ var tools_2 = require("./tools.js");
22
22
  Object.defineProperty(exports, "endpoints", { enumerable: true, get: function () { return tools_2.endpoints; } });
23
23
  const newMcpServer = () => new mcp_js_1.McpServer({
24
24
  name: 'scorecard_ai_api',
25
- version: '2.4.1',
25
+ version: '2.6.0',
26
26
  }, { capabilities: { tools: {}, logging: {} } });
27
27
  exports.newMcpServer = newMcpServer;
28
28
  // Create server instance
package/server.mjs CHANGED
@@ -11,7 +11,7 @@ export { ClientType } from "./compat.mjs";
11
11
  export { endpoints } from "./tools.mjs";
12
12
  export const newMcpServer = () => new McpServer({
13
13
  name: 'scorecard_ai_api',
14
- version: '2.4.1',
14
+ version: '2.6.0',
15
15
  }, { capabilities: { tools: {}, logging: {} } });
16
16
  // Create server instance
17
17
  export const server = newMcpServer();
@@ -11,4 +11,8 @@ export type WorkerSuccess = {
11
11
  logLines: string[];
12
12
  errLines: string[];
13
13
  };
14
- export type WorkerError = { message: string | undefined };
14
+ export type WorkerError = {
15
+ message: string | undefined;
16
+ logLines: string[];
17
+ errLines: string[];
18
+ };
package/src/code-tool.ts CHANGED
@@ -1,145 +1,58 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { dirname } from 'node:path';
4
- import { pathToFileURL } from 'node:url';
5
- import Scorecard, { ClientOptions } from 'scorecard-ai';
6
- import { Endpoint, ContentBlock, Metadata } from './tools/types';
7
-
3
+ import { Metadata, ToolCallResult, asTextContentResult } from './tools/types';
8
4
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
9
-
10
- import { WorkerInput, WorkerError, WorkerSuccess } from './code-tool-types';
11
-
5
+ import { readEnv } from './server';
6
+ import { WorkerSuccess } from './code-tool-types';
12
7
  /**
13
8
  * A tool that runs code against a copy of the SDK.
14
9
  *
15
- * 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,
16
11
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
17
12
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
18
13
  *
19
14
  * @param endpoints - The endpoints to include in the list.
20
15
  */
21
- export async function codeTool(): Promise<Endpoint> {
16
+ export async function codeTool() {
22
17
  const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
23
18
  const tool: Tool = {
24
19
  name: 'execute',
25
20
  description:
26
- '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.',
21
+ '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.',
27
22
  inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
28
23
  };
29
-
30
- // Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
31
- const { newDenoHTTPWorker } = await import('@valtown/deno-http-worker');
32
- const { workerPath } = await import('./code-tool-paths.cjs');
33
-
34
- const handler = async (client: Scorecard, args: unknown) => {
35
- const baseURLHostname = new URL(client.baseURL).hostname;
36
- const { code } = args as { code: string };
37
-
38
- const worker = await newDenoHTTPWorker(pathToFileURL(workerPath), {
39
- runFlags: [
40
- `--node-modules-dir=manual`,
41
- `--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
42
- `--allow-net=${baseURLHostname}`,
43
- // Allow environment variables because instantiating the client will try to read from them,
44
- // even though they are not set.
45
- '--allow-env',
46
- ],
47
- printOutput: true,
48
- spawnOptions: {
49
- cwd: dirname(workerPath),
24
+ const handler = async (_: unknown, args: any): Promise<ToolCallResult> => {
25
+ const code = args.code as string;
26
+
27
+ // this is not required, but passing a Stainless API key for the matching project_name
28
+ // will allow you to run code-mode queries against non-published versions of your SDK.
29
+ const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
30
+ const codeModeEndpoint =
31
+ readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
32
+
33
+ const res = await fetch(codeModeEndpoint, {
34
+ method: 'POST',
35
+ headers: {
36
+ ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
37
+ 'Content-Type': 'application/json',
38
+ client_envs: JSON.stringify({ SCORECARD_API_KEY: readEnv('SCORECARD_API_KEY') }),
50
39
  },
40
+ body: JSON.stringify({
41
+ project_name: 'scorecard',
42
+ client_opts: { environment: (readEnv('SCORECARD_ENVIRONMENT') || undefined) as any },
43
+ code,
44
+ }),
51
45
  });
52
46
 
53
- try {
54
- const resp = await new Promise<Response>((resolve, reject) => {
55
- worker.addEventListener('exit', (exitCode) => {
56
- reject(new Error(`Worker exited with code ${exitCode}`));
57
- });
58
-
59
- const opts: ClientOptions = {
60
- baseURL: client.baseURL,
61
- apiKey: client.apiKey,
62
- defaultHeaders: {
63
- 'X-Stainless-MCP': 'true',
64
- },
65
- };
66
-
67
- const req = worker.request(
68
- 'http://localhost',
69
- {
70
- headers: {
71
- 'content-type': 'application/json',
72
- },
73
- method: 'POST',
74
- },
75
- (resp) => {
76
- const body: Uint8Array[] = [];
77
- resp.on('error', (err) => {
78
- reject(err);
79
- });
80
- resp.on('data', (chunk) => {
81
- body.push(chunk);
82
- });
83
- resp.on('end', () => {
84
- resolve(
85
- new Response(Buffer.concat(body).toString(), {
86
- status: resp.statusCode ?? 200,
87
- headers: resp.headers as any,
88
- }),
89
- );
90
- });
91
- },
92
- );
93
-
94
- const body = JSON.stringify({
95
- opts,
96
- code,
97
- } satisfies WorkerInput);
98
-
99
- req.write(body, (err) => {
100
- if (err !== null && err !== undefined) {
101
- reject(err);
102
- }
103
- });
104
-
105
- req.end();
106
- });
107
-
108
- if (resp.status === 200) {
109
- const { result, logLines, errLines } = (await resp.json()) as WorkerSuccess;
110
- const returnOutput: ContentBlock | null =
111
- result === null ? null
112
- : result === undefined ? null
113
- : {
114
- type: 'text',
115
- text: typeof result === 'string' ? (result as string) : JSON.stringify(result),
116
- };
117
- const logOutput: ContentBlock | null =
118
- logLines.length === 0 ?
119
- null
120
- : {
121
- type: 'text',
122
- text: logLines.join('\n'),
123
- };
124
- const errOutput: ContentBlock | null =
125
- errLines.length === 0 ?
126
- null
127
- : {
128
- type: 'text',
129
- text: 'Error output:\n' + errLines.join('\n'),
130
- };
131
- return {
132
- content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
133
- };
134
- } else {
135
- const { message } = (await resp.json()) as WorkerError;
136
- throw new Error(message);
137
- }
138
- } catch (e) {
139
- throw e;
140
- } finally {
141
- worker.terminate();
47
+ if (!res.ok) {
48
+ throw new Error(
49
+ `${res.status}: ${
50
+ res.statusText
51
+ } error when trying to contact Code Tool server. Details: ${await res.text()}`,
52
+ );
142
53
  }
54
+
55
+ return asTextContentResult((await res.json()) as WorkerSuccess);
143
56
  };
144
57
 
145
58
  return { metadata, tool, handler };
@@ -13,8 +13,7 @@ export const metadata: Metadata = {
13
13
 
14
14
  export const tool: Tool = {
15
15
  name: 'search_docs',
16
- description:
17
- 'Search for documentation for how to use the client to interact with the API.\nThe tool will return an array of Markdown-formatted documentation pages.',
16
+ description: 'Search for documentation for how to use the client to interact with the API.',
18
17
  inputSchema: {
19
18
  type: 'object',
20
19
  properties: {
@@ -25,7 +24,12 @@ export const tool: Tool = {
25
24
  language: {
26
25
  type: 'string',
27
26
  description: 'The language for the SDK to search for.',
28
- enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
27
+ enum: ['http', 'python', 'go', 'typescript', 'javascript', 'terraform', 'ruby', 'java', 'kotlin'],
28
+ },
29
+ detail: {
30
+ type: 'string',
31
+ description: 'The amount of detail to return.',
32
+ enum: ['default', 'verbose'],
29
33
  },
30
34
  },
31
35
  required: ['query', 'language'],
@@ -42,6 +46,13 @@ export const handler = async (_: unknown, args: Record<string, unknown> | undefi
42
46
  const body = args as any;
43
47
  const query = new URLSearchParams(body).toString();
44
48
  const result = await fetch(`${docsSearchURL}?${query}`);
49
+
50
+ if (!result.ok) {
51
+ throw new Error(
52
+ `${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`,
53
+ );
54
+ }
55
+
45
56
  return asTextContentResult(await result.json());
46
57
  };
47
58
 
@@ -14,7 +14,7 @@ function zodToInputSchema(schema: z.ZodSchema) {
14
14
  /**
15
15
  * A list of tools that expose all the endpoints in the API dynamically.
16
16
  *
17
- * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
17
+ * Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
18
18
  * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
19
19
  * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
20
20
  *
package/src/filtering.ts CHANGED
@@ -12,3 +12,7 @@ export async function maybeFilter(jqFilter: unknown | undefined, response: any):
12
12
  async function jq(json: any, jqFilter: string) {
13
13
  return (await initJq).json(json, jqFilter);
14
14
  }
15
+
16
+ export function isJqError(error: any): error is Error {
17
+ return error instanceof Error && 'stderr' in error;
18
+ }
package/src/headers.ts CHANGED
@@ -11,7 +11,9 @@ export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> =
11
11
  case 'Bearer':
12
12
  return { apiKey: req.headers.authorization.slice('Bearer '.length) };
13
13
  default:
14
- throw new Error(`Unsupported authorization scheme`);
14
+ throw new Error(
15
+ 'Unsupported authorization scheme. Expected the "Authorization" header to be a supported scheme (Bearer).',
16
+ );
15
17
  }
16
18
  }
17
19
 
package/src/http.ts CHANGED
@@ -46,12 +46,12 @@ const newServer = ({
46
46
  },
47
47
  mcpOptions,
48
48
  });
49
- } catch {
49
+ } catch (error) {
50
50
  res.status(401).json({
51
51
  jsonrpc: '2.0',
52
52
  error: {
53
53
  code: -32000,
54
- message: 'Unauthorized',
54
+ message: `Unauthorized: ${error instanceof Error ? error.message : error}`,
55
55
  },
56
56
  });
57
57
  return null;
package/src/options.ts CHANGED
@@ -284,8 +284,10 @@ const coerceArray = <T extends z.ZodTypeAny>(zodType: T) =>
284
284
  );
285
285
 
286
286
  const QueryOptions = z.object({
287
- tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).describe('Use dynamic tools or all tools'),
288
- no_tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).describe('Do not use dynamic tools or all tools'),
287
+ tools: coerceArray(z.enum(['dynamic', 'all', 'code', 'docs'])).describe('Specify which MCP tools to use'),
288
+ no_tools: coerceArray(z.enum(['dynamic', 'all', 'code', 'docs'])).describe(
289
+ 'Specify which MCP tools to not use.',
290
+ ),
289
291
  tool: coerceArray(z.string()).describe('Include tools matching the specified names'),
290
292
  resource: coerceArray(z.string()).describe('Include tools matching the specified resources'),
291
293
  operation: coerceArray(z.enum(['read', 'write'])).describe(
@@ -385,11 +387,16 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
385
387
  : queryOptions.tools?.includes('docs') ? true
386
388
  : defaultOptions.includeDocsTools;
387
389
 
390
+ let codeTools: boolean | undefined =
391
+ queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
392
+ : queryOptions.tools?.includes('code') && defaultOptions.includeCodeTools ? true
393
+ : defaultOptions.includeCodeTools;
394
+
388
395
  return {
389
396
  client: queryOptions.client ?? defaultOptions.client,
390
397
  includeDynamicTools: dynamicTools,
391
398
  includeAllTools: allTools,
392
- includeCodeTools: undefined,
399
+ includeCodeTools: codeTools,
393
400
  includeDocsTools: docsTools,
394
401
  filters,
395
402
  capabilities: clientCapabilities,
package/src/server.ts CHANGED
@@ -34,7 +34,7 @@ export const newMcpServer = () =>
34
34
  new McpServer(
35
35
  {
36
36
  name: 'scorecard_ai_api',
37
- version: '2.4.1',
37
+ version: '2.6.0',
38
38
  },
39
39
  { capabilities: { tools: {}, logging: {} } },
40
40
  );
@@ -22,6 +22,7 @@ import get_runs from './runs/get-runs';
22
22
  import create_metrics from './metrics/create-metrics';
23
23
  import update_metrics from './metrics/update-metrics';
24
24
  import list_metrics from './metrics/list-metrics';
25
+ import delete_metrics from './metrics/delete-metrics';
25
26
  import get_metrics from './metrics/get-metrics';
26
27
  import create_records from './records/create-records';
27
28
  import list_records from './records/list-records';
@@ -59,6 +60,7 @@ addEndpoint(get_runs);
59
60
  addEndpoint(create_metrics);
60
61
  addEndpoint(update_metrics);
61
62
  addEndpoint(list_metrics);
63
+ addEndpoint(delete_metrics);
62
64
  addEndpoint(get_metrics);
63
65
  addEndpoint(create_records);
64
66
  addEndpoint(list_records);
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
4
4
 
5
5
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
6
  import Scorecard from 'scorecard-ai';
@@ -370,7 +370,14 @@ export const tool: Tool = {
370
370
 
371
371
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
372
372
  const { projectId, ...body } = args as any;
373
- return asTextContentResult(await client.metrics.create(projectId, body));
373
+ try {
374
+ return asTextContentResult(await client.metrics.create(projectId, body));
375
+ } catch (error) {
376
+ if (error instanceof Scorecard.APIError) {
377
+ return asErrorResult(error.message);
378
+ }
379
+ throw error;
380
+ }
374
381
  };
375
382
 
376
383
  export default { metadata, tool, handler };
@@ -0,0 +1,54 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { isJqError, maybeFilter } from 'scorecard-ai-mcp/filtering';
4
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
5
+
6
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
7
+ import Scorecard from 'scorecard-ai';
8
+
9
+ export const metadata: Metadata = {
10
+ resource: 'metrics',
11
+ operation: 'write',
12
+ tags: [],
13
+ httpMethod: 'delete',
14
+ httpPath: '/metrics/{metricId}',
15
+ operationId: 'deleteMetric',
16
+ };
17
+
18
+ export const tool: Tool = {
19
+ name: 'delete_metrics',
20
+ description:
21
+ "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDelete a specific Metric by ID. The metric will be removed from metric groups and monitors.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/metric_delete_response',\n $defs: {\n metric_delete_response: {\n type: 'object',\n properties: {\n success: {\n type: 'boolean',\n description: 'Whether the deletion was successful.'\n }\n },\n required: [ 'success'\n ]\n }\n }\n}\n```",
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ metricId: {
26
+ type: 'string',
27
+ },
28
+ jq_filter: {
29
+ type: 'string',
30
+ title: 'jq Filter',
31
+ description:
32
+ 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).',
33
+ },
34
+ },
35
+ required: ['metricId'],
36
+ },
37
+ annotations: {
38
+ idempotentHint: true,
39
+ },
40
+ };
41
+
42
+ export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
43
+ const { metricId, jq_filter, ...body } = args as any;
44
+ try {
45
+ return asTextContentResult(await maybeFilter(jq_filter, await client.metrics.delete(metricId)));
46
+ } catch (error) {
47
+ if (error instanceof Scorecard.APIError || isJqError(error)) {
48
+ return asErrorResult(error.message);
49
+ }
50
+ throw error;
51
+ }
52
+ };
53
+
54
+ export default { metadata, tool, handler };
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
4
4
 
5
5
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
6
  import Scorecard from 'scorecard-ai';
@@ -33,7 +33,14 @@ export const tool: Tool = {
33
33
 
34
34
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
35
35
  const { metricId, ...body } = args as any;
36
- return asTextContentResult(await client.metrics.get(metricId));
36
+ try {
37
+ return asTextContentResult(await client.metrics.get(metricId));
38
+ } catch (error) {
39
+ if (error instanceof Scorecard.APIError) {
40
+ return asErrorResult(error.message);
41
+ }
42
+ throw error;
43
+ }
37
44
  };
38
45
 
39
46
  export default { metadata, tool, handler };
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
4
4
 
5
5
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
6
  import Scorecard from 'scorecard-ai';
@@ -45,7 +45,14 @@ export const tool: Tool = {
45
45
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
46
46
  const { projectId, ...body } = args as any;
47
47
  const response = await client.metrics.list(projectId, body).asResponse();
48
- return asTextContentResult(await response.json());
48
+ try {
49
+ return asTextContentResult(await response.json());
50
+ } catch (error) {
51
+ if (error instanceof Scorecard.APIError) {
52
+ return asErrorResult(error.message);
53
+ }
54
+ throw error;
55
+ }
49
56
  };
50
57
 
51
58
  export default { metadata, tool, handler };
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
4
4
 
5
5
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
6
  import Scorecard from 'scorecard-ai';
@@ -370,7 +370,14 @@ export const tool: Tool = {
370
370
 
371
371
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
372
372
  const { metricId, ...body } = args as any;
373
- return asTextContentResult(await client.metrics.update(metricId, body));
373
+ try {
374
+ return asTextContentResult(await client.metrics.update(metricId, body));
375
+ } catch (error) {
376
+ if (error instanceof Scorecard.APIError) {
377
+ return asErrorResult(error.message);
378
+ }
379
+ throw error;
380
+ }
374
381
  };
375
382
 
376
383
  export default { metadata, tool, handler };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { maybeFilter } from 'scorecard-ai-mcp/filtering';
4
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { isJqError, maybeFilter } from 'scorecard-ai-mcp/filtering';
4
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
5
5
 
6
6
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
7
7
  import Scorecard from 'scorecard-ai';
@@ -44,7 +44,14 @@ export const tool: Tool = {
44
44
 
45
45
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
46
46
  const { jq_filter, ...body } = args as any;
47
- return asTextContentResult(await maybeFilter(jq_filter, await client.projects.create(body)));
47
+ try {
48
+ return asTextContentResult(await maybeFilter(jq_filter, await client.projects.create(body)));
49
+ } catch (error) {
50
+ if (error instanceof Scorecard.APIError || isJqError(error)) {
51
+ return asErrorResult(error.message);
52
+ }
53
+ throw error;
54
+ }
48
55
  };
49
56
 
50
57
  export default { metadata, tool, handler };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { maybeFilter } from 'scorecard-ai-mcp/filtering';
4
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { isJqError, maybeFilter } from 'scorecard-ai-mcp/filtering';
4
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
5
5
 
6
6
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
7
7
  import Scorecard from 'scorecard-ai';
@@ -49,7 +49,14 @@ export const tool: Tool = {
49
49
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
50
50
  const { jq_filter, ...body } = args as any;
51
51
  const response = await client.projects.list(body).asResponse();
52
- return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
52
+ try {
53
+ return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
54
+ } catch (error) {
55
+ if (error instanceof Scorecard.APIError || isJqError(error)) {
56
+ return asErrorResult(error.message);
57
+ }
58
+ throw error;
59
+ }
53
60
  };
54
61
 
55
62
  export default { metadata, tool, handler };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { maybeFilter } from 'scorecard-ai-mcp/filtering';
4
- import { Metadata, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
3
+ import { isJqError, maybeFilter } from 'scorecard-ai-mcp/filtering';
4
+ import { Metadata, asErrorResult, asTextContentResult } from 'scorecard-ai-mcp/tools/types';
5
5
 
6
6
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
7
7
  import Scorecard from 'scorecard-ai';
@@ -58,7 +58,14 @@ export const tool: Tool = {
58
58
 
59
59
  export const handler = async (client: Scorecard, args: Record<string, unknown> | undefined) => {
60
60
  const { runId, jq_filter, ...body } = args as any;
61
- return asTextContentResult(await maybeFilter(jq_filter, await client.records.create(runId, body)));
61
+ try {
62
+ return asTextContentResult(await maybeFilter(jq_filter, await client.records.create(runId, body)));
63
+ } catch (error) {
64
+ if (error instanceof Scorecard.APIError || isJqError(error)) {
65
+ return asErrorResult(error.message);
66
+ }
67
+ throw error;
68
+ }
62
69
  };
63
70
 
64
71
  export default { metadata, tool, handler };