scorecard-ai-mcp 2.0.0 → 2.1.1
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/README.md +39 -0
- package/code-tool-paths.cjs +6 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts +14 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +14 -0
- package/code-tool-types.d.ts.map +1 -0
- package/code-tool-types.js +4 -0
- package/code-tool-types.js.map +1 -0
- package/code-tool-types.mjs +3 -0
- package/code-tool-types.mjs.map +1 -0
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +45 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +40 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +12 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +12 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +157 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +121 -0
- package/code-tool.mjs.map +1 -0
- package/compat.d.mts +4 -2
- package/compat.d.mts.map +1 -1
- package/compat.d.ts +4 -2
- package/compat.d.ts.map +1 -1
- package/compat.js +8 -3
- package/compat.js.map +1 -1
- package/compat.mjs +7 -2
- package/compat.mjs.map +1 -1
- package/filtering.d.mts +2 -0
- package/filtering.d.mts.map +1 -0
- package/filtering.d.ts +2 -0
- package/filtering.d.ts.map +1 -0
- package/filtering.js +20 -0
- package/filtering.js.map +1 -0
- package/filtering.mjs +13 -0
- package/filtering.mjs.map +1 -0
- package/headers.d.mts +4 -0
- package/headers.d.mts.map +1 -0
- package/headers.d.ts +4 -0
- package/headers.d.ts.map +1 -0
- package/headers.js +22 -0
- package/headers.js.map +1 -0
- package/headers.mjs +18 -0
- package/headers.mjs.map +1 -0
- package/http.d.mts +9 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +9 -0
- package/http.d.ts.map +1 -0
- package/http.js +108 -0
- package/http.js.map +1 -0
- package/http.mjs +100 -0
- package/http.mjs.map +1 -0
- package/index.js +15 -10
- package/index.js.map +1 -1
- package/index.mjs +17 -12
- package/index.mjs.map +1 -1
- package/options.d.mts +11 -6
- package/options.d.mts.map +1 -1
- package/options.d.ts +11 -6
- package/options.d.ts.map +1 -1
- package/options.js +136 -15
- package/options.js.map +1 -1
- package/options.mjs +135 -15
- package/options.mjs.map +1 -1
- package/package.json +90 -4
- package/server.d.mts +4 -16
- package/server.d.mts.map +1 -1
- package/server.d.ts +4 -16
- package/server.d.ts.map +1 -1
- package/server.js +86 -33
- package/server.js.map +1 -1
- package/server.mjs +84 -32
- package/server.mjs.map +1 -1
- package/src/code-tool-paths.cts +3 -0
- package/src/code-tool-types.ts +14 -0
- package/src/code-tool-worker.ts +46 -0
- package/src/code-tool.ts +146 -0
- package/src/compat.ts +9 -4
- package/src/filtering.ts +14 -0
- package/src/headers.ts +23 -0
- package/src/http.ts +127 -0
- package/src/index.ts +18 -14
- package/src/options.ts +158 -21
- package/src/server.ts +103 -48
- package/src/stdio.ts +13 -0
- package/src/tools/metrics/create-metrics.ts +8 -2
- package/src/tools/metrics/update-metrics.ts +8 -2
- package/src/tools/projects/create-projects.ts +14 -5
- package/src/tools/projects/list-projects.ts +16 -5
- package/src/tools/records/create-records.ts +17 -5
- package/src/tools/runs/create-runs.ts +14 -5
- package/src/tools/scores/upsert-scores.ts +16 -5
- package/src/tools/systems/delete-systems.ts +16 -5
- package/src/tools/systems/get-systems.ts +16 -5
- package/src/tools/systems/list-systems.ts +17 -5
- package/src/tools/systems/update-systems.ts +13 -5
- package/src/tools/systems/upsert-systems.ts +15 -5
- package/src/tools/systems/versions/get-systems-versions.ts +18 -5
- package/src/tools/systems/versions/upsert-systems-versions.ts +16 -5
- package/src/tools/testcases/create-testcases.ts +15 -5
- package/src/tools/testcases/delete-testcases.ts +14 -5
- package/src/tools/testcases/get-testcases.ts +16 -5
- package/src/tools/testcases/list-testcases.ts +17 -5
- package/src/tools/testcases/update-testcases.ts +17 -5
- package/src/tools/testsets/create-testsets.ts +14 -5
- package/src/tools/testsets/delete-testsets.ts +16 -5
- package/src/tools/testsets/get-testsets.ts +16 -5
- package/src/tools/testsets/list-testsets.ts +17 -5
- package/src/tools/testsets/update-testsets.ts +14 -5
- package/src/tools/types.ts +1 -1
- package/stdio.d.mts +3 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +3 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +14 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +10 -0
- package/stdio.mjs.map +1 -0
- package/tools/metrics/create-metrics.d.mts +1 -1
- package/tools/metrics/create-metrics.d.mts.map +1 -1
- package/tools/metrics/create-metrics.d.ts +1 -1
- package/tools/metrics/create-metrics.d.ts.map +1 -1
- package/tools/metrics/create-metrics.js +7 -0
- package/tools/metrics/create-metrics.js.map +1 -1
- package/tools/metrics/create-metrics.mjs +7 -0
- package/tools/metrics/create-metrics.mjs.map +1 -1
- package/tools/metrics/update-metrics.d.mts +1 -1
- package/tools/metrics/update-metrics.d.mts.map +1 -1
- package/tools/metrics/update-metrics.d.ts +1 -1
- package/tools/metrics/update-metrics.d.ts.map +1 -1
- package/tools/metrics/update-metrics.js +7 -0
- package/tools/metrics/update-metrics.js.map +1 -1
- package/tools/metrics/update-metrics.mjs +7 -0
- package/tools/metrics/update-metrics.mjs.map +1 -1
- package/tools/projects/create-projects.d.mts +1 -1
- package/tools/projects/create-projects.d.mts.map +1 -1
- package/tools/projects/create-projects.d.ts +1 -1
- package/tools/projects/create-projects.d.ts.map +1 -1
- package/tools/projects/create-projects.js +11 -3
- package/tools/projects/create-projects.js.map +1 -1
- package/tools/projects/create-projects.mjs +11 -3
- package/tools/projects/create-projects.mjs.map +1 -1
- package/tools/projects/list-projects.d.mts +1 -1
- package/tools/projects/list-projects.d.mts.map +1 -1
- package/tools/projects/list-projects.d.ts +1 -1
- package/tools/projects/list-projects.d.ts.map +1 -1
- package/tools/projects/list-projects.js +14 -3
- package/tools/projects/list-projects.js.map +1 -1
- package/tools/projects/list-projects.mjs +14 -3
- package/tools/projects/list-projects.mjs.map +1 -1
- package/tools/records/create-records.d.mts +1 -1
- package/tools/records/create-records.d.mts.map +1 -1
- package/tools/records/create-records.d.ts +1 -1
- package/tools/records/create-records.d.ts.map +1 -1
- package/tools/records/create-records.js +14 -3
- package/tools/records/create-records.js.map +1 -1
- package/tools/records/create-records.mjs +14 -3
- package/tools/records/create-records.mjs.map +1 -1
- package/tools/runs/create-runs.d.mts +1 -1
- package/tools/runs/create-runs.d.mts.map +1 -1
- package/tools/runs/create-runs.d.ts +1 -1
- package/tools/runs/create-runs.d.ts.map +1 -1
- package/tools/runs/create-runs.js +11 -3
- package/tools/runs/create-runs.js.map +1 -1
- package/tools/runs/create-runs.mjs +11 -3
- package/tools/runs/create-runs.mjs.map +1 -1
- package/tools/scores/upsert-scores.d.mts +1 -1
- package/tools/scores/upsert-scores.d.mts.map +1 -1
- package/tools/scores/upsert-scores.d.ts +1 -1
- package/tools/scores/upsert-scores.d.ts.map +1 -1
- package/tools/scores/upsert-scores.js +14 -3
- package/tools/scores/upsert-scores.js.map +1 -1
- package/tools/scores/upsert-scores.mjs +14 -3
- package/tools/scores/upsert-scores.mjs.map +1 -1
- package/tools/systems/delete-systems.d.mts +1 -1
- package/tools/systems/delete-systems.d.mts.map +1 -1
- package/tools/systems/delete-systems.d.ts +1 -1
- package/tools/systems/delete-systems.d.ts.map +1 -1
- package/tools/systems/delete-systems.js +13 -3
- package/tools/systems/delete-systems.js.map +1 -1
- package/tools/systems/delete-systems.mjs +13 -3
- package/tools/systems/delete-systems.mjs.map +1 -1
- package/tools/systems/get-systems.d.mts +1 -1
- package/tools/systems/get-systems.d.mts.map +1 -1
- package/tools/systems/get-systems.d.ts +1 -1
- package/tools/systems/get-systems.d.ts.map +1 -1
- package/tools/systems/get-systems.js +13 -3
- package/tools/systems/get-systems.js.map +1 -1
- package/tools/systems/get-systems.mjs +13 -3
- package/tools/systems/get-systems.mjs.map +1 -1
- package/tools/systems/list-systems.d.mts +1 -1
- package/tools/systems/list-systems.d.mts.map +1 -1
- package/tools/systems/list-systems.d.ts +1 -1
- package/tools/systems/list-systems.d.ts.map +1 -1
- package/tools/systems/list-systems.js +14 -3
- package/tools/systems/list-systems.js.map +1 -1
- package/tools/systems/list-systems.mjs +14 -3
- package/tools/systems/list-systems.mjs.map +1 -1
- package/tools/systems/update-systems.d.mts +1 -1
- package/tools/systems/update-systems.d.mts.map +1 -1
- package/tools/systems/update-systems.d.ts +1 -1
- package/tools/systems/update-systems.d.ts.map +1 -1
- package/tools/systems/update-systems.js +11 -3
- package/tools/systems/update-systems.js.map +1 -1
- package/tools/systems/update-systems.mjs +11 -3
- package/tools/systems/update-systems.mjs.map +1 -1
- package/tools/systems/upsert-systems.d.mts +1 -1
- package/tools/systems/upsert-systems.d.mts.map +1 -1
- package/tools/systems/upsert-systems.d.ts +1 -1
- package/tools/systems/upsert-systems.d.ts.map +1 -1
- package/tools/systems/upsert-systems.js +12 -3
- package/tools/systems/upsert-systems.js.map +1 -1
- package/tools/systems/upsert-systems.mjs +12 -3
- package/tools/systems/upsert-systems.mjs.map +1 -1
- package/tools/systems/versions/get-systems-versions.d.mts +1 -1
- package/tools/systems/versions/get-systems-versions.d.mts.map +1 -1
- package/tools/systems/versions/get-systems-versions.d.ts +1 -1
- package/tools/systems/versions/get-systems-versions.d.ts.map +1 -1
- package/tools/systems/versions/get-systems-versions.js +13 -3
- package/tools/systems/versions/get-systems-versions.js.map +1 -1
- package/tools/systems/versions/get-systems-versions.mjs +13 -3
- package/tools/systems/versions/get-systems-versions.mjs.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.mts +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.mts.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.ts +1 -1
- package/tools/systems/versions/upsert-systems-versions.d.ts.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.js +12 -3
- package/tools/systems/versions/upsert-systems-versions.js.map +1 -1
- package/tools/systems/versions/upsert-systems-versions.mjs +12 -3
- package/tools/systems/versions/upsert-systems-versions.mjs.map +1 -1
- package/tools/testcases/create-testcases.d.mts +1 -1
- package/tools/testcases/create-testcases.d.mts.map +1 -1
- package/tools/testcases/create-testcases.d.ts +1 -1
- package/tools/testcases/create-testcases.d.ts.map +1 -1
- package/tools/testcases/create-testcases.js +12 -3
- package/tools/testcases/create-testcases.js.map +1 -1
- package/tools/testcases/create-testcases.mjs +12 -3
- package/tools/testcases/create-testcases.mjs.map +1 -1
- package/tools/testcases/delete-testcases.d.mts +1 -1
- package/tools/testcases/delete-testcases.d.mts.map +1 -1
- package/tools/testcases/delete-testcases.d.ts +1 -1
- package/tools/testcases/delete-testcases.d.ts.map +1 -1
- package/tools/testcases/delete-testcases.js +11 -3
- package/tools/testcases/delete-testcases.js.map +1 -1
- package/tools/testcases/delete-testcases.mjs +11 -3
- package/tools/testcases/delete-testcases.mjs.map +1 -1
- package/tools/testcases/get-testcases.d.mts +1 -1
- package/tools/testcases/get-testcases.d.mts.map +1 -1
- package/tools/testcases/get-testcases.d.ts +1 -1
- package/tools/testcases/get-testcases.d.ts.map +1 -1
- package/tools/testcases/get-testcases.js +13 -3
- package/tools/testcases/get-testcases.js.map +1 -1
- package/tools/testcases/get-testcases.mjs +13 -3
- package/tools/testcases/get-testcases.mjs.map +1 -1
- package/tools/testcases/list-testcases.d.mts +1 -1
- package/tools/testcases/list-testcases.d.mts.map +1 -1
- package/tools/testcases/list-testcases.d.ts +1 -1
- package/tools/testcases/list-testcases.d.ts.map +1 -1
- package/tools/testcases/list-testcases.js +14 -3
- package/tools/testcases/list-testcases.js.map +1 -1
- package/tools/testcases/list-testcases.mjs +14 -3
- package/tools/testcases/list-testcases.mjs.map +1 -1
- package/tools/testcases/update-testcases.d.mts +1 -1
- package/tools/testcases/update-testcases.d.mts.map +1 -1
- package/tools/testcases/update-testcases.d.ts +1 -1
- package/tools/testcases/update-testcases.d.ts.map +1 -1
- package/tools/testcases/update-testcases.js +14 -3
- package/tools/testcases/update-testcases.js.map +1 -1
- package/tools/testcases/update-testcases.mjs +14 -3
- package/tools/testcases/update-testcases.mjs.map +1 -1
- package/tools/testsets/create-testsets.d.mts +1 -1
- package/tools/testsets/create-testsets.d.mts.map +1 -1
- package/tools/testsets/create-testsets.d.ts +1 -1
- package/tools/testsets/create-testsets.d.ts.map +1 -1
- package/tools/testsets/create-testsets.js +12 -3
- package/tools/testsets/create-testsets.js.map +1 -1
- package/tools/testsets/create-testsets.mjs +12 -3
- package/tools/testsets/create-testsets.mjs.map +1 -1
- package/tools/testsets/delete-testsets.d.mts +1 -1
- package/tools/testsets/delete-testsets.d.mts.map +1 -1
- package/tools/testsets/delete-testsets.d.ts +1 -1
- package/tools/testsets/delete-testsets.d.ts.map +1 -1
- package/tools/testsets/delete-testsets.js +13 -3
- package/tools/testsets/delete-testsets.js.map +1 -1
- package/tools/testsets/delete-testsets.mjs +13 -3
- package/tools/testsets/delete-testsets.mjs.map +1 -1
- package/tools/testsets/get-testsets.d.mts +1 -1
- package/tools/testsets/get-testsets.d.mts.map +1 -1
- package/tools/testsets/get-testsets.d.ts +1 -1
- package/tools/testsets/get-testsets.d.ts.map +1 -1
- package/tools/testsets/get-testsets.js +13 -3
- package/tools/testsets/get-testsets.js.map +1 -1
- package/tools/testsets/get-testsets.mjs +13 -3
- package/tools/testsets/get-testsets.mjs.map +1 -1
- package/tools/testsets/list-testsets.d.mts +1 -1
- package/tools/testsets/list-testsets.d.mts.map +1 -1
- package/tools/testsets/list-testsets.d.ts +1 -1
- package/tools/testsets/list-testsets.d.ts.map +1 -1
- package/tools/testsets/list-testsets.js +14 -3
- package/tools/testsets/list-testsets.js.map +1 -1
- package/tools/testsets/list-testsets.mjs +14 -3
- package/tools/testsets/list-testsets.mjs.map +1 -1
- package/tools/testsets/update-testsets.d.mts +1 -1
- package/tools/testsets/update-testsets.d.mts.map +1 -1
- package/tools/testsets/update-testsets.d.ts +1 -1
- package/tools/testsets/update-testsets.d.ts.map +1 -1
- package/tools/testsets/update-testsets.js +12 -3
- package/tools/testsets/update-testsets.js.map +1 -1
- package/tools/testsets/update-testsets.mjs +12 -3
- package/tools/testsets/update-testsets.mjs.map +1 -1
- package/tools/types.d.mts +1 -1
- package/tools/types.d.mts.map +1 -1
- package/tools/types.d.ts +1 -1
- package/tools/types.d.ts.map +1 -1
- package/tools/types.js.map +1 -1
- package/tools/types.mjs.map +1 -1
package/README.md
CHANGED
|
@@ -128,6 +128,45 @@ over time, you can manually enable or disable certain capabilities:
|
|
|
128
128
|
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
+
## Running remotely
|
|
132
|
+
|
|
133
|
+
Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket.
|
|
134
|
+
|
|
135
|
+
Authorization can be provided via the `Authorization` header using the Bearer scheme.
|
|
136
|
+
|
|
137
|
+
Additionally, authorization can be provided via the following headers:
|
|
138
|
+
| Header | Equivalent client option | Security scheme |
|
|
139
|
+
| --------------------- | ------------------------ | --------------- |
|
|
140
|
+
| `x-scorecard-api-key` | `apiKey` | ApiKeyAuth |
|
|
141
|
+
|
|
142
|
+
A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"scorecard_ai_api": {
|
|
148
|
+
"url": "http://localhost:3000",
|
|
149
|
+
"headers": {
|
|
150
|
+
"Authorization": "Bearer <auth value>"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
|
|
158
|
+
For example, to exclude specific tools while including others, use the URL:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
|
|
168
|
+
```
|
|
169
|
+
|
|
131
170
|
## Importing the tools and server individually
|
|
132
171
|
|
|
133
172
|
```js
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.workerPath = void 0;
|
|
5
|
+
exports.workerPath = require.resolve('./code-tool-worker.mjs');
|
|
6
|
+
//# sourceMappingURL=code-tool-paths.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-paths.cjs","sourceRoot":"","sources":["src/code-tool-paths.cts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEzE,QAAA,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-paths.d.cts","sourceRoot":"","sources":["src/code-tool-paths.cts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,QAA4C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClientOptions } from 'scorecard-ai';
|
|
2
|
+
export type WorkerInput = {
|
|
3
|
+
opts: ClientOptions;
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
export type WorkerSuccess = {
|
|
7
|
+
result: unknown | null;
|
|
8
|
+
logLines: string[];
|
|
9
|
+
errLines: string[];
|
|
10
|
+
};
|
|
11
|
+
export type WorkerError = {
|
|
12
|
+
message: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=code-tool-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClientOptions } from 'scorecard-ai';
|
|
2
|
+
export type WorkerInput = {
|
|
3
|
+
opts: ClientOptions;
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
export type WorkerSuccess = {
|
|
7
|
+
result: unknown | null;
|
|
8
|
+
logLines: string[];
|
|
9
|
+
errLines: string[];
|
|
10
|
+
};
|
|
11
|
+
export type WorkerError = {
|
|
12
|
+
message: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=code-tool-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-types.js","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-types.mjs","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-worker.d.mts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAM0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAuCrD,wBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-worker.d.ts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAM0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAuCrD,wBAAyB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const node_util_1 = __importDefault(require("node:util"));
|
|
8
|
+
const scorecard_ai_1 = require("scorecard-ai");
|
|
9
|
+
const fetch = async (req) => {
|
|
10
|
+
const { opts, code } = (await req.json());
|
|
11
|
+
const client = new scorecard_ai_1.Scorecard({
|
|
12
|
+
...opts,
|
|
13
|
+
});
|
|
14
|
+
const logLines = [];
|
|
15
|
+
const errLines = [];
|
|
16
|
+
const console = {
|
|
17
|
+
log: (...args) => {
|
|
18
|
+
logLines.push(node_util_1.default.format(...args));
|
|
19
|
+
},
|
|
20
|
+
error: (...args) => {
|
|
21
|
+
errLines.push(node_util_1.default.format(...args));
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
let run_ = async (client) => { };
|
|
26
|
+
eval(`
|
|
27
|
+
${code}
|
|
28
|
+
run_ = run;
|
|
29
|
+
`);
|
|
30
|
+
const result = await run_(client);
|
|
31
|
+
return Response.json({
|
|
32
|
+
result,
|
|
33
|
+
logLines,
|
|
34
|
+
errLines,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
const message = e instanceof Error ? e.message : undefined;
|
|
39
|
+
return Response.json({
|
|
40
|
+
message,
|
|
41
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.default = { fetch };
|
|
45
|
+
//# sourceMappingURL=code-tool-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-worker.js","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;AAEtF,0DAA6B;AAE7B,+CAAyC;AAEzC,MAAM,KAAK,GAAG,KAAK,EAAE,GAAY,EAAqB,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,wBAAS,CAAC;QAC3B,GAAG,IAAI;KACR,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG;QACd,GAAG,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,mBAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC5B,QAAQ,CAAC,IAAI,CAAC,mBAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;KACF,CAAC;IACF,IAAI,CAAC;QACH,IAAI,IAAI,GAAG,KAAK,EAAE,MAAW,EAAE,EAAE,GAAE,CAAC,CAAC;QACrC,IAAI,CAAC;QACD,IAAI;;KAEP,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,QAAQ,CAAC,IAAI,CAAC;YACnB,MAAM;YACN,QAAQ;YACR,QAAQ;SACe,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,OAAO,QAAQ,CAAC,IAAI,CAClB;YACE,OAAO;SACc,EACvB,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,sBAAsB,EAAE,CACpD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import util from 'node:util';
|
|
3
|
+
import { Scorecard } from 'scorecard-ai';
|
|
4
|
+
const fetch = async (req) => {
|
|
5
|
+
const { opts, code } = (await req.json());
|
|
6
|
+
const client = new Scorecard({
|
|
7
|
+
...opts,
|
|
8
|
+
});
|
|
9
|
+
const logLines = [];
|
|
10
|
+
const errLines = [];
|
|
11
|
+
const console = {
|
|
12
|
+
log: (...args) => {
|
|
13
|
+
logLines.push(util.format(...args));
|
|
14
|
+
},
|
|
15
|
+
error: (...args) => {
|
|
16
|
+
errLines.push(util.format(...args));
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
let run_ = async (client) => { };
|
|
21
|
+
eval(`
|
|
22
|
+
${code}
|
|
23
|
+
run_ = run;
|
|
24
|
+
`);
|
|
25
|
+
const result = await run_(client);
|
|
26
|
+
return Response.json({
|
|
27
|
+
result,
|
|
28
|
+
logLines,
|
|
29
|
+
errLines,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
const message = e instanceof Error ? e.message : undefined;
|
|
34
|
+
return Response.json({
|
|
35
|
+
message,
|
|
36
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default { fetch };
|
|
40
|
+
//# sourceMappingURL=code-tool-worker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool-worker.mjs","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,IAAI,MAAM,WAAW;OAErB,EAAE,SAAS,EAAE,MAAM,cAAc;AAExC,MAAM,KAAK,GAAG,KAAK,EAAE,GAAY,EAAqB,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,GAAG,IAAI;KACR,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG;QACd,GAAG,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC5B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;KACF,CAAC;IACF,IAAI,CAAC;QACH,IAAI,IAAI,GAAG,KAAK,EAAE,MAAW,EAAE,EAAE,GAAE,CAAC,CAAC;QACrC,IAAI,CAAC;QACD,IAAI;;KAEP,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,QAAQ,CAAC,IAAI,CAAC;YACnB,MAAM;YACN,QAAQ;YACR,QAAQ;SACe,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,OAAO,QAAQ,CAAC,IAAI,CAClB;YACE,OAAO;SACc,EACvB,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,sBAAsB,EAAE,CACpD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,EAAE,KAAK,EAAE,CAAC"}
|
package/code-tool.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Endpoint } from "./tools/types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* A tool that runs code against a copy of the SDK.
|
|
4
|
+
*
|
|
5
|
+
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
|
|
6
|
+
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
7
|
+
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
8
|
+
*
|
|
9
|
+
* @param endpoints - The endpoints to include in the list.
|
|
10
|
+
*/
|
|
11
|
+
export declare function codeTool(): Promise<Endpoint>;
|
|
12
|
+
//# sourceMappingURL=code-tool.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
|
package/code-tool.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Endpoint } from "./tools/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A tool that runs code against a copy of the SDK.
|
|
4
|
+
*
|
|
5
|
+
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
|
|
6
|
+
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
7
|
+
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
8
|
+
*
|
|
9
|
+
* @param endpoints - The endpoints to include in the list.
|
|
10
|
+
*/
|
|
11
|
+
export declare function codeTool(): Promise<Endpoint>;
|
|
12
|
+
//# sourceMappingURL=code-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
|
package/code-tool.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.codeTool = codeTool;
|
|
38
|
+
const node_path_1 = require("node:path");
|
|
39
|
+
const node_url_1 = require("node:url");
|
|
40
|
+
/**
|
|
41
|
+
* A tool that runs code against a copy of the SDK.
|
|
42
|
+
*
|
|
43
|
+
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
|
|
44
|
+
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
45
|
+
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
46
|
+
*
|
|
47
|
+
* @param endpoints - The endpoints to include in the list.
|
|
48
|
+
*/
|
|
49
|
+
async function codeTool() {
|
|
50
|
+
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
51
|
+
const tool = {
|
|
52
|
+
name: 'execute',
|
|
53
|
+
description: 'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
54
|
+
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
55
|
+
};
|
|
56
|
+
// Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
|
|
57
|
+
const { newDenoHTTPWorker } = await Promise.resolve().then(() => __importStar(require('@valtown/deno-http-worker')));
|
|
58
|
+
const { workerPath } = await Promise.resolve().then(() => __importStar(require('./code-tool-paths.cjs')));
|
|
59
|
+
const handler = async (client, args) => {
|
|
60
|
+
const baseURLHostname = new URL(client.baseURL).hostname;
|
|
61
|
+
const { code } = args;
|
|
62
|
+
const worker = await newDenoHTTPWorker((0, node_url_1.pathToFileURL)(workerPath), {
|
|
63
|
+
runFlags: [
|
|
64
|
+
`--node-modules-dir=manual`,
|
|
65
|
+
`--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
|
|
66
|
+
`--allow-net=${baseURLHostname}`,
|
|
67
|
+
// Allow environment variables because instantiating the client will try to read from them,
|
|
68
|
+
// even though they are not set.
|
|
69
|
+
'--allow-env',
|
|
70
|
+
],
|
|
71
|
+
printOutput: true,
|
|
72
|
+
spawnOptions: {
|
|
73
|
+
cwd: (0, node_path_1.dirname)(workerPath),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
try {
|
|
77
|
+
const resp = await new Promise((resolve, reject) => {
|
|
78
|
+
worker.addEventListener('exit', (exitCode) => {
|
|
79
|
+
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
80
|
+
});
|
|
81
|
+
const opts = {
|
|
82
|
+
baseURL: client.baseURL,
|
|
83
|
+
apiKey: client.apiKey,
|
|
84
|
+
defaultHeaders: {
|
|
85
|
+
'X-Stainless-MCP': 'true',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const req = worker.request('http://localhost', {
|
|
89
|
+
headers: {
|
|
90
|
+
'content-type': 'application/json',
|
|
91
|
+
},
|
|
92
|
+
method: 'POST',
|
|
93
|
+
}, (resp) => {
|
|
94
|
+
const body = [];
|
|
95
|
+
resp.on('error', (err) => {
|
|
96
|
+
reject(err);
|
|
97
|
+
});
|
|
98
|
+
resp.on('data', (chunk) => {
|
|
99
|
+
body.push(chunk);
|
|
100
|
+
});
|
|
101
|
+
resp.on('end', () => {
|
|
102
|
+
resolve(new Response(Buffer.concat(body).toString(), {
|
|
103
|
+
status: resp.statusCode ?? 200,
|
|
104
|
+
headers: resp.headers,
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
const body = JSON.stringify({
|
|
109
|
+
opts,
|
|
110
|
+
code,
|
|
111
|
+
});
|
|
112
|
+
req.write(body, (err) => {
|
|
113
|
+
if (err !== null && err !== undefined) {
|
|
114
|
+
reject(err);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
req.end();
|
|
118
|
+
});
|
|
119
|
+
if (resp.status === 200) {
|
|
120
|
+
const { result, logLines, errLines } = (await resp.json());
|
|
121
|
+
const returnOutput = result === null ? null
|
|
122
|
+
: result === undefined ? null
|
|
123
|
+
: {
|
|
124
|
+
type: 'text',
|
|
125
|
+
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
126
|
+
};
|
|
127
|
+
const logOutput = logLines.length === 0 ?
|
|
128
|
+
null
|
|
129
|
+
: {
|
|
130
|
+
type: 'text',
|
|
131
|
+
text: logLines.join('\n'),
|
|
132
|
+
};
|
|
133
|
+
const errOutput = errLines.length === 0 ?
|
|
134
|
+
null
|
|
135
|
+
: {
|
|
136
|
+
type: 'text',
|
|
137
|
+
text: 'Error output:\n' + errLines.join('\n'),
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const { message } = (await resp.json());
|
|
145
|
+
throw new Error(message);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
throw e;
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
worker.terminate();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
return { metadata, tool, handler };
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=code-tool.js.map
|
package/code-tool.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBtF,4BA6HC;AA/ID,yCAAoC;AACpC,uCAAyC;AAQzC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EACT,khCAAkhC;QACphC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,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AAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/code-tool.mjs
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
/**
|
|
5
|
+
* A tool that runs code against a copy of the SDK.
|
|
6
|
+
*
|
|
7
|
+
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
|
|
8
|
+
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
9
|
+
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
10
|
+
*
|
|
11
|
+
* @param endpoints - The endpoints to include in the list.
|
|
12
|
+
*/
|
|
13
|
+
export async function codeTool() {
|
|
14
|
+
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
15
|
+
const tool = {
|
|
16
|
+
name: 'execute',
|
|
17
|
+
description: 'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
18
|
+
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
19
|
+
};
|
|
20
|
+
// Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
|
|
21
|
+
const { newDenoHTTPWorker } = await import('@valtown/deno-http-worker');
|
|
22
|
+
const { workerPath } = await import('./code-tool-paths.cjs');
|
|
23
|
+
const handler = async (client, args) => {
|
|
24
|
+
const baseURLHostname = new URL(client.baseURL).hostname;
|
|
25
|
+
const { code } = args;
|
|
26
|
+
const worker = await newDenoHTTPWorker(pathToFileURL(workerPath), {
|
|
27
|
+
runFlags: [
|
|
28
|
+
`--node-modules-dir=manual`,
|
|
29
|
+
`--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
|
|
30
|
+
`--allow-net=${baseURLHostname}`,
|
|
31
|
+
// Allow environment variables because instantiating the client will try to read from them,
|
|
32
|
+
// even though they are not set.
|
|
33
|
+
'--allow-env',
|
|
34
|
+
],
|
|
35
|
+
printOutput: true,
|
|
36
|
+
spawnOptions: {
|
|
37
|
+
cwd: dirname(workerPath),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
const resp = await new Promise((resolve, reject) => {
|
|
42
|
+
worker.addEventListener('exit', (exitCode) => {
|
|
43
|
+
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
44
|
+
});
|
|
45
|
+
const opts = {
|
|
46
|
+
baseURL: client.baseURL,
|
|
47
|
+
apiKey: client.apiKey,
|
|
48
|
+
defaultHeaders: {
|
|
49
|
+
'X-Stainless-MCP': 'true',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const req = worker.request('http://localhost', {
|
|
53
|
+
headers: {
|
|
54
|
+
'content-type': 'application/json',
|
|
55
|
+
},
|
|
56
|
+
method: 'POST',
|
|
57
|
+
}, (resp) => {
|
|
58
|
+
const body = [];
|
|
59
|
+
resp.on('error', (err) => {
|
|
60
|
+
reject(err);
|
|
61
|
+
});
|
|
62
|
+
resp.on('data', (chunk) => {
|
|
63
|
+
body.push(chunk);
|
|
64
|
+
});
|
|
65
|
+
resp.on('end', () => {
|
|
66
|
+
resolve(new Response(Buffer.concat(body).toString(), {
|
|
67
|
+
status: resp.statusCode ?? 200,
|
|
68
|
+
headers: resp.headers,
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const body = JSON.stringify({
|
|
73
|
+
opts,
|
|
74
|
+
code,
|
|
75
|
+
});
|
|
76
|
+
req.write(body, (err) => {
|
|
77
|
+
if (err !== null && err !== undefined) {
|
|
78
|
+
reject(err);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
req.end();
|
|
82
|
+
});
|
|
83
|
+
if (resp.status === 200) {
|
|
84
|
+
const { result, logLines, errLines } = (await resp.json());
|
|
85
|
+
const returnOutput = result === null ? null
|
|
86
|
+
: result === undefined ? null
|
|
87
|
+
: {
|
|
88
|
+
type: 'text',
|
|
89
|
+
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
90
|
+
};
|
|
91
|
+
const logOutput = logLines.length === 0 ?
|
|
92
|
+
null
|
|
93
|
+
: {
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: logLines.join('\n'),
|
|
96
|
+
};
|
|
97
|
+
const errOutput = errLines.length === 0 ?
|
|
98
|
+
null
|
|
99
|
+
: {
|
|
100
|
+
type: 'text',
|
|
101
|
+
text: 'Error output:\n' + errLines.join('\n'),
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const { message } = (await resp.json());
|
|
109
|
+
throw new Error(message);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
throw e;
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
worker.terminate();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return { metadata, tool, handler };
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=code-tool.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;qBAC9C,CAAC;gBACN,OAAO;oBACL,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;iBAChF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAgB,CAAC;gBACvD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/compat.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { Endpoint } from "./tools.mjs";
|
|
3
4
|
export interface ClientCapabilities {
|
|
4
5
|
topLevelUnions: boolean;
|
|
@@ -9,8 +10,9 @@ export interface ClientCapabilities {
|
|
|
9
10
|
toolNameLength: number | undefined;
|
|
10
11
|
}
|
|
11
12
|
export declare const defaultClientCapabilities: ClientCapabilities;
|
|
12
|
-
export
|
|
13
|
-
export
|
|
13
|
+
export declare const ClientType: z.ZodEnum<["openai-agents", "claude", "claude-code", "cursor", "infer"]>;
|
|
14
|
+
export type ClientType = z.infer<typeof ClientType>;
|
|
15
|
+
export declare const knownClients: Record<Exclude<ClientType, 'infer'>, ClientCapabilities>;
|
|
14
16
|
/**
|
|
15
17
|
* Attempts to parse strings into JSON objects
|
|
16
18
|
*/
|
package/compat.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.mts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,QAAQ,EAAE;AAEnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,kBAOvC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"compat.d.mts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,QAAQ,EAAE;AAEnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,kBAOvC,CAAC;AAEF,eAAO,MAAM,UAAU,0EAAwE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAKpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAiCjF,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM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C/B,QAAQ,EAAE,CAiEZ"}
|
package/compat.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { Endpoint } from "./tools.js";
|
|
3
4
|
export interface ClientCapabilities {
|
|
4
5
|
topLevelUnions: boolean;
|
|
@@ -9,8 +10,9 @@ export interface ClientCapabilities {
|
|
|
9
10
|
toolNameLength: number | undefined;
|
|
10
11
|
}
|
|
11
12
|
export declare const defaultClientCapabilities: ClientCapabilities;
|
|
12
|
-
export
|
|
13
|
-
export
|
|
13
|
+
export declare const ClientType: z.ZodEnum<["openai-agents", "claude", "claude-code", "cursor", "infer"]>;
|
|
14
|
+
export type ClientType = z.infer<typeof ClientType>;
|
|
15
|
+
export declare const knownClients: Record<Exclude<ClientType, 'infer'>, ClientCapabilities>;
|
|
14
16
|
/**
|
|
15
17
|
* Attempts to parse strings into JSON objects
|
|
16
18
|
*/
|
package/compat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,QAAQ,EAAE;AAEnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,kBAOvC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,CAA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