scorecard-ai-mcp 2.5.0 → 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.
- package/code-tool-types.d.mts +2 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +2 -0
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts +44 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +44 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +23 -129
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +23 -96
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +12 -6
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +12 -6
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +10 -2
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +10 -2
- package/docs-search-tool.mjs.map +1 -1
- package/package.json +3 -19
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-types.ts +5 -1
- package/src/code-tool.ts +33 -121
- package/src/docs-search-tool.ts +14 -3
- package/src/server.ts +1 -1
- package/src/tools/metrics/create-metrics.ts +9 -2
- package/src/tools/metrics/delete-metrics.ts +1 -1
- package/src/tools/metrics/get-metrics.ts +9 -2
- package/src/tools/metrics/list-metrics.ts +9 -2
- package/src/tools/metrics/update-metrics.ts +9 -2
- package/src/tools/projects/create-projects.ts +1 -1
- package/src/tools/projects/list-projects.ts +1 -1
- package/src/tools/records/create-records.ts +1 -1
- package/src/tools/records/delete-records.ts +1 -1
- package/src/tools/records/list-records.ts +1 -1
- package/src/tools/runs/create-runs.ts +1 -1
- package/src/tools/runs/get-runs.ts +1 -1
- package/src/tools/runs/list-runs.ts +1 -1
- package/src/tools/scores/upsert-scores.ts +1 -1
- package/src/tools/systems/delete-systems.ts +1 -1
- package/src/tools/systems/get-systems.ts +1 -1
- package/src/tools/systems/list-systems.ts +1 -1
- package/src/tools/systems/update-systems.ts +1 -1
- package/src/tools/systems/upsert-systems.ts +1 -1
- package/src/tools/systems/versions/get-systems-versions.ts +1 -1
- package/src/tools/systems/versions/upsert-systems-versions.ts +1 -1
- package/src/tools/testcases/create-testcases.ts +1 -1
- package/src/tools/testcases/delete-testcases.ts +1 -1
- package/src/tools/testcases/get-testcases.ts +1 -1
- package/src/tools/testcases/list-testcases.ts +1 -1
- package/src/tools/testcases/update-testcases.ts +1 -1
- package/src/tools/testsets/create-testsets.ts +1 -1
- package/src/tools/testsets/delete-testsets.ts +1 -1
- package/src/tools/testsets/get-testsets.ts +1 -1
- package/src/tools/testsets/list-testsets.ts +1 -1
- package/src/tools/testsets/update-testsets.ts +1 -1
- package/tools/metrics/create-metrics.d.mts +12 -6
- package/tools/metrics/create-metrics.d.mts.map +1 -1
- package/tools/metrics/create-metrics.d.ts +12 -6
- package/tools/metrics/create-metrics.d.ts.map +1 -1
- package/tools/metrics/create-metrics.js +13 -1
- package/tools/metrics/create-metrics.js.map +1 -1
- package/tools/metrics/create-metrics.mjs +11 -2
- package/tools/metrics/create-metrics.mjs.map +1 -1
- package/tools/metrics/delete-metrics.d.mts +12 -6
- package/tools/metrics/delete-metrics.d.mts.map +1 -1
- package/tools/metrics/delete-metrics.d.ts +12 -6
- package/tools/metrics/delete-metrics.d.ts.map +1 -1
- package/tools/metrics/delete-metrics.js +5 -1
- package/tools/metrics/delete-metrics.js.map +1 -1
- package/tools/metrics/delete-metrics.mjs +2 -1
- package/tools/metrics/delete-metrics.mjs.map +1 -1
- package/tools/metrics/get-metrics.d.mts +12 -6
- package/tools/metrics/get-metrics.d.mts.map +1 -1
- package/tools/metrics/get-metrics.d.ts +12 -6
- package/tools/metrics/get-metrics.d.ts.map +1 -1
- package/tools/metrics/get-metrics.js +13 -1
- package/tools/metrics/get-metrics.js.map +1 -1
- package/tools/metrics/get-metrics.mjs +11 -2
- package/tools/metrics/get-metrics.mjs.map +1 -1
- package/tools/metrics/list-metrics.d.mts +12 -6
- package/tools/metrics/list-metrics.d.mts.map +1 -1
- package/tools/metrics/list-metrics.d.ts +12 -6
- package/tools/metrics/list-metrics.d.ts.map +1 -1
- package/tools/metrics/list-metrics.js +13 -1
- package/tools/metrics/list-metrics.js.map +1 -1
- package/tools/metrics/list-metrics.mjs +11 -2
- package/tools/metrics/list-metrics.mjs.map +1 -1
- package/tools/metrics/update-metrics.d.mts +12 -6
- package/tools/metrics/update-metrics.d.mts.map +1 -1
- package/tools/metrics/update-metrics.d.ts +12 -6
- package/tools/metrics/update-metrics.d.ts.map +1 -1
- package/tools/metrics/update-metrics.js +13 -1
- package/tools/metrics/update-metrics.js.map +1 -1
- package/tools/metrics/update-metrics.mjs +11 -2
- package/tools/metrics/update-metrics.mjs.map +1 -1
- package/tools/projects/create-projects.d.mts +12 -6
- package/tools/projects/create-projects.d.mts.map +1 -1
- package/tools/projects/create-projects.d.ts +12 -6
- package/tools/projects/create-projects.d.ts.map +1 -1
- package/tools/projects/create-projects.js +5 -1
- package/tools/projects/create-projects.js.map +1 -1
- package/tools/projects/create-projects.mjs +2 -1
- package/tools/projects/create-projects.mjs.map +1 -1
- package/tools/projects/list-projects.d.mts +12 -6
- package/tools/projects/list-projects.d.mts.map +1 -1
- package/tools/projects/list-projects.d.ts +12 -6
- package/tools/projects/list-projects.d.ts.map +1 -1
- package/tools/projects/list-projects.js +5 -1
- package/tools/projects/list-projects.js.map +1 -1
- package/tools/projects/list-projects.mjs +2 -1
- package/tools/projects/list-projects.mjs.map +1 -1
- package/tools/records/create-records.d.mts +12 -6
- package/tools/records/create-records.d.mts.map +1 -1
- package/tools/records/create-records.d.ts +12 -6
- package/tools/records/create-records.d.ts.map +1 -1
- package/tools/records/create-records.js +5 -1
- package/tools/records/create-records.js.map +1 -1
- package/tools/records/create-records.mjs +2 -1
- package/tools/records/create-records.mjs.map +1 -1
- package/tools/records/delete-records.d.mts +12 -6
- package/tools/records/delete-records.d.mts.map +1 -1
- package/tools/records/delete-records.d.ts +12 -6
- package/tools/records/delete-records.d.ts.map +1 -1
- package/tools/records/delete-records.js +5 -1
- package/tools/records/delete-records.js.map +1 -1
- package/tools/records/delete-records.mjs +2 -1
- package/tools/records/delete-records.mjs.map +1 -1
- package/tools/records/list-records.d.mts +12 -6
- package/tools/records/list-records.d.mts.map +1 -1
- package/tools/records/list-records.d.ts +12 -6
- package/tools/records/list-records.d.ts.map +1 -1
- package/tools/records/list-records.js +5 -1
- package/tools/records/list-records.js.map +1 -1
- package/tools/records/list-records.mjs +2 -1
- package/tools/records/list-records.mjs.map +1 -1
- package/tools/runs/create-runs.d.mts +12 -6
- package/tools/runs/create-runs.d.mts.map +1 -1
- package/tools/runs/create-runs.d.ts +12 -6
- package/tools/runs/create-runs.d.ts.map +1 -1
- package/tools/runs/create-runs.js +5 -1
- package/tools/runs/create-runs.js.map +1 -1
- package/tools/runs/create-runs.mjs +2 -1
- package/tools/runs/create-runs.mjs.map +1 -1
- package/tools/runs/get-runs.d.mts +12 -6
- package/tools/runs/get-runs.d.mts.map +1 -1
- package/tools/runs/get-runs.d.ts +12 -6
- package/tools/runs/get-runs.d.ts.map +1 -1
- package/tools/runs/get-runs.js +5 -1
- package/tools/runs/get-runs.js.map +1 -1
- package/tools/runs/get-runs.mjs +2 -1
- package/tools/runs/get-runs.mjs.map +1 -1
- package/tools/runs/list-runs.d.mts +12 -6
- package/tools/runs/list-runs.d.mts.map +1 -1
- package/tools/runs/list-runs.d.ts +12 -6
- package/tools/runs/list-runs.d.ts.map +1 -1
- package/tools/runs/list-runs.js +5 -1
- package/tools/runs/list-runs.js.map +1 -1
- package/tools/runs/list-runs.mjs +2 -1
- package/tools/runs/list-runs.mjs.map +1 -1
- package/tools/scores/upsert-scores.d.mts +12 -6
- package/tools/scores/upsert-scores.d.mts.map +1 -1
- package/tools/scores/upsert-scores.d.ts +12 -6
- package/tools/scores/upsert-scores.d.ts.map +1 -1
- package/tools/scores/upsert-scores.js +5 -1
- package/tools/scores/upsert-scores.js.map +1 -1
- package/tools/scores/upsert-scores.mjs +2 -1
- package/tools/scores/upsert-scores.mjs.map +1 -1
- package/tools/systems/delete-systems.d.mts +12 -6
- package/tools/systems/delete-systems.d.mts.map +1 -1
- package/tools/systems/delete-systems.d.ts +12 -6
- package/tools/systems/delete-systems.d.ts.map +1 -1
- package/tools/systems/delete-systems.js +5 -1
- package/tools/systems/delete-systems.js.map +1 -1
- package/tools/systems/delete-systems.mjs +2 -1
- package/tools/systems/delete-systems.mjs.map +1 -1
- package/tools/systems/get-systems.d.mts +12 -6
- package/tools/systems/get-systems.d.mts.map +1 -1
- package/tools/systems/get-systems.d.ts +12 -6
- package/tools/systems/get-systems.d.ts.map +1 -1
- package/tools/systems/get-systems.js +5 -1
- package/tools/systems/get-systems.js.map +1 -1
- package/tools/systems/get-systems.mjs +2 -1
- package/tools/systems/get-systems.mjs.map +1 -1
- package/tools/systems/list-systems.d.mts +12 -6
- package/tools/systems/list-systems.d.mts.map +1 -1
- package/tools/systems/list-systems.d.ts +12 -6
- package/tools/systems/list-systems.d.ts.map +1 -1
- package/tools/systems/list-systems.js +5 -1
- package/tools/systems/list-systems.js.map +1 -1
- package/tools/systems/list-systems.mjs +2 -1
- package/tools/systems/list-systems.mjs.map +1 -1
- package/tools/systems/update-systems.d.mts +12 -6
- package/tools/systems/update-systems.d.mts.map +1 -1
- package/tools/systems/update-systems.d.ts +12 -6
- package/tools/systems/update-systems.d.ts.map +1 -1
- package/tools/systems/update-systems.js +5 -1
- package/tools/systems/update-systems.js.map +1 -1
- package/tools/systems/update-systems.mjs +2 -1
- package/tools/systems/update-systems.mjs.map +1 -1
- package/tools/systems/upsert-systems.d.mts +12 -6
- package/tools/systems/upsert-systems.d.mts.map +1 -1
- package/tools/systems/upsert-systems.d.ts +12 -6
- package/tools/systems/upsert-systems.d.ts.map +1 -1
- package/tools/systems/upsert-systems.js +5 -1
- package/tools/systems/upsert-systems.js.map +1 -1
- package/tools/systems/upsert-systems.mjs +2 -1
- package/tools/systems/upsert-systems.mjs.map +1 -1
- package/tools/systems/versions/get-systems-versions.d.mts +12 -6
- package/tools/systems/versions/get-systems-versions.d.mts.map +1 -1
- package/tools/systems/versions/get-systems-versions.d.ts +12 -6
- package/tools/systems/versions/get-systems-versions.d.ts.map +1 -1
- package/tools/systems/versions/get-systems-versions.js +5 -1
- package/tools/systems/versions/get-systems-versions.js.map +1 -1
- package/tools/systems/versions/get-systems-versions.mjs +2 -1
- package/tools/systems/versions/get-systems-versions.mjs.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.mts +12 -6
- package/tools/systems/versions/upsert-systems-versions.d.mts.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.ts +12 -6
- package/tools/systems/versions/upsert-systems-versions.d.ts.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.js +5 -1
- package/tools/systems/versions/upsert-systems-versions.js.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.mjs +2 -1
- package/tools/systems/versions/upsert-systems-versions.mjs.map +1 -1
- package/tools/testcases/create-testcases.d.mts +12 -6
- package/tools/testcases/create-testcases.d.mts.map +1 -1
- package/tools/testcases/create-testcases.d.ts +12 -6
- package/tools/testcases/create-testcases.d.ts.map +1 -1
- package/tools/testcases/create-testcases.js +5 -1
- package/tools/testcases/create-testcases.js.map +1 -1
- package/tools/testcases/create-testcases.mjs +2 -1
- package/tools/testcases/create-testcases.mjs.map +1 -1
- package/tools/testcases/delete-testcases.d.mts +12 -6
- package/tools/testcases/delete-testcases.d.mts.map +1 -1
- package/tools/testcases/delete-testcases.d.ts +12 -6
- package/tools/testcases/delete-testcases.d.ts.map +1 -1
- package/tools/testcases/delete-testcases.js +5 -1
- package/tools/testcases/delete-testcases.js.map +1 -1
- package/tools/testcases/delete-testcases.mjs +2 -1
- package/tools/testcases/delete-testcases.mjs.map +1 -1
- package/tools/testcases/get-testcases.d.mts +12 -6
- package/tools/testcases/get-testcases.d.mts.map +1 -1
- package/tools/testcases/get-testcases.d.ts +12 -6
- package/tools/testcases/get-testcases.d.ts.map +1 -1
- package/tools/testcases/get-testcases.js +5 -1
- package/tools/testcases/get-testcases.js.map +1 -1
- package/tools/testcases/get-testcases.mjs +2 -1
- package/tools/testcases/get-testcases.mjs.map +1 -1
- package/tools/testcases/list-testcases.d.mts +12 -6
- package/tools/testcases/list-testcases.d.mts.map +1 -1
- package/tools/testcases/list-testcases.d.ts +12 -6
- package/tools/testcases/list-testcases.d.ts.map +1 -1
- package/tools/testcases/list-testcases.js +5 -1
- package/tools/testcases/list-testcases.js.map +1 -1
- package/tools/testcases/list-testcases.mjs +2 -1
- package/tools/testcases/list-testcases.mjs.map +1 -1
- package/tools/testcases/update-testcases.d.mts +12 -6
- package/tools/testcases/update-testcases.d.mts.map +1 -1
- package/tools/testcases/update-testcases.d.ts +12 -6
- package/tools/testcases/update-testcases.d.ts.map +1 -1
- package/tools/testcases/update-testcases.js +5 -1
- package/tools/testcases/update-testcases.js.map +1 -1
- package/tools/testcases/update-testcases.mjs +2 -1
- package/tools/testcases/update-testcases.mjs.map +1 -1
- package/tools/testsets/create-testsets.d.mts +12 -6
- package/tools/testsets/create-testsets.d.mts.map +1 -1
- package/tools/testsets/create-testsets.d.ts +12 -6
- package/tools/testsets/create-testsets.d.ts.map +1 -1
- package/tools/testsets/create-testsets.js +5 -1
- package/tools/testsets/create-testsets.js.map +1 -1
- package/tools/testsets/create-testsets.mjs +2 -1
- package/tools/testsets/create-testsets.mjs.map +1 -1
- package/tools/testsets/delete-testsets.d.mts +12 -6
- package/tools/testsets/delete-testsets.d.mts.map +1 -1
- package/tools/testsets/delete-testsets.d.ts +12 -6
- package/tools/testsets/delete-testsets.d.ts.map +1 -1
- package/tools/testsets/delete-testsets.js +5 -1
- package/tools/testsets/delete-testsets.js.map +1 -1
- package/tools/testsets/delete-testsets.mjs +2 -1
- package/tools/testsets/delete-testsets.mjs.map +1 -1
- package/tools/testsets/get-testsets.d.mts +12 -6
- package/tools/testsets/get-testsets.d.mts.map +1 -1
- package/tools/testsets/get-testsets.d.ts +12 -6
- package/tools/testsets/get-testsets.d.ts.map +1 -1
- package/tools/testsets/get-testsets.js +5 -1
- package/tools/testsets/get-testsets.js.map +1 -1
- package/tools/testsets/get-testsets.mjs +2 -1
- package/tools/testsets/get-testsets.mjs.map +1 -1
- package/tools/testsets/list-testsets.d.mts +12 -6
- package/tools/testsets/list-testsets.d.mts.map +1 -1
- package/tools/testsets/list-testsets.d.ts +12 -6
- package/tools/testsets/list-testsets.d.ts.map +1 -1
- package/tools/testsets/list-testsets.js +5 -1
- package/tools/testsets/list-testsets.js.map +1 -1
- package/tools/testsets/list-testsets.mjs +2 -1
- package/tools/testsets/list-testsets.mjs.map +1 -1
- package/tools/testsets/update-testsets.d.mts +12 -6
- package/tools/testsets/update-testsets.d.mts.map +1 -1
- package/tools/testsets/update-testsets.d.ts +12 -6
- package/tools/testsets/update-testsets.d.ts.map +1 -1
- package/tools/testsets/update-testsets.js +5 -1
- package/tools/testsets/update-testsets.js.map +1 -1
- package/tools/testsets/update-testsets.mjs +2 -1
- package/tools/testsets/update-testsets.mjs.map +1 -1
- package/code-tool-paths.cjs +0 -6
- package/code-tool-paths.cjs.map +0 -1
- package/code-tool-paths.d.cts +0 -2
- package/code-tool-paths.d.cts.map +0 -1
- package/code-tool-worker.d.mts +0 -5
- package/code-tool-worker.d.mts.map +0 -1
- package/code-tool-worker.d.ts +0 -5
- package/code-tool-worker.d.ts.map +0 -1
- package/code-tool-worker.js +0 -179
- package/code-tool-worker.js.map +0 -1
- package/code-tool-worker.mjs +0 -174
- package/code-tool-worker.mjs.map +0 -1
- package/src/code-tool-paths.cts +0 -3
- package/src/code-tool-worker.ts +0 -225
package/docs-search-tool.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.metadata = {
|
|
|
11
11
|
};
|
|
12
12
|
exports.tool = {
|
|
13
13
|
name: 'search_docs',
|
|
14
|
-
description: 'Search for documentation for how to use the client to interact with the API
|
|
14
|
+
description: 'Search for documentation for how to use the client to interact with the API.',
|
|
15
15
|
inputSchema: {
|
|
16
16
|
type: 'object',
|
|
17
17
|
properties: {
|
|
@@ -22,7 +22,12 @@ exports.tool = {
|
|
|
22
22
|
language: {
|
|
23
23
|
type: 'string',
|
|
24
24
|
description: 'The language for the SDK to search for.',
|
|
25
|
-
enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
25
|
+
enum: ['http', 'python', 'go', 'typescript', 'javascript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
26
|
+
},
|
|
27
|
+
detail: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'The amount of detail to return.',
|
|
30
|
+
enum: ['default', 'verbose'],
|
|
26
31
|
},
|
|
27
32
|
},
|
|
28
33
|
required: ['query', 'language'],
|
|
@@ -36,6 +41,9 @@ const handler = async (_, args) => {
|
|
|
36
41
|
const body = args;
|
|
37
42
|
const query = new URLSearchParams(body).toString();
|
|
38
43
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
throw new Error(`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`);
|
|
46
|
+
}
|
|
39
47
|
return (0, types_1.asTextContentResult)(await result.json());
|
|
40
48
|
};
|
|
41
49
|
exports.handler = handler;
|
package/docs-search-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAA8D;AAIjD,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAA8D;AAIjD,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8EAA8E;IAC3F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;gBACtD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;aAClG;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;gBAC9C,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;KAChC;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,8DAA8D,CAAC;AAE5F,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAyC,EAAE,EAAE;IACrF,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC,CAAC;IAExD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,yCAAyC,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,2BAAmB,EAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAZW,QAAA,OAAO,WAYlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
package/docs-search-tool.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export const metadata = {
|
|
|
8
8
|
};
|
|
9
9
|
export const tool = {
|
|
10
10
|
name: 'search_docs',
|
|
11
|
-
description: 'Search for documentation for how to use the client to interact with the API
|
|
11
|
+
description: 'Search for documentation for how to use the client to interact with the API.',
|
|
12
12
|
inputSchema: {
|
|
13
13
|
type: 'object',
|
|
14
14
|
properties: {
|
|
@@ -19,7 +19,12 @@ export const tool = {
|
|
|
19
19
|
language: {
|
|
20
20
|
type: 'string',
|
|
21
21
|
description: 'The language for the SDK to search for.',
|
|
22
|
-
enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
22
|
+
enum: ['http', 'python', 'go', 'typescript', 'javascript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
23
|
+
},
|
|
24
|
+
detail: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'The amount of detail to return.',
|
|
27
|
+
enum: ['default', 'verbose'],
|
|
23
28
|
},
|
|
24
29
|
},
|
|
25
30
|
required: ['query', 'language'],
|
|
@@ -33,6 +38,9 @@ export const handler = async (_, args) => {
|
|
|
33
38
|
const body = args;
|
|
34
39
|
const query = new URLSearchParams(body).toString();
|
|
35
40
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
41
|
+
if (!result.ok) {
|
|
42
|
+
throw new Error(`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`);
|
|
43
|
+
}
|
|
36
44
|
return asTextContentResult(await result.json());
|
|
37
45
|
};
|
|
38
46
|
export default { metadata, tool, handler };
|
package/docs-search-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.mjs","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAY,mBAAmB,EAAE;AAIxC,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.mjs","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAY,mBAAmB,EAAE;AAIxC,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8EAA8E;IAC3F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;gBACtD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;aAClG;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;gBAC9C,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;KAChC;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,8DAA8D,CAAC;AAEnG,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAyC,EAAE,EAAE;IACrF,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC,CAAC;IAExD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,yCAAyC,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,mBAAmB,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scorecard-ai-mcp",
|
|
3
|
-
"version": "2.
|
|
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,9 +28,9 @@
|
|
|
28
28
|
"fix": "eslint --fix --ext ts,js ."
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"scorecard-ai": "^2.
|
|
31
|
+
"scorecard-ai": "^2.6.0",
|
|
32
32
|
"@cloudflare/cabidela": "^0.2.4",
|
|
33
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
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",
|
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
"types": "./index.d.mts",
|
|
60
60
|
"default": "./index.mjs"
|
|
61
61
|
},
|
|
62
|
-
"./code-tool-paths": {
|
|
63
|
-
"require": "./code-tool-paths.cjs"
|
|
64
|
-
},
|
|
65
|
-
"./code-tool-paths.cjs": {
|
|
66
|
-
"default": "./code-tool-paths.cjs"
|
|
67
|
-
},
|
|
68
62
|
"./code-tool-types": {
|
|
69
63
|
"import": "./code-tool-types.mjs",
|
|
70
64
|
"require": "./code-tool-types.js"
|
|
@@ -75,16 +69,6 @@
|
|
|
75
69
|
"./code-tool-types.mjs": {
|
|
76
70
|
"default": "./code-tool-types.mjs"
|
|
77
71
|
},
|
|
78
|
-
"./code-tool-worker": {
|
|
79
|
-
"import": "./code-tool-worker.mjs",
|
|
80
|
-
"require": "./code-tool-worker.js"
|
|
81
|
-
},
|
|
82
|
-
"./code-tool-worker.js": {
|
|
83
|
-
"default": "./code-tool-worker.js"
|
|
84
|
-
},
|
|
85
|
-
"./code-tool-worker.mjs": {
|
|
86
|
-
"default": "./code-tool-worker.mjs"
|
|
87
|
-
},
|
|
88
72
|
"./code-tool": {
|
|
89
73
|
"import": "./code-tool.mjs",
|
|
90
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.
|
|
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.
|
|
14
|
+
version: '2.6.0',
|
|
15
15
|
}, { capabilities: { tools: {}, logging: {} } });
|
|
16
16
|
// Create server instance
|
|
17
17
|
export const server = newMcpServer();
|
package/src/code-tool-types.ts
CHANGED
package/src/code-tool.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import Scorecard, { ClientOptions } from 'scorecard-ai';
|
|
6
|
-
import { ContentBlock, Endpoint, Metadata, ToolCallResult } from './tools/types';
|
|
7
|
-
|
|
3
|
+
import { Metadata, ToolCallResult, asTextContentResult } from './tools/types';
|
|
8
4
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
-
|
|
10
|
-
import {
|
|
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
|
*
|
|
@@ -18,129 +13,46 @@ import { WorkerInput, WorkerError, WorkerSuccess } from './code-tool-types';
|
|
|
18
13
|
*
|
|
19
14
|
* @param endpoints - The endpoints to include in the list.
|
|
20
15
|
*/
|
|
21
|
-
export async function codeTool()
|
|
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 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
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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) {
|
|
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
|
-
{
|
|
113
|
-
type: 'text',
|
|
114
|
-
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
115
|
-
}
|
|
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
|
-
return {
|
|
137
|
-
content: message == null ? [] : [{ type: 'text', text: message }],
|
|
138
|
-
isError: true,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
} finally {
|
|
142
|
-
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
|
+
);
|
|
143
53
|
}
|
|
54
|
+
|
|
55
|
+
return asTextContentResult((await res.json()) as WorkerSuccess);
|
|
144
56
|
};
|
|
145
57
|
|
|
146
58
|
return { metadata, tool, handler };
|
package/src/docs-search-tool.ts
CHANGED
|
@@ -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
|
|
package/src/server.ts
CHANGED
|
@@ -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
|
-
|
|
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 };
|
|
@@ -44,7 +44,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
44
44
|
try {
|
|
45
45
|
return asTextContentResult(await maybeFilter(jq_filter, await client.metrics.delete(metricId)));
|
|
46
46
|
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
47
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
48
48
|
return asErrorResult(error.message);
|
|
49
49
|
}
|
|
50
50
|
throw error;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -47,7 +47,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
47
47
|
try {
|
|
48
48
|
return asTextContentResult(await maybeFilter(jq_filter, await client.projects.create(body)));
|
|
49
49
|
} catch (error) {
|
|
50
|
-
if (isJqError(error)) {
|
|
50
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
51
51
|
return asErrorResult(error.message);
|
|
52
52
|
}
|
|
53
53
|
throw error;
|
|
@@ -52,7 +52,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
52
52
|
try {
|
|
53
53
|
return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
|
|
54
54
|
} catch (error) {
|
|
55
|
-
if (isJqError(error)) {
|
|
55
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
56
56
|
return asErrorResult(error.message);
|
|
57
57
|
}
|
|
58
58
|
throw error;
|
|
@@ -61,7 +61,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
61
61
|
try {
|
|
62
62
|
return asTextContentResult(await maybeFilter(jq_filter, await client.records.create(runId, body)));
|
|
63
63
|
} catch (error) {
|
|
64
|
-
if (isJqError(error)) {
|
|
64
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
65
65
|
return asErrorResult(error.message);
|
|
66
66
|
}
|
|
67
67
|
throw error;
|
|
@@ -44,7 +44,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
44
44
|
try {
|
|
45
45
|
return asTextContentResult(await maybeFilter(jq_filter, await client.records.delete(recordId)));
|
|
46
46
|
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
47
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
48
48
|
return asErrorResult(error.message);
|
|
49
49
|
}
|
|
50
50
|
throw error;
|
|
@@ -55,7 +55,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
55
55
|
try {
|
|
56
56
|
return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (isJqError(error)) {
|
|
58
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
59
59
|
return asErrorResult(error.message);
|
|
60
60
|
}
|
|
61
61
|
throw error;
|
|
@@ -57,7 +57,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
57
57
|
try {
|
|
58
58
|
return asTextContentResult(await maybeFilter(jq_filter, await client.runs.create(projectId, body)));
|
|
59
59
|
} catch (error) {
|
|
60
|
-
if (isJqError(error)) {
|
|
60
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
61
61
|
return asErrorResult(error.message);
|
|
62
62
|
}
|
|
63
63
|
throw error;
|
|
@@ -44,7 +44,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
44
44
|
try {
|
|
45
45
|
return asTextContentResult(await maybeFilter(jq_filter, await client.runs.get(runId)));
|
|
46
46
|
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
47
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
48
48
|
return asErrorResult(error.message);
|
|
49
49
|
}
|
|
50
50
|
throw error;
|
|
@@ -55,7 +55,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
55
55
|
try {
|
|
56
56
|
return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (isJqError(error)) {
|
|
58
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
59
59
|
return asErrorResult(error.message);
|
|
60
60
|
}
|
|
61
61
|
throw error;
|
|
@@ -55,7 +55,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
55
55
|
await maybeFilter(jq_filter, await client.scores.upsert(metricConfigId, body)),
|
|
56
56
|
);
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (isJqError(error)) {
|
|
58
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
59
59
|
return asErrorResult(error.message);
|
|
60
60
|
}
|
|
61
61
|
throw error;
|
|
@@ -44,7 +44,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
44
44
|
try {
|
|
45
45
|
return asTextContentResult(await maybeFilter(jq_filter, await client.systems.delete(systemId)));
|
|
46
46
|
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
47
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
48
48
|
return asErrorResult(error.message);
|
|
49
49
|
}
|
|
50
50
|
throw error;
|
|
@@ -44,7 +44,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
44
44
|
try {
|
|
45
45
|
return asTextContentResult(await maybeFilter(jq_filter, await client.systems.get(systemId)));
|
|
46
46
|
} catch (error) {
|
|
47
|
-
if (isJqError(error)) {
|
|
47
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
48
48
|
return asErrorResult(error.message);
|
|
49
49
|
}
|
|
50
50
|
throw error;
|
|
@@ -55,7 +55,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
55
55
|
try {
|
|
56
56
|
return asTextContentResult(await maybeFilter(jq_filter, await response.json()));
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (isJqError(error)) {
|
|
58
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
59
59
|
return asErrorResult(error.message);
|
|
60
60
|
}
|
|
61
61
|
throw error;
|
|
@@ -54,7 +54,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
54
54
|
try {
|
|
55
55
|
return asTextContentResult(await maybeFilter(jq_filter, await client.systems.update(systemId, body)));
|
|
56
56
|
} catch (error) {
|
|
57
|
-
if (isJqError(error)) {
|
|
57
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
58
58
|
return asErrorResult(error.message);
|
|
59
59
|
}
|
|
60
60
|
throw error;
|
|
@@ -56,7 +56,7 @@ export const handler = async (client: Scorecard, args: Record<string, unknown> |
|
|
|
56
56
|
try {
|
|
57
57
|
return asTextContentResult(await maybeFilter(jq_filter, await client.systems.upsert(projectId, body)));
|
|
58
58
|
} catch (error) {
|
|
59
|
-
if (isJqError(error)) {
|
|
59
|
+
if (error instanceof Scorecard.APIError || isJqError(error)) {
|
|
60
60
|
return asErrorResult(error.message);
|
|
61
61
|
}
|
|
62
62
|
throw error;
|