scorecard-ai-mcp 2.6.0 → 3.0.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/LICENSE +1 -1
- package/README.md +76 -194
- package/code-tool-types.d.mts +7 -9
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +7 -9
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts +2 -44
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +2 -44
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +60 -8
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +61 -9
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +4 -3
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +4 -3
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +2 -1
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +2 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +2 -22
- package/http.js.map +1 -1
- package/http.mjs +2 -22
- package/http.mjs.map +1 -1
- package/index.js +4 -40
- package/index.js.map +1 -1
- package/index.mjs +4 -40
- package/index.mjs.map +1 -1
- package/options.d.mts +0 -9
- package/options.d.mts.map +1 -1
- package/options.d.ts +0 -9
- package/options.d.ts.map +1 -1
- package/options.js +6 -361
- package/options.js.map +1 -1
- package/options.mjs +6 -361
- package/options.mjs.map +1 -1
- package/package.json +11 -51
- package/server.d.mts +3 -8
- package/server.d.mts.map +1 -1
- package/server.d.ts +3 -8
- package/server.d.ts.map +1 -1
- package/server.js +12 -65
- package/server.js.map +1 -1
- package/server.mjs +11 -62
- package/server.mjs.map +1 -1
- package/src/code-tool-types.ts +7 -9
- package/src/code-tool.ts +66 -12
- package/src/docs-search-tool.ts +2 -1
- package/src/http.ts +3 -24
- package/src/index.ts +5 -52
- package/src/options.ts +7 -388
- package/src/server.ts +12 -72
- package/src/stdio.ts +2 -3
- package/src/{tools/types.ts → types.ts} +1 -1
- package/stdio.d.mts +1 -2
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -2
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +1 -1
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +1 -1
- package/types.d.ts.map +1 -0
- package/types.js.map +1 -0
- package/types.mjs.map +1 -0
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -3
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -3
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -24
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -16
- package/filtering.mjs.map +0 -1
- package/src/compat.ts +0 -483
- package/src/dynamic-tools.ts +0 -159
- package/src/filtering.ts +0 -18
- package/src/tools/index.ts +0 -131
- package/src/tools/metrics/create-metrics.ts +0 -383
- package/src/tools/metrics/delete-metrics.ts +0 -54
- package/src/tools/metrics/get-metrics.ts +0 -46
- package/src/tools/metrics/list-metrics.ts +0 -58
- package/src/tools/metrics/update-metrics.ts +0 -383
- package/src/tools/projects/create-projects.ts +0 -57
- package/src/tools/projects/list-projects.ts +0 -62
- package/src/tools/records/create-records.ts +0 -71
- package/src/tools/records/delete-records.ts +0 -54
- package/src/tools/records/list-records.ts +0 -65
- package/src/tools/runs/create-runs.ts +0 -67
- package/src/tools/runs/get-runs.ts +0 -54
- package/src/tools/runs/list-runs.ts +0 -65
- package/src/tools/scores/upsert-scores.ts +0 -65
- package/src/tools/systems/delete-systems.ts +0 -54
- package/src/tools/systems/get-systems.ts +0 -54
- package/src/tools/systems/list-systems.ts +0 -65
- package/src/tools/systems/update-systems.ts +0 -64
- package/src/tools/systems/upsert-systems.ts +0 -66
- package/src/tools/systems/versions/get-systems-versions.ts +0 -56
- package/src/tools/systems/versions/upsert-systems-versions.ts +0 -64
- package/src/tools/testcases/create-testcases.ts +0 -67
- package/src/tools/testcases/delete-testcases.ts +0 -56
- package/src/tools/testcases/get-testcases.ts +0 -54
- package/src/tools/testcases/list-testcases.ts +0 -65
- package/src/tools/testcases/update-testcases.ts +0 -59
- package/src/tools/testsets/create-testsets.ts +0 -94
- package/src/tools/testsets/delete-testsets.ts +0 -54
- package/src/tools/testsets/get-testsets.ts +0 -54
- package/src/tools/testsets/list-testsets.ts +0 -65
- package/src/tools/testsets/update-testsets.ts +0 -94
- package/src/tools.ts +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -115
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -108
- package/tools/index.mjs.map +0 -1
- package/tools/metrics/create-metrics.d.mts +0 -51
- package/tools/metrics/create-metrics.d.mts.map +0 -1
- package/tools/metrics/create-metrics.d.ts +0 -51
- package/tools/metrics/create-metrics.d.ts.map +0 -1
- package/tools/metrics/create-metrics.js +0 -381
- package/tools/metrics/create-metrics.js.map +0 -1
- package/tools/metrics/create-metrics.mjs +0 -374
- package/tools/metrics/create-metrics.mjs.map +0 -1
- package/tools/metrics/delete-metrics.d.mts +0 -51
- package/tools/metrics/delete-metrics.d.mts.map +0 -1
- package/tools/metrics/delete-metrics.d.ts +0 -51
- package/tools/metrics/delete-metrics.d.ts.map +0 -1
- package/tools/metrics/delete-metrics.js +0 -54
- package/tools/metrics/delete-metrics.js.map +0 -1
- package/tools/metrics/delete-metrics.mjs +0 -47
- package/tools/metrics/delete-metrics.mjs.map +0 -1
- package/tools/metrics/get-metrics.d.mts +0 -51
- package/tools/metrics/get-metrics.d.mts.map +0 -1
- package/tools/metrics/get-metrics.d.ts +0 -51
- package/tools/metrics/get-metrics.d.ts.map +0 -1
- package/tools/metrics/get-metrics.js +0 -48
- package/tools/metrics/get-metrics.js.map +0 -1
- package/tools/metrics/get-metrics.mjs +0 -41
- package/tools/metrics/get-metrics.mjs.map +0 -1
- package/tools/metrics/list-metrics.d.mts +0 -51
- package/tools/metrics/list-metrics.d.mts.map +0 -1
- package/tools/metrics/list-metrics.d.ts +0 -51
- package/tools/metrics/list-metrics.d.ts.map +0 -1
- package/tools/metrics/list-metrics.js +0 -57
- package/tools/metrics/list-metrics.js.map +0 -1
- package/tools/metrics/list-metrics.mjs +0 -50
- package/tools/metrics/list-metrics.mjs.map +0 -1
- package/tools/metrics/update-metrics.d.mts +0 -51
- package/tools/metrics/update-metrics.d.mts.map +0 -1
- package/tools/metrics/update-metrics.d.ts +0 -51
- package/tools/metrics/update-metrics.d.ts.map +0 -1
- package/tools/metrics/update-metrics.js +0 -381
- package/tools/metrics/update-metrics.js.map +0 -1
- package/tools/metrics/update-metrics.mjs +0 -374
- package/tools/metrics/update-metrics.mjs.map +0 -1
- package/tools/projects/create-projects.d.mts +0 -51
- package/tools/projects/create-projects.d.mts.map +0 -1
- package/tools/projects/create-projects.d.ts +0 -51
- package/tools/projects/create-projects.d.ts.map +0 -1
- package/tools/projects/create-projects.js +0 -57
- package/tools/projects/create-projects.js.map +0 -1
- package/tools/projects/create-projects.mjs +0 -50
- package/tools/projects/create-projects.mjs.map +0 -1
- package/tools/projects/list-projects.d.mts +0 -51
- package/tools/projects/list-projects.d.mts.map +0 -1
- package/tools/projects/list-projects.d.ts +0 -51
- package/tools/projects/list-projects.d.ts.map +0 -1
- package/tools/projects/list-projects.js +0 -60
- package/tools/projects/list-projects.js.map +0 -1
- package/tools/projects/list-projects.mjs +0 -53
- package/tools/projects/list-projects.mjs.map +0 -1
- package/tools/records/create-records.d.mts +0 -51
- package/tools/records/create-records.d.mts.map +0 -1
- package/tools/records/create-records.d.ts +0 -51
- package/tools/records/create-records.d.ts.map +0 -1
- package/tools/records/create-records.js +0 -71
- package/tools/records/create-records.js.map +0 -1
- package/tools/records/create-records.mjs +0 -64
- package/tools/records/create-records.mjs.map +0 -1
- package/tools/records/delete-records.d.mts +0 -51
- package/tools/records/delete-records.d.mts.map +0 -1
- package/tools/records/delete-records.d.ts +0 -51
- package/tools/records/delete-records.d.ts.map +0 -1
- package/tools/records/delete-records.js +0 -54
- package/tools/records/delete-records.js.map +0 -1
- package/tools/records/delete-records.mjs +0 -47
- package/tools/records/delete-records.mjs.map +0 -1
- package/tools/records/list-records.d.mts +0 -51
- package/tools/records/list-records.d.mts.map +0 -1
- package/tools/records/list-records.d.ts +0 -51
- package/tools/records/list-records.d.ts.map +0 -1
- package/tools/records/list-records.js +0 -63
- package/tools/records/list-records.js.map +0 -1
- package/tools/records/list-records.mjs +0 -56
- package/tools/records/list-records.mjs.map +0 -1
- package/tools/runs/create-runs.d.mts +0 -51
- package/tools/runs/create-runs.d.mts.map +0 -1
- package/tools/runs/create-runs.d.ts +0 -51
- package/tools/runs/create-runs.d.ts.map +0 -1
- package/tools/runs/create-runs.js +0 -67
- package/tools/runs/create-runs.js.map +0 -1
- package/tools/runs/create-runs.mjs +0 -60
- package/tools/runs/create-runs.mjs.map +0 -1
- package/tools/runs/get-runs.d.mts +0 -51
- package/tools/runs/get-runs.d.mts.map +0 -1
- package/tools/runs/get-runs.d.ts +0 -51
- package/tools/runs/get-runs.d.ts.map +0 -1
- package/tools/runs/get-runs.js +0 -54
- package/tools/runs/get-runs.js.map +0 -1
- package/tools/runs/get-runs.mjs +0 -47
- package/tools/runs/get-runs.mjs.map +0 -1
- package/tools/runs/list-runs.d.mts +0 -51
- package/tools/runs/list-runs.d.mts.map +0 -1
- package/tools/runs/list-runs.d.ts +0 -51
- package/tools/runs/list-runs.d.ts.map +0 -1
- package/tools/runs/list-runs.js +0 -63
- package/tools/runs/list-runs.js.map +0 -1
- package/tools/runs/list-runs.mjs +0 -56
- package/tools/runs/list-runs.mjs.map +0 -1
- package/tools/scores/upsert-scores.d.mts +0 -51
- package/tools/scores/upsert-scores.d.mts.map +0 -1
- package/tools/scores/upsert-scores.d.ts +0 -51
- package/tools/scores/upsert-scores.d.ts.map +0 -1
- package/tools/scores/upsert-scores.js +0 -62
- package/tools/scores/upsert-scores.js.map +0 -1
- package/tools/scores/upsert-scores.mjs +0 -55
- package/tools/scores/upsert-scores.mjs.map +0 -1
- package/tools/systems/delete-systems.d.mts +0 -51
- package/tools/systems/delete-systems.d.mts.map +0 -1
- package/tools/systems/delete-systems.d.ts +0 -51
- package/tools/systems/delete-systems.d.ts.map +0 -1
- package/tools/systems/delete-systems.js +0 -54
- package/tools/systems/delete-systems.js.map +0 -1
- package/tools/systems/delete-systems.mjs +0 -47
- package/tools/systems/delete-systems.mjs.map +0 -1
- package/tools/systems/get-systems.d.mts +0 -51
- package/tools/systems/get-systems.d.mts.map +0 -1
- package/tools/systems/get-systems.d.ts +0 -51
- package/tools/systems/get-systems.d.ts.map +0 -1
- package/tools/systems/get-systems.js +0 -54
- package/tools/systems/get-systems.js.map +0 -1
- package/tools/systems/get-systems.mjs +0 -47
- package/tools/systems/get-systems.mjs.map +0 -1
- package/tools/systems/list-systems.d.mts +0 -51
- package/tools/systems/list-systems.d.mts.map +0 -1
- package/tools/systems/list-systems.d.ts +0 -51
- package/tools/systems/list-systems.d.ts.map +0 -1
- package/tools/systems/list-systems.js +0 -63
- package/tools/systems/list-systems.js.map +0 -1
- package/tools/systems/list-systems.mjs +0 -56
- package/tools/systems/list-systems.mjs.map +0 -1
- package/tools/systems/update-systems.d.mts +0 -51
- package/tools/systems/update-systems.d.mts.map +0 -1
- package/tools/systems/update-systems.d.ts +0 -51
- package/tools/systems/update-systems.d.ts.map +0 -1
- package/tools/systems/update-systems.js +0 -64
- package/tools/systems/update-systems.js.map +0 -1
- package/tools/systems/update-systems.mjs +0 -57
- package/tools/systems/update-systems.mjs.map +0 -1
- package/tools/systems/upsert-systems.d.mts +0 -51
- package/tools/systems/upsert-systems.d.mts.map +0 -1
- package/tools/systems/upsert-systems.d.ts +0 -51
- package/tools/systems/upsert-systems.d.ts.map +0 -1
- package/tools/systems/upsert-systems.js +0 -65
- package/tools/systems/upsert-systems.js.map +0 -1
- package/tools/systems/upsert-systems.mjs +0 -58
- package/tools/systems/upsert-systems.mjs.map +0 -1
- package/tools/systems/versions/get-systems-versions.d.mts +0 -51
- package/tools/systems/versions/get-systems-versions.d.mts.map +0 -1
- package/tools/systems/versions/get-systems-versions.d.ts +0 -51
- package/tools/systems/versions/get-systems-versions.d.ts.map +0 -1
- package/tools/systems/versions/get-systems-versions.js +0 -54
- package/tools/systems/versions/get-systems-versions.js.map +0 -1
- package/tools/systems/versions/get-systems-versions.mjs +0 -47
- package/tools/systems/versions/get-systems-versions.mjs.map +0 -1
- package/tools/systems/versions/upsert-systems-versions.d.mts +0 -51
- package/tools/systems/versions/upsert-systems-versions.d.mts.map +0 -1
- package/tools/systems/versions/upsert-systems-versions.d.ts +0 -51
- package/tools/systems/versions/upsert-systems-versions.d.ts.map +0 -1
- package/tools/systems/versions/upsert-systems-versions.js +0 -61
- package/tools/systems/versions/upsert-systems-versions.js.map +0 -1
- package/tools/systems/versions/upsert-systems-versions.mjs +0 -54
- package/tools/systems/versions/upsert-systems-versions.mjs.map +0 -1
- package/tools/testcases/create-testcases.d.mts +0 -51
- package/tools/testcases/create-testcases.d.mts.map +0 -1
- package/tools/testcases/create-testcases.d.ts +0 -51
- package/tools/testcases/create-testcases.d.ts.map +0 -1
- package/tools/testcases/create-testcases.js +0 -67
- package/tools/testcases/create-testcases.js.map +0 -1
- package/tools/testcases/create-testcases.mjs +0 -60
- package/tools/testcases/create-testcases.mjs.map +0 -1
- package/tools/testcases/delete-testcases.d.mts +0 -51
- package/tools/testcases/delete-testcases.d.mts.map +0 -1
- package/tools/testcases/delete-testcases.d.ts +0 -51
- package/tools/testcases/delete-testcases.d.ts.map +0 -1
- package/tools/testcases/delete-testcases.js +0 -56
- package/tools/testcases/delete-testcases.js.map +0 -1
- package/tools/testcases/delete-testcases.mjs +0 -49
- package/tools/testcases/delete-testcases.mjs.map +0 -1
- package/tools/testcases/get-testcases.d.mts +0 -51
- package/tools/testcases/get-testcases.d.mts.map +0 -1
- package/tools/testcases/get-testcases.d.ts +0 -51
- package/tools/testcases/get-testcases.d.ts.map +0 -1
- package/tools/testcases/get-testcases.js +0 -54
- package/tools/testcases/get-testcases.js.map +0 -1
- package/tools/testcases/get-testcases.mjs +0 -47
- package/tools/testcases/get-testcases.mjs.map +0 -1
- package/tools/testcases/list-testcases.d.mts +0 -51
- package/tools/testcases/list-testcases.d.mts.map +0 -1
- package/tools/testcases/list-testcases.d.ts +0 -51
- package/tools/testcases/list-testcases.d.ts.map +0 -1
- package/tools/testcases/list-testcases.js +0 -63
- package/tools/testcases/list-testcases.js.map +0 -1
- package/tools/testcases/list-testcases.mjs +0 -56
- package/tools/testcases/list-testcases.mjs.map +0 -1
- package/tools/testcases/update-testcases.d.mts +0 -51
- package/tools/testcases/update-testcases.d.mts.map +0 -1
- package/tools/testcases/update-testcases.d.ts +0 -51
- package/tools/testcases/update-testcases.d.ts.map +0 -1
- package/tools/testcases/update-testcases.js +0 -59
- package/tools/testcases/update-testcases.js.map +0 -1
- package/tools/testcases/update-testcases.mjs +0 -52
- package/tools/testcases/update-testcases.mjs.map +0 -1
- package/tools/testsets/create-testsets.d.mts +0 -51
- package/tools/testsets/create-testsets.d.mts.map +0 -1
- package/tools/testsets/create-testsets.d.ts +0 -51
- package/tools/testsets/create-testsets.d.ts.map +0 -1
- package/tools/testsets/create-testsets.js +0 -93
- package/tools/testsets/create-testsets.js.map +0 -1
- package/tools/testsets/create-testsets.mjs +0 -86
- package/tools/testsets/create-testsets.mjs.map +0 -1
- package/tools/testsets/delete-testsets.d.mts +0 -51
- package/tools/testsets/delete-testsets.d.mts.map +0 -1
- package/tools/testsets/delete-testsets.d.ts +0 -51
- package/tools/testsets/delete-testsets.d.ts.map +0 -1
- package/tools/testsets/delete-testsets.js +0 -54
- package/tools/testsets/delete-testsets.js.map +0 -1
- package/tools/testsets/delete-testsets.mjs +0 -47
- package/tools/testsets/delete-testsets.mjs.map +0 -1
- package/tools/testsets/get-testsets.d.mts +0 -51
- package/tools/testsets/get-testsets.d.mts.map +0 -1
- package/tools/testsets/get-testsets.d.ts +0 -51
- package/tools/testsets/get-testsets.d.ts.map +0 -1
- package/tools/testsets/get-testsets.js +0 -54
- package/tools/testsets/get-testsets.js.map +0 -1
- package/tools/testsets/get-testsets.mjs +0 -47
- package/tools/testsets/get-testsets.mjs.map +0 -1
- package/tools/testsets/list-testsets.d.mts +0 -51
- package/tools/testsets/list-testsets.d.mts.map +0 -1
- package/tools/testsets/list-testsets.d.ts +0 -51
- package/tools/testsets/list-testsets.d.ts.map +0 -1
- package/tools/testsets/list-testsets.js +0 -63
- package/tools/testsets/list-testsets.js.map +0 -1
- package/tools/testsets/list-testsets.mjs +0 -56
- package/tools/testsets/list-testsets.mjs.map +0 -1
- package/tools/testsets/update-testsets.d.mts +0 -51
- package/tools/testsets/update-testsets.d.mts.map +0 -1
- package/tools/testsets/update-testsets.d.ts +0 -51
- package/tools/testsets/update-testsets.d.ts.map +0 -1
- package/tools/testsets/update-testsets.js +0 -93
- package/tools/testsets/update-testsets.js.map +0 -1
- package/tools/testsets/update-testsets.mjs +0 -86
- package/tools/testsets/update-testsets.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
- /package/{tools/types.js → types.js} +0 -0
- /package/{tools/types.mjs → types.mjs} +0 -0
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Scorecard
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ For clients with a configuration JSON, it might look something like this:
|
|
|
26
26
|
"mcpServers": {
|
|
27
27
|
"scorecard_ai_api": {
|
|
28
28
|
"command": "npx",
|
|
29
|
-
"args": ["-y", "scorecard-ai-mcp"
|
|
29
|
+
"args": ["-y", "scorecard-ai-mcp"],
|
|
30
30
|
"env": {
|
|
31
31
|
"SCORECARD_API_KEY": "My API Key",
|
|
32
32
|
"SCORECARD_ENVIRONMENT": "production"
|
|
@@ -56,113 +56,87 @@ If you use Claude Code, you can install the MCP server by running the command be
|
|
|
56
56
|
environment variables in Claude Code's `.claude.json`, which can be found in your home directory.
|
|
57
57
|
|
|
58
58
|
```
|
|
59
|
-
claude mcp add
|
|
59
|
+
claude mcp add scorecard_ai_mcp_api --env SCORECARD_API_KEY="Your SCORECARD_API_KEY here." -- npx -y scorecard-ai-mcp
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Code Mode
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
|
|
65
|
+
your agent will write code against the TypeScript SDK, which will then be executed in an
|
|
66
|
+
isolated sandbox. To accomplish this, the server will expose two tools to your agent:
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
3. Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
|
|
68
|
+
- The first tool is a docs search tool, which can be used to generically query for
|
|
69
|
+
documentation about your API/SDK.
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
- The second tool is a code tool, where the agent can write code against the TypeScript SDK.
|
|
72
|
+
The code will be executed in a sandbox environment without web or filesystem access. Then,
|
|
73
|
+
anything the code returns or prints will be returned to the agent as the result of the
|
|
74
|
+
tool call.
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
context window.
|
|
76
|
+
Using this scheme, agents are capable of performing very complex tasks deterministically
|
|
77
|
+
and repeatably.
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
## Usage Examples
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
- `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
|
|
80
|
-
- `--operation` includes just read (get/list) or just write operations
|
|
81
|
+
Below are examples of prompts you can give to an AI assistant with this MCP server configured.
|
|
81
82
|
|
|
82
|
-
###
|
|
83
|
+
### Example 1: Search Documentation
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
**Prompt:**
|
|
86
|
+
> "How do I create a testset using the Scorecard TypeScript SDK?"
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
|
|
95
|
-
you can opt-in to explicit tools, the dynamic tools, or both.
|
|
96
|
-
|
|
97
|
-
See more information with `--help`.
|
|
98
|
-
|
|
99
|
-
All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
|
|
100
|
-
|
|
101
|
-
Use `--list` to see the list of available tools, or see below.
|
|
102
|
-
|
|
103
|
-
### Code execution
|
|
104
|
-
|
|
105
|
-
If you specify `--tools=code` to the MCP server, it will expose just two tools:
|
|
106
|
-
|
|
107
|
-
- `search_docs` - Searches the API documentation and returns a list of markdown results
|
|
108
|
-
- `execute` - Runs code against the TypeScript client
|
|
109
|
-
|
|
110
|
-
This allows the LLM to implement more complex logic by chaining together many API calls without loading
|
|
111
|
-
intermediary results into its context window.
|
|
112
|
-
|
|
113
|
-
The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.
|
|
114
|
-
|
|
115
|
-
### Specifying the MCP Client
|
|
116
|
-
|
|
117
|
-
Different clients have varying abilities to handle arbitrary tools and schemas.
|
|
118
|
-
|
|
119
|
-
You can specify the client you are using with the `--client` argument, and the MCP server will automatically
|
|
120
|
-
serve tools and schemas that are more compatible with that client.
|
|
121
|
-
|
|
122
|
-
- `--client=<type>`: Set all capabilities based on a known MCP client
|
|
123
|
-
|
|
124
|
-
- Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
|
|
125
|
-
- Example: `--client=cursor`
|
|
88
|
+
**Tool Called:** `search_docs`
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"query": "create testset",
|
|
92
|
+
"language": "typescript"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
126
95
|
|
|
127
|
-
|
|
128
|
-
over time, you can manually enable or disable certain capabilities:
|
|
96
|
+
The assistant searches SDK documentation and returns relevant code examples and API references.
|
|
129
97
|
|
|
130
|
-
|
|
131
|
-
- Available capabilities:
|
|
132
|
-
- `top-level-unions`: Enable support for top-level unions in tool schemas
|
|
133
|
-
- `valid-json`: Enable JSON string parsing for arguments
|
|
134
|
-
- `refs`: Enable support for $ref pointers in schemas
|
|
135
|
-
- `unions`: Enable support for union types (anyOf) in schemas
|
|
136
|
-
- `formats`: Enable support for format validations in schemas (e.g. date-time, email)
|
|
137
|
-
- `tool-name-length=N`: Set maximum tool name length to N characters
|
|
138
|
-
- Example: `--capability=top-level-unions --capability=tool-name-length=40`
|
|
139
|
-
- Example: `--capability=top-level-unions,tool-name-length=40`
|
|
98
|
+
---
|
|
140
99
|
|
|
141
|
-
###
|
|
100
|
+
### Example 2: List Projects and Testsets
|
|
142
101
|
|
|
143
|
-
|
|
102
|
+
**Prompt:**
|
|
103
|
+
> "List all my Scorecard projects and their testsets."
|
|
144
104
|
|
|
145
|
-
|
|
146
|
-
|
|
105
|
+
**Tool Called:** `execute`
|
|
106
|
+
```javascript
|
|
107
|
+
async function run(client) {
|
|
108
|
+
for await (const project of client.projects.list()) {
|
|
109
|
+
console.log(`Project: ${project.id} - ${project.name}`);
|
|
110
|
+
for await (const testset of client.testsets.list(project.id)) {
|
|
111
|
+
console.log(` Testset: ${testset.id} - ${testset.name}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
147
115
|
```
|
|
148
116
|
|
|
149
|
-
|
|
117
|
+
---
|
|
150
118
|
|
|
151
|
-
|
|
152
|
-
--resource=cards --no-tool=create_cards
|
|
153
|
-
```
|
|
119
|
+
### Example 3: Create an Evaluation Run
|
|
154
120
|
|
|
155
|
-
|
|
121
|
+
**Prompt:**
|
|
122
|
+
> "Create a new evaluation run for project '314' with testset '246' and metrics '789' and '101'."
|
|
156
123
|
|
|
157
|
-
|
|
158
|
-
|
|
124
|
+
**Tool Called:** `execute`
|
|
125
|
+
```javascript
|
|
126
|
+
async function run(client) {
|
|
127
|
+
const run = await client.runs.create('314', {
|
|
128
|
+
testsetId: '246',
|
|
129
|
+
metricIds: ['789', '101']
|
|
130
|
+
});
|
|
131
|
+
console.log('Run created:', run.id);
|
|
132
|
+
console.log('View at:', run.url);
|
|
133
|
+
return run;
|
|
134
|
+
}
|
|
159
135
|
```
|
|
160
136
|
|
|
161
|
-
|
|
137
|
+
---
|
|
162
138
|
|
|
163
|
-
|
|
164
|
-
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
|
|
165
|
-
```
|
|
139
|
+
For more SDK code examples, see the [examples directory](https://github.com/scorecard-ai/scorecard-node/tree/main/examples).
|
|
166
140
|
|
|
167
141
|
## Running remotely
|
|
168
142
|
|
|
@@ -190,125 +164,33 @@ A configuration JSON for this server might look like this, assuming the server i
|
|
|
190
164
|
}
|
|
191
165
|
```
|
|
192
166
|
|
|
193
|
-
|
|
194
|
-
For example, to exclude specific tools while including others, use the URL:
|
|
195
|
-
|
|
196
|
-
```
|
|
197
|
-
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## Importing the tools and server individually
|
|
207
|
-
|
|
208
|
-
```js
|
|
209
|
-
// Import the server, generated endpoints, or the init function
|
|
210
|
-
import { server, endpoints, init } from "scorecard-ai-mcp/server";
|
|
211
|
-
|
|
212
|
-
// import a specific tool
|
|
213
|
-
import createProjects from "scorecard-ai-mcp/tools/projects/create-projects";
|
|
214
|
-
|
|
215
|
-
// initialize the server and all endpoints
|
|
216
|
-
init({ server, endpoints });
|
|
217
|
-
|
|
218
|
-
// manually start server
|
|
219
|
-
const transport = new StdioServerTransport();
|
|
220
|
-
await server.connect(transport);
|
|
221
|
-
|
|
222
|
-
// or initialize your own server with specific tools
|
|
223
|
-
const myServer = new McpServer(...);
|
|
224
|
-
|
|
225
|
-
// define your own endpoint
|
|
226
|
-
const myCustomEndpoint = {
|
|
227
|
-
tool: {
|
|
228
|
-
name: 'my_custom_tool',
|
|
229
|
-
description: 'My custom tool',
|
|
230
|
-
inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
|
|
231
|
-
},
|
|
232
|
-
handler: async (client: client, args: any) => {
|
|
233
|
-
return { myResponse: 'Hello world!' };
|
|
234
|
-
})
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
// initialize the server with your custom endpoints
|
|
238
|
-
init({ server: myServer, endpoints: [createProjects, myCustomEndpoint] });
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
## Available Tools
|
|
242
|
-
|
|
243
|
-
The following tools are available in this MCP server.
|
|
244
|
-
|
|
245
|
-
### Resource `projects`:
|
|
246
|
-
|
|
247
|
-
- `create_projects` (`write`): Create a new Project.
|
|
248
|
-
- `list_projects` (`read`): Retrieve a paginated list of all Projects. Projects are ordered by creation date, with oldest Projects first.
|
|
249
|
-
|
|
250
|
-
### Resource `testsets`:
|
|
251
|
-
|
|
252
|
-
- `create_testsets` (`write`): Create a new Testset for a Project. The Testset will be created in the Project specified in the path.
|
|
253
|
-
- `update_testsets` (`write`): Update a Testset. Only the fields provided in the request body will be updated.
|
|
254
|
-
If a field is provided, the new content will replace the existing content.
|
|
255
|
-
If a field is not provided, the existing content will remain unchanged.
|
|
256
|
-
|
|
257
|
-
When updating the schema:
|
|
258
|
-
|
|
259
|
-
- If field mappings are not provided and existing mappings reference fields that no longer exist, those mappings will be automatically removed
|
|
260
|
-
- To preserve all existing mappings, ensure all referenced fields remain in the updated schema
|
|
261
|
-
- For complete control, provide both schema and fieldMapping when updating the schema
|
|
262
|
-
|
|
263
|
-
- `list_testsets` (`read`): Retrieve a paginated list of Testsets belonging to a Project.
|
|
264
|
-
- `delete_testsets` (`write`): Delete Testset
|
|
265
|
-
- `get_testsets` (`read`): Get Testset
|
|
266
|
-
|
|
267
|
-
### Resource `testcases`:
|
|
268
|
-
|
|
269
|
-
- `create_testcases` (`write`): Create multiple Testcases in the specified Testset.
|
|
270
|
-
- `update_testcases` (`write`): Replace the data of an existing Testcase while keeping its ID.
|
|
271
|
-
- `list_testcases` (`read`): Retrieve a paginated list of Testcases belonging to a Testset.
|
|
272
|
-
- `delete_testcases` (`write`): Delete multiple Testcases by their IDs.
|
|
273
|
-
- `get_testcases` (`read`): Retrieve a specific Testcase by ID.
|
|
274
|
-
|
|
275
|
-
### Resource `runs`:
|
|
167
|
+
## Privacy & Data Handling
|
|
276
168
|
|
|
277
|
-
|
|
278
|
-
- `list_runs` (`read`): Retrieve a paginated list of all Runs for a Project. Runs are ordered by creation date, most recent first.
|
|
279
|
-
- `get_runs` (`read`): Retrieve a specific Run by ID.
|
|
169
|
+
This MCP server transmits data to external services to provide its functionality. By using this server, you acknowledge the following:
|
|
280
170
|
|
|
281
|
-
###
|
|
171
|
+
### Data Transmitted
|
|
282
172
|
|
|
283
|
-
-
|
|
284
|
-
- `update_metrics` (`write`): Update an existing Metric. You must specify the evalType and outputType of the metric. The structure of a metric depends on the evalType and outputType of the metric.
|
|
285
|
-
- `list_metrics` (`read`): List Metrics configured for the specified Project. Metrics are returned in reverse chronological order.
|
|
286
|
-
- `delete_metrics` (`write`): Delete a specific Metric by ID. The metric will be removed from metric groups and monitors.
|
|
287
|
-
- `get_metrics` (`read`): Retrieve a specific Metric by ID.
|
|
173
|
+
- **Code Execution (`execute` tool):** When you use the `execute` tool, the code you provide is sent to the Stainless API (`api.stainless.com`) for execution in a sandboxed environment. Your Scorecard API key is also transmitted to authenticate requests made by the executed code.
|
|
288
174
|
|
|
289
|
-
|
|
175
|
+
- **Documentation Search (`search_docs` tool):** Search queries are sent to the Stainless API to retrieve relevant SDK documentation.
|
|
290
176
|
|
|
291
|
-
|
|
292
|
-
- `list_records` (`read`): Retrieve a paginated list of Records for a Run, including all scores for each record.
|
|
293
|
-
- `delete_records` (`write`): Delete a specific Record by ID.
|
|
177
|
+
### API Credentials
|
|
294
178
|
|
|
295
|
-
|
|
179
|
+
- Your `SCORECARD_API_KEY` is transmitted to the Stainless code execution sandbox to allow the executed code to make authenticated requests to the Scorecard API.
|
|
180
|
+
- API keys are sent over HTTPS and are not logged by this MCP server.
|
|
296
181
|
|
|
297
|
-
|
|
182
|
+
### Data Retention
|
|
298
183
|
|
|
299
|
-
|
|
184
|
+
- This MCP server does not store or log any user data, code, or API responses locally.
|
|
185
|
+
- Data retention on Stainless infrastructure is governed by [Stainless's terms and conditions](https://www.stainless.com/legal/terms-conditions).
|
|
186
|
+
- Data retention for Scorecard API requests is governed by [Scorecard's privacy policy](https://www.scorecard.io/privacy-policy).
|
|
300
187
|
|
|
301
|
-
|
|
302
|
-
If a field is provided, the new content will replace the existing content.
|
|
303
|
-
If a field is not provided, the existing content will remain unchanged.
|
|
304
|
-
- `list_systems` (`read`): Retrieve a paginated list of all systems. Systems are ordered by creation date.
|
|
305
|
-
- `delete_systems` (`write`): Delete a system definition by ID. This will not delete associated system versions.
|
|
306
|
-
- `get_systems` (`read`): Retrieve a specific system by ID.
|
|
307
|
-
- `upsert_systems` (`write`): Create a new system. If one with the same name in the project exists, it updates it instead.
|
|
188
|
+
### Security Recommendations
|
|
308
189
|
|
|
309
|
-
|
|
190
|
+
- Use environment variables to provide API keys rather than hardcoding them.
|
|
191
|
+
- When running the server remotely, ensure TLS is enabled and use OAuth 2.0 or secure token-based authentication.
|
|
192
|
+
- Rotate API keys periodically and revoke unused keys.
|
|
310
193
|
|
|
311
|
-
|
|
312
|
-
- `upsert_systems_versions` (`write`): Create a new system version if it does not already exist. Does **not** set the created version to be the system's production version.
|
|
194
|
+
### Contact
|
|
313
195
|
|
|
314
|
-
|
|
196
|
+
For security concerns, contact [security@stainless.com](mailto:security@stainless.com) or [team@scorecard.io](mailto:team@scorecard.io).
|
package/code-tool-types.d.mts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ClientOptions } from 'scorecard-ai';
|
|
2
2
|
export type WorkerInput = {
|
|
3
|
-
|
|
3
|
+
project_name: string;
|
|
4
4
|
code: string;
|
|
5
|
+
client_opts: ClientOptions;
|
|
6
|
+
intent?: string | undefined;
|
|
5
7
|
};
|
|
6
|
-
export type
|
|
8
|
+
export type WorkerOutput = {
|
|
9
|
+
is_error: boolean;
|
|
7
10
|
result: unknown | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export type WorkerError = {
|
|
12
|
-
message: string | undefined;
|
|
13
|
-
logLines: string[];
|
|
14
|
-
errLines: string[];
|
|
11
|
+
log_lines: string[];
|
|
12
|
+
err_lines: string[];
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=code-tool-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
package/code-tool-types.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ClientOptions } from 'scorecard-ai';
|
|
2
2
|
export type WorkerInput = {
|
|
3
|
-
|
|
3
|
+
project_name: string;
|
|
4
4
|
code: string;
|
|
5
|
+
client_opts: ClientOptions;
|
|
6
|
+
intent?: string | undefined;
|
|
5
7
|
};
|
|
6
|
-
export type
|
|
8
|
+
export type WorkerOutput = {
|
|
9
|
+
is_error: boolean;
|
|
7
10
|
result: unknown | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export type WorkerError = {
|
|
12
|
-
message: string | undefined;
|
|
13
|
-
logLines: string[];
|
|
14
|
-
errLines: string[];
|
|
11
|
+
log_lines: string[];
|
|
12
|
+
err_lines: string[];
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=code-tool-types.d.ts.map
|
package/code-tool-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
package/code-tool.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { McpTool } from "./types.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* A tool that runs code against a copy of the SDK.
|
|
4
4
|
*
|
|
@@ -8,47 +8,5 @@ import { Metadata, ToolCallResult } from "./tools/types.mjs";
|
|
|
8
8
|
*
|
|
9
9
|
* @param endpoints - The endpoints to include in the list.
|
|
10
10
|
*/
|
|
11
|
-
export declare function codeTool():
|
|
12
|
-
metadata: Metadata;
|
|
13
|
-
tool: {
|
|
14
|
-
inputSchema: {
|
|
15
|
-
[x: string]: unknown;
|
|
16
|
-
type: "object";
|
|
17
|
-
properties?: {
|
|
18
|
-
[x: string]: object;
|
|
19
|
-
} | undefined;
|
|
20
|
-
required?: string[] | undefined;
|
|
21
|
-
};
|
|
22
|
-
name: string;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
outputSchema?: {
|
|
25
|
-
[x: string]: unknown;
|
|
26
|
-
type: "object";
|
|
27
|
-
properties?: {
|
|
28
|
-
[x: string]: object;
|
|
29
|
-
} | undefined;
|
|
30
|
-
required?: string[] | undefined;
|
|
31
|
-
} | undefined;
|
|
32
|
-
annotations?: {
|
|
33
|
-
title?: string | undefined;
|
|
34
|
-
readOnlyHint?: boolean | undefined;
|
|
35
|
-
destructiveHint?: boolean | undefined;
|
|
36
|
-
idempotentHint?: boolean | undefined;
|
|
37
|
-
openWorldHint?: boolean | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
execution?: {
|
|
40
|
-
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
_meta?: {
|
|
43
|
-
[x: string]: unknown;
|
|
44
|
-
} | undefined;
|
|
45
|
-
icons?: {
|
|
46
|
-
src: string;
|
|
47
|
-
mimeType?: string | undefined;
|
|
48
|
-
sizes?: string[] | undefined;
|
|
49
|
-
}[] | undefined;
|
|
50
|
-
title?: string | undefined;
|
|
51
|
-
};
|
|
52
|
-
handler: (_: unknown, args: any) => Promise<ToolCallResult>;
|
|
53
|
-
}>;
|
|
11
|
+
export declare function codeTool(): McpTool;
|
|
54
12
|
//# sourceMappingURL=code-tool.d.mts.map
|
package/code-tool.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AA0BhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA2ElC"}
|
package/code-tool.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { McpTool } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* A tool that runs code against a copy of the SDK.
|
|
4
4
|
*
|
|
@@ -8,47 +8,5 @@ import { Metadata, ToolCallResult } from "./tools/types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* @param endpoints - The endpoints to include in the list.
|
|
10
10
|
*/
|
|
11
|
-
export declare function codeTool():
|
|
12
|
-
metadata: Metadata;
|
|
13
|
-
tool: {
|
|
14
|
-
inputSchema: {
|
|
15
|
-
[x: string]: unknown;
|
|
16
|
-
type: "object";
|
|
17
|
-
properties?: {
|
|
18
|
-
[x: string]: object;
|
|
19
|
-
} | undefined;
|
|
20
|
-
required?: string[] | undefined;
|
|
21
|
-
};
|
|
22
|
-
name: string;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
outputSchema?: {
|
|
25
|
-
[x: string]: unknown;
|
|
26
|
-
type: "object";
|
|
27
|
-
properties?: {
|
|
28
|
-
[x: string]: object;
|
|
29
|
-
} | undefined;
|
|
30
|
-
required?: string[] | undefined;
|
|
31
|
-
} | undefined;
|
|
32
|
-
annotations?: {
|
|
33
|
-
title?: string | undefined;
|
|
34
|
-
readOnlyHint?: boolean | undefined;
|
|
35
|
-
destructiveHint?: boolean | undefined;
|
|
36
|
-
idempotentHint?: boolean | undefined;
|
|
37
|
-
openWorldHint?: boolean | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
execution?: {
|
|
40
|
-
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
_meta?: {
|
|
43
|
-
[x: string]: unknown;
|
|
44
|
-
} | undefined;
|
|
45
|
-
icons?: {
|
|
46
|
-
src: string;
|
|
47
|
-
mimeType?: string | undefined;
|
|
48
|
-
sizes?: string[] | undefined;
|
|
49
|
-
}[] | undefined;
|
|
50
|
-
title?: string | undefined;
|
|
51
|
-
};
|
|
52
|
-
handler: (_: unknown, args: any) => Promise<ToolCallResult>;
|
|
53
|
-
}>;
|
|
11
|
+
export declare function codeTool(): McpTool;
|
|
54
12
|
//# sourceMappingURL=code-tool.d.ts.map
|
package/code-tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,
|
|
1
|
+
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAgE;AA0BhF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA2ElC"}
|
package/code-tool.js
CHANGED
|
@@ -2,8 +2,27 @@
|
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.codeTool = codeTool;
|
|
5
|
-
const types_1 = require("./
|
|
5
|
+
const types_1 = require("./types.js");
|
|
6
6
|
const server_1 = require("./server.js");
|
|
7
|
+
const prompt = `Runs JavaScript code to interact with the Scorecard API.
|
|
8
|
+
|
|
9
|
+
You are a skilled programmer writing code to interface with the service.
|
|
10
|
+
Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
|
|
11
|
+
For example:
|
|
12
|
+
|
|
13
|
+
\`\`\`
|
|
14
|
+
async function run(client) {
|
|
15
|
+
const run = await client.runs.create('314', { metricIds: ['789', '101'], testsetId: '246' });
|
|
16
|
+
|
|
17
|
+
console.log(run.id);
|
|
18
|
+
}
|
|
19
|
+
\`\`\`
|
|
20
|
+
|
|
21
|
+
You will be returned anything that your function returns, plus the results of any console.log statements.
|
|
22
|
+
Do not add try-catch blocks for single API calls. The tool will handle errors for you.
|
|
23
|
+
Do not add comments unless necessary for generating better code.
|
|
24
|
+
Code will run in a container, and cannot interact with the network outside of the given SDK client.
|
|
25
|
+
Variables will not persist between calls, so make sure to return or log any data you might need later.`;
|
|
7
26
|
/**
|
|
8
27
|
* A tool that runs code against a copy of the SDK.
|
|
9
28
|
*
|
|
@@ -13,15 +32,34 @@ const server_1 = require("./server.js");
|
|
|
13
32
|
*
|
|
14
33
|
* @param endpoints - The endpoints to include in the list.
|
|
15
34
|
*/
|
|
16
|
-
|
|
35
|
+
function codeTool() {
|
|
17
36
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
18
37
|
const tool = {
|
|
19
38
|
name: 'execute',
|
|
20
|
-
description:
|
|
21
|
-
inputSchema: {
|
|
39
|
+
description: prompt,
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
code: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Code to execute.',
|
|
46
|
+
},
|
|
47
|
+
intent: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Task you are trying to perform. Used for improving the service.',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ['code'],
|
|
53
|
+
},
|
|
54
|
+
annotations: {
|
|
55
|
+
title: 'Execute Code Against Scorecard API',
|
|
56
|
+
readOnlyHint: false,
|
|
57
|
+
destructiveHint: true,
|
|
58
|
+
},
|
|
22
59
|
};
|
|
23
|
-
const handler = async (
|
|
60
|
+
const handler = async (client, args) => {
|
|
24
61
|
const code = args.code;
|
|
62
|
+
const intent = args.intent;
|
|
25
63
|
// this is not required, but passing a Stainless API key for the matching project_name
|
|
26
64
|
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
27
65
|
const stainlessAPIKey = (0, server_1.readEnv)('STAINLESS_API_KEY');
|
|
@@ -31,18 +69,32 @@ async function codeTool() {
|
|
|
31
69
|
headers: {
|
|
32
70
|
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
33
71
|
'Content-Type': 'application/json',
|
|
34
|
-
client_envs: JSON.stringify({
|
|
72
|
+
client_envs: JSON.stringify({
|
|
73
|
+
SCORECARD_API_KEY: client.apiKey || (0, server_1.readEnvOrError)('SCORECARD_API_KEY'),
|
|
74
|
+
SCORECARD_BASE_URL: client.baseURL || (0, server_1.readEnv)('SCORECARD_BASE_URL'),
|
|
75
|
+
}),
|
|
35
76
|
},
|
|
36
77
|
body: JSON.stringify({
|
|
37
78
|
project_name: 'scorecard',
|
|
38
|
-
client_opts: { environment: ((0, server_1.readEnv)('SCORECARD_ENVIRONMENT') || undefined) },
|
|
39
79
|
code,
|
|
80
|
+
intent,
|
|
81
|
+
client_opts: { environment: ((0, server_1.readEnv)('SCORECARD_ENVIRONMENT') || undefined) },
|
|
40
82
|
}),
|
|
41
83
|
});
|
|
42
84
|
if (!res.ok) {
|
|
43
85
|
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
44
86
|
}
|
|
45
|
-
|
|
87
|
+
const { is_error, result, log_lines, err_lines } = (await res.json());
|
|
88
|
+
const hasLogs = log_lines.length > 0 || err_lines.length > 0;
|
|
89
|
+
const output = {
|
|
90
|
+
result,
|
|
91
|
+
...(log_lines.length > 0 && { log_lines }),
|
|
92
|
+
...(err_lines.length > 0 && { err_lines }),
|
|
93
|
+
};
|
|
94
|
+
if (is_error) {
|
|
95
|
+
return (0, types_1.asErrorResult)(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
|
|
96
|
+
}
|
|
97
|
+
return (0, types_1.asTextContentResult)(output);
|
|
46
98
|
};
|
|
47
99
|
return { metadata, tool, handler };
|
|
48
100
|
}
|
package/code-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;
|
|
1
|
+
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"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"}
|