scorecard-ai-mcp 1.0.0-alpha.4
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 +201 -0
- package/README.md +228 -0
- package/compat.d.mts +53 -0
- package/compat.d.mts.map +1 -0
- package/compat.d.ts +53 -0
- package/compat.d.ts.map +1 -0
- package/compat.js +351 -0
- package/compat.js.map +1 -0
- package/compat.mjs +338 -0
- package/compat.mjs.map +1 -0
- package/compat.test.d.mts +2 -0
- package/compat.test.d.mts.map +1 -0
- package/compat.test.d.ts +2 -0
- package/compat.test.d.ts.map +1 -0
- package/compat.test.js +950 -0
- package/compat.test.js.map +1 -0
- package/compat.test.mjs +948 -0
- package/compat.test.mjs.map +1 -0
- package/index.d.mts +2 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +89 -0
- package/index.js.map +1 -0
- package/index.mjs +86 -0
- package/index.mjs.map +1 -0
- package/options.d.mts +9 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +9 -0
- package/options.d.ts.map +1 -0
- package/options.js +321 -0
- package/options.js.map +1 -0
- package/options.mjs +314 -0
- package/options.mjs.map +1 -0
- package/options.test.d.mts +2 -0
- package/options.test.d.mts.map +1 -0
- package/options.test.d.ts +2 -0
- package/options.test.d.ts.map +1 -0
- package/options.test.js +154 -0
- package/options.test.js.map +1 -0
- package/options.test.mjs +152 -0
- package/options.test.mjs.map +1 -0
- package/package.json +129 -0
- package/server.d.mts +33 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +33 -0
- package/server.d.ts.map +1 -0
- package/server.js +85 -0
- package/server.js.map +1 -0
- package/server.mjs +74 -0
- package/server.mjs.map +1 -0
- package/src/compat.test.ts +1068 -0
- package/src/compat.ts +437 -0
- package/src/index.ts +106 -0
- package/src/options.test.ts +193 -0
- package/src/options.ts +339 -0
- package/src/server.ts +98 -0
- package/src/tools/index.ts +129 -0
- package/src/tools/projects/list-projects.ts +39 -0
- package/src/tools/records/create-records.ts +47 -0
- package/src/tools/runs/create-runs.ts +46 -0
- package/src/tools/runs/update-runs.ts +44 -0
- package/src/tools/system-configs/create-system-configs.ts +59 -0
- package/src/tools/system-configs/get-system-configs.ts +34 -0
- package/src/tools/system-configs/list-system-configs.ts +42 -0
- package/src/tools/systems/create-systems.ts +52 -0
- package/src/tools/systems/delete-systems.ts +31 -0
- package/src/tools/systems/get-systems.ts +31 -0
- package/src/tools/systems/list-systems.ts +41 -0
- package/src/tools/systems/update-systems.ts +52 -0
- package/src/tools/testcases/create-testcases.ts +47 -0
- package/src/tools/testcases/delete-testcases.ts +35 -0
- package/src/tools/testcases/get-testcases.ts +31 -0
- package/src/tools/testcases/list-testcases.ts +41 -0
- package/src/tools/testcases/update-testcases.ts +35 -0
- package/src/tools/testsets/create-testsets.ts +73 -0
- package/src/tools/testsets/delete-testsets.ts +31 -0
- package/src/tools/testsets/get-testsets.ts +31 -0
- package/src/tools/testsets/list-testsets.ts +41 -0
- package/src/tools/testsets/update-testsets.ts +73 -0
- package/src/tools.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/tools/index.d.mts +21 -0
- package/tools/index.d.mts.map +1 -0
- package/tools/index.d.ts +21 -0
- package/tools/index.d.ts.map +1 -0
- package/tools/index.js +99 -0
- package/tools/index.js.map +1 -0
- package/tools/index.mjs +92 -0
- package/tools/index.mjs.map +1 -0
- package/tools/projects/list-projects.d.mts +24 -0
- package/tools/projects/list-projects.d.mts.map +1 -0
- package/tools/projects/list-projects.d.ts +24 -0
- package/tools/projects/list-projects.d.ts.map +1 -0
- package/tools/projects/list-projects.js +33 -0
- package/tools/projects/list-projects.js.map +1 -0
- package/tools/projects/list-projects.mjs +29 -0
- package/tools/projects/list-projects.mjs.map +1 -0
- package/tools/records/create-records.d.mts +24 -0
- package/tools/records/create-records.d.mts.map +1 -0
- package/tools/records/create-records.d.ts +24 -0
- package/tools/records/create-records.d.ts.map +1 -0
- package/tools/records/create-records.js +44 -0
- package/tools/records/create-records.js.map +1 -0
- package/tools/records/create-records.mjs +40 -0
- package/tools/records/create-records.mjs.map +1 -0
- package/tools/runs/create-runs.d.mts +24 -0
- package/tools/runs/create-runs.d.mts.map +1 -0
- package/tools/runs/create-runs.d.ts +24 -0
- package/tools/runs/create-runs.d.ts.map +1 -0
- package/tools/runs/create-runs.js +43 -0
- package/tools/runs/create-runs.js.map +1 -0
- package/tools/runs/create-runs.mjs +39 -0
- package/tools/runs/create-runs.mjs.map +1 -0
- package/tools/runs/update-runs.d.mts +24 -0
- package/tools/runs/update-runs.d.mts.map +1 -0
- package/tools/runs/update-runs.d.ts +24 -0
- package/tools/runs/update-runs.d.ts.map +1 -0
- package/tools/runs/update-runs.js +41 -0
- package/tools/runs/update-runs.js.map +1 -0
- package/tools/runs/update-runs.mjs +37 -0
- package/tools/runs/update-runs.mjs.map +1 -0
- package/tools/system-configs/create-system-configs.d.mts +24 -0
- package/tools/system-configs/create-system-configs.d.mts.map +1 -0
- package/tools/system-configs/create-system-configs.d.ts +24 -0
- package/tools/system-configs/create-system-configs.d.ts.map +1 -0
- package/tools/system-configs/create-system-configs.js +54 -0
- package/tools/system-configs/create-system-configs.js.map +1 -0
- package/tools/system-configs/create-system-configs.mjs +50 -0
- package/tools/system-configs/create-system-configs.mjs.map +1 -0
- package/tools/system-configs/get-system-configs.d.mts +24 -0
- package/tools/system-configs/get-system-configs.d.mts.map +1 -0
- package/tools/system-configs/get-system-configs.d.ts +24 -0
- package/tools/system-configs/get-system-configs.d.ts.map +1 -0
- package/tools/system-configs/get-system-configs.js +31 -0
- package/tools/system-configs/get-system-configs.js.map +1 -0
- package/tools/system-configs/get-system-configs.mjs +27 -0
- package/tools/system-configs/get-system-configs.mjs.map +1 -0
- package/tools/system-configs/list-system-configs.d.mts +24 -0
- package/tools/system-configs/list-system-configs.d.mts.map +1 -0
- package/tools/system-configs/list-system-configs.d.ts +24 -0
- package/tools/system-configs/list-system-configs.d.ts.map +1 -0
- package/tools/system-configs/list-system-configs.js +36 -0
- package/tools/system-configs/list-system-configs.js.map +1 -0
- package/tools/system-configs/list-system-configs.mjs +32 -0
- package/tools/system-configs/list-system-configs.mjs.map +1 -0
- package/tools/systems/create-systems.d.mts +24 -0
- package/tools/systems/create-systems.d.mts.map +1 -0
- package/tools/systems/create-systems.d.ts +24 -0
- package/tools/systems/create-systems.d.ts.map +1 -0
- package/tools/systems/create-systems.js +48 -0
- package/tools/systems/create-systems.js.map +1 -0
- package/tools/systems/create-systems.mjs +44 -0
- package/tools/systems/create-systems.mjs.map +1 -0
- package/tools/systems/delete-systems.d.mts +24 -0
- package/tools/systems/delete-systems.d.mts.map +1 -0
- package/tools/systems/delete-systems.d.ts +24 -0
- package/tools/systems/delete-systems.d.ts.map +1 -0
- package/tools/systems/delete-systems.js +28 -0
- package/tools/systems/delete-systems.js.map +1 -0
- package/tools/systems/delete-systems.mjs +24 -0
- package/tools/systems/delete-systems.mjs.map +1 -0
- package/tools/systems/get-systems.d.mts +24 -0
- package/tools/systems/get-systems.d.mts.map +1 -0
- package/tools/systems/get-systems.d.ts +24 -0
- package/tools/systems/get-systems.d.ts.map +1 -0
- package/tools/systems/get-systems.js +28 -0
- package/tools/systems/get-systems.js.map +1 -0
- package/tools/systems/get-systems.mjs +24 -0
- package/tools/systems/get-systems.mjs.map +1 -0
- package/tools/systems/list-systems.d.mts +24 -0
- package/tools/systems/list-systems.d.mts.map +1 -0
- package/tools/systems/list-systems.d.ts +24 -0
- package/tools/systems/list-systems.d.ts.map +1 -0
- package/tools/systems/list-systems.js +36 -0
- package/tools/systems/list-systems.js.map +1 -0
- package/tools/systems/list-systems.mjs +32 -0
- package/tools/systems/list-systems.mjs.map +1 -0
- package/tools/systems/update-systems.d.mts +24 -0
- package/tools/systems/update-systems.d.mts.map +1 -0
- package/tools/systems/update-systems.d.ts +24 -0
- package/tools/systems/update-systems.d.ts.map +1 -0
- package/tools/systems/update-systems.js +48 -0
- package/tools/systems/update-systems.js.map +1 -0
- package/tools/systems/update-systems.mjs +44 -0
- package/tools/systems/update-systems.mjs.map +1 -0
- package/tools/testcases/create-testcases.d.mts +24 -0
- package/tools/testcases/create-testcases.d.mts.map +1 -0
- package/tools/testcases/create-testcases.d.ts +24 -0
- package/tools/testcases/create-testcases.d.ts.map +1 -0
- package/tools/testcases/create-testcases.js +43 -0
- package/tools/testcases/create-testcases.js.map +1 -0
- package/tools/testcases/create-testcases.mjs +39 -0
- package/tools/testcases/create-testcases.mjs.map +1 -0
- package/tools/testcases/delete-testcases.d.mts +24 -0
- package/tools/testcases/delete-testcases.d.mts.map +1 -0
- package/tools/testcases/delete-testcases.d.ts +24 -0
- package/tools/testcases/delete-testcases.d.ts.map +1 -0
- package/tools/testcases/delete-testcases.js +32 -0
- package/tools/testcases/delete-testcases.js.map +1 -0
- package/tools/testcases/delete-testcases.mjs +28 -0
- package/tools/testcases/delete-testcases.mjs.map +1 -0
- package/tools/testcases/get-testcases.d.mts +24 -0
- package/tools/testcases/get-testcases.d.mts.map +1 -0
- package/tools/testcases/get-testcases.d.ts +24 -0
- package/tools/testcases/get-testcases.d.ts.map +1 -0
- package/tools/testcases/get-testcases.js +28 -0
- package/tools/testcases/get-testcases.js.map +1 -0
- package/tools/testcases/get-testcases.mjs +24 -0
- package/tools/testcases/get-testcases.mjs.map +1 -0
- package/tools/testcases/list-testcases.d.mts +24 -0
- package/tools/testcases/list-testcases.d.mts.map +1 -0
- package/tools/testcases/list-testcases.d.ts +24 -0
- package/tools/testcases/list-testcases.d.ts.map +1 -0
- package/tools/testcases/list-testcases.js +36 -0
- package/tools/testcases/list-testcases.js.map +1 -0
- package/tools/testcases/list-testcases.mjs +32 -0
- package/tools/testcases/list-testcases.mjs.map +1 -0
- package/tools/testcases/update-testcases.d.mts +24 -0
- package/tools/testcases/update-testcases.d.mts.map +1 -0
- package/tools/testcases/update-testcases.d.ts +24 -0
- package/tools/testcases/update-testcases.d.ts.map +1 -0
- package/tools/testcases/update-testcases.js +32 -0
- package/tools/testcases/update-testcases.js.map +1 -0
- package/tools/testcases/update-testcases.mjs +28 -0
- package/tools/testcases/update-testcases.mjs.map +1 -0
- package/tools/testsets/create-testsets.d.mts +24 -0
- package/tools/testsets/create-testsets.d.mts.map +1 -0
- package/tools/testsets/create-testsets.d.ts +24 -0
- package/tools/testsets/create-testsets.d.ts.map +1 -0
- package/tools/testsets/create-testsets.js +68 -0
- package/tools/testsets/create-testsets.js.map +1 -0
- package/tools/testsets/create-testsets.mjs +64 -0
- package/tools/testsets/create-testsets.mjs.map +1 -0
- package/tools/testsets/delete-testsets.d.mts +24 -0
- package/tools/testsets/delete-testsets.d.mts.map +1 -0
- package/tools/testsets/delete-testsets.d.ts +24 -0
- package/tools/testsets/delete-testsets.d.ts.map +1 -0
- package/tools/testsets/delete-testsets.js +28 -0
- package/tools/testsets/delete-testsets.js.map +1 -0
- package/tools/testsets/delete-testsets.mjs +24 -0
- package/tools/testsets/delete-testsets.mjs.map +1 -0
- package/tools/testsets/get-testsets.d.mts +24 -0
- package/tools/testsets/get-testsets.d.mts.map +1 -0
- package/tools/testsets/get-testsets.d.ts +24 -0
- package/tools/testsets/get-testsets.d.ts.map +1 -0
- package/tools/testsets/get-testsets.js +28 -0
- package/tools/testsets/get-testsets.js.map +1 -0
- package/tools/testsets/get-testsets.mjs +24 -0
- package/tools/testsets/get-testsets.mjs.map +1 -0
- package/tools/testsets/list-testsets.d.mts +24 -0
- package/tools/testsets/list-testsets.d.mts.map +1 -0
- package/tools/testsets/list-testsets.d.ts +24 -0
- package/tools/testsets/list-testsets.d.ts.map +1 -0
- package/tools/testsets/list-testsets.js +36 -0
- package/tools/testsets/list-testsets.js.map +1 -0
- package/tools/testsets/list-testsets.mjs +32 -0
- package/tools/testsets/list-testsets.mjs.map +1 -0
- package/tools/testsets/update-testsets.d.mts +24 -0
- package/tools/testsets/update-testsets.d.mts.map +1 -0
- package/tools/testsets/update-testsets.d.ts +24 -0
- package/tools/testsets/update-testsets.d.ts.map +1 -0
- package/tools/testsets/update-testsets.js +68 -0
- package/tools/testsets/update-testsets.js.map +1 -0
- package/tools/testsets/update-testsets.mjs +64 -0
- package/tools/testsets/update-testsets.mjs.map +1 -0
- package/tools.d.mts +2 -0
- package/tools.d.mts.map +1 -0
- package/tools.d.ts +2 -0
- package/tools.d.ts.map +1 -0
- package/tools.js +18 -0
- package/tools.js.map +1 -0
- package/tools.mjs +2 -0
- package/tools.mjs.map +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testcases',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'create_testcases',
|
|
15
|
+
description: 'Create multiple Testcases in the specified Testset.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testsetId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
items: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
description: 'Testcases to create (max 100).',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
description:
|
|
28
|
+
"A test case in the Scorecard system. Contains JSON data that is validated against the schema defined by its Testset.\nThe `inputs` and `labels` fields are derived from the `data` field based on the Testset's `fieldMapping`, and include all mapped fields, including those with validation errors.\nTestcases are stored regardless of validation results, with any validation errors included in the `validationErrors` field.",
|
|
29
|
+
properties: {
|
|
30
|
+
jsonData: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
description: "The JSON data of the Testcase, which is validated against the Testset's schema.",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['jsonData'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
43
|
+
const { testsetId, ...body } = args as any;
|
|
44
|
+
return client.testcases.create(testsetId, body);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testcases',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'delete_testcases',
|
|
15
|
+
description: 'Delete multiple Testcases by their IDs.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
ids: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
description: 'IDs of Testcases to delete.',
|
|
22
|
+
items: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
31
|
+
const body = args as any;
|
|
32
|
+
return client.testcases.delete(body);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testcases',
|
|
9
|
+
operation: 'read',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'get_testcases',
|
|
15
|
+
description: 'Retrieve a specific Testcase by ID.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testcaseId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
27
|
+
const { testcaseId, ...body } = args as any;
|
|
28
|
+
return client.testcases.get(testcaseId);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testcases',
|
|
9
|
+
operation: 'read',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'list_testcases',
|
|
15
|
+
description: 'Retrieve a paginated list of Testcases belonging to a Testset.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testsetId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
cursor: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description:
|
|
25
|
+
'Cursor for pagination. Pass the `nextCursor` from the previous response to get the next page of results.',
|
|
26
|
+
},
|
|
27
|
+
limit: {
|
|
28
|
+
type: 'integer',
|
|
29
|
+
description:
|
|
30
|
+
'Maximum number of items to return (1-100). Use with `cursor` for pagination through large sets.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
37
|
+
const { testsetId, ...body } = args as any;
|
|
38
|
+
return client.testcases.list(testsetId, body);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testcases',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'update_testcases',
|
|
15
|
+
description: 'Replace the data of an existing Testcase while keeping its ID.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testcaseId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
jsonData: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
description: "The JSON data of the Testcase, which is validated against the Testset's schema.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
31
|
+
const { testcaseId, ...body } = args as any;
|
|
32
|
+
return client.testcases.update(testcaseId, body);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testsets',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'create_testsets',
|
|
15
|
+
description:
|
|
16
|
+
'Create a new Testset for a Project. The Testset will be created in the Project specified in the path.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
projectId: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
},
|
|
23
|
+
description: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'The description of the Testset.',
|
|
26
|
+
},
|
|
27
|
+
fieldMapping: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
description:
|
|
30
|
+
'Maps top-level keys of the Testcase schema to their roles (input/label). Unmapped fields are treated as metadata.',
|
|
31
|
+
properties: {
|
|
32
|
+
inputs: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
description: 'Fields that represent inputs to the AI system.',
|
|
35
|
+
items: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
labels: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
description: 'Fields that represent expected outputs/labels.',
|
|
42
|
+
items: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
metadata: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
description: 'Fields that are not inputs or labels.',
|
|
49
|
+
items: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['inputs', 'labels', 'metadata'],
|
|
55
|
+
},
|
|
56
|
+
jsonSchema: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
description: 'The JSON schema for each Testcase in the Testset.',
|
|
59
|
+
},
|
|
60
|
+
name: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'The name of the Testset.',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
69
|
+
const { projectId, ...body } = args as any;
|
|
70
|
+
return client.testsets.create(projectId, body);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testsets',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'delete_testsets',
|
|
15
|
+
description: 'Delete Testset',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testsetId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
27
|
+
const { testsetId, ...body } = args as any;
|
|
28
|
+
return client.testsets.delete(testsetId);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testsets',
|
|
9
|
+
operation: 'read',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'get_testsets',
|
|
15
|
+
description: 'Get Testset by ID',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
testsetId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
27
|
+
const { testsetId, ...body } = args as any;
|
|
28
|
+
return client.testsets.get(testsetId);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testsets',
|
|
9
|
+
operation: 'read',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'list_testsets',
|
|
15
|
+
description: 'Retrieve a paginated list of Testsets belonging to a Project.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
projectId: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
cursor: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description:
|
|
25
|
+
'Cursor for pagination. Pass the `nextCursor` from the previous response to get the next page of results.',
|
|
26
|
+
},
|
|
27
|
+
limit: {
|
|
28
|
+
type: 'integer',
|
|
29
|
+
description:
|
|
30
|
+
'Maximum number of items to return (1-100). Use with `cursor` for pagination through large sets.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
37
|
+
const { projectId, ...body } = args as any;
|
|
38
|
+
return client.testsets.list(projectId, body);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default { metadata, tool, handler };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { Metadata } from '../';
|
|
5
|
+
import Scorecard from 'scorecard-ai';
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
resource: 'testsets',
|
|
9
|
+
operation: 'write',
|
|
10
|
+
tags: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool: Tool = {
|
|
14
|
+
name: 'update_testsets',
|
|
15
|
+
description:
|
|
16
|
+
'Update a Testset. Only the fields provided in the request body will be updated.\nIf a field is provided, the new content will replace the existing content.\nIf a field is not provided, the existing content will remain unchanged.\n\nWhen updating the schema:\n- If field mappings are not provided and existing mappings reference fields that no longer exist, those mappings will be automatically removed\n- To preserve all existing mappings, ensure all referenced fields remain in the updated schema\n- For complete control, provide both schema and fieldMapping when updating the schema',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
testsetId: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
},
|
|
23
|
+
description: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'The description of the Testset.',
|
|
26
|
+
},
|
|
27
|
+
fieldMapping: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
description:
|
|
30
|
+
'Maps top-level keys of the Testcase schema to their roles (input/label). Unmapped fields are treated as metadata.',
|
|
31
|
+
properties: {
|
|
32
|
+
inputs: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
description: 'Fields that represent inputs to the AI system.',
|
|
35
|
+
items: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
labels: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
description: 'Fields that represent expected outputs/labels.',
|
|
42
|
+
items: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
metadata: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
description: 'Fields that are not inputs or labels.',
|
|
49
|
+
items: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['inputs', 'labels', 'metadata'],
|
|
55
|
+
},
|
|
56
|
+
jsonSchema: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
description: 'The JSON schema for each Testcase in the Testset.',
|
|
59
|
+
},
|
|
60
|
+
name: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'The name of the Testset.',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const handler = (client: Scorecard, args: Record<string, unknown> | undefined) => {
|
|
69
|
+
const { testsetId, ...body } = args as any;
|
|
70
|
+
return client.testsets.update(testsetId, body);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default { metadata, tool, handler };
|
package/src/tools.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tools/index';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
// this config is included in the published src directory to prevent TS errors
|
|
3
|
+
// from appearing when users go to source, and VSCode opens the source .ts file
|
|
4
|
+
// via declaration maps
|
|
5
|
+
"include": ["index.ts"],
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"target": "es2015",
|
|
8
|
+
"lib": ["DOM"],
|
|
9
|
+
"moduleResolution": "node"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Scorecard from 'scorecard-ai';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
export type HandlerFunction = (client: Scorecard, args: Record<string, unknown> | undefined) => Promise<any>;
|
|
4
|
+
export type Metadata = {
|
|
5
|
+
resource: string;
|
|
6
|
+
operation: 'read' | 'write';
|
|
7
|
+
tags: string[];
|
|
8
|
+
};
|
|
9
|
+
export type Endpoint = {
|
|
10
|
+
metadata: Metadata;
|
|
11
|
+
tool: Tool;
|
|
12
|
+
handler: HandlerFunction;
|
|
13
|
+
};
|
|
14
|
+
export declare const endpoints: Endpoint[];
|
|
15
|
+
export type Filter = {
|
|
16
|
+
type: 'resource' | 'operation' | 'tag' | 'tool';
|
|
17
|
+
op: 'include' | 'exclude';
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function query(filters: Filter[], endpoints: Endpoint[]): Endpoint[];
|
|
21
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/tools/index.ts"],"names":[],"mappings":"OAEO,SAAS,MAAM,cAAc;OAC7B,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAyBzD,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE7G,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,EAAO,CAAC;AA6BxC,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;IAChD,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CA+B1E"}
|
package/tools/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Scorecard from 'scorecard-ai';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
export type HandlerFunction = (client: Scorecard, args: Record<string, unknown> | undefined) => Promise<any>;
|
|
4
|
+
export type Metadata = {
|
|
5
|
+
resource: string;
|
|
6
|
+
operation: 'read' | 'write';
|
|
7
|
+
tags: string[];
|
|
8
|
+
};
|
|
9
|
+
export type Endpoint = {
|
|
10
|
+
metadata: Metadata;
|
|
11
|
+
tool: Tool;
|
|
12
|
+
handler: HandlerFunction;
|
|
13
|
+
};
|
|
14
|
+
export declare const endpoints: Endpoint[];
|
|
15
|
+
export type Filter = {
|
|
16
|
+
type: 'resource' | 'operation' | 'tag' | 'tool';
|
|
17
|
+
op: 'include' | 'exclude';
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function query(filters: Filter[], endpoints: Endpoint[]): Endpoint[];
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/tools/index.ts"],"names":[],"mappings":"OAEO,SAAS,MAAM,cAAc;OAC7B,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAyBzD,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE7G,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,EAAO,CAAC;AA6BxC,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;IAChD,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CA+B1E"}
|
package/tools/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
exports.query = exports.endpoints = void 0;
|
|
8
|
+
const list_projects_1 = __importDefault(require("./projects/list-projects.js"));
|
|
9
|
+
const create_testsets_1 = __importDefault(require("./testsets/create-testsets.js"));
|
|
10
|
+
const update_testsets_1 = __importDefault(require("./testsets/update-testsets.js"));
|
|
11
|
+
const list_testsets_1 = __importDefault(require("./testsets/list-testsets.js"));
|
|
12
|
+
const delete_testsets_1 = __importDefault(require("./testsets/delete-testsets.js"));
|
|
13
|
+
const get_testsets_1 = __importDefault(require("./testsets/get-testsets.js"));
|
|
14
|
+
const create_testcases_1 = __importDefault(require("./testcases/create-testcases.js"));
|
|
15
|
+
const update_testcases_1 = __importDefault(require("./testcases/update-testcases.js"));
|
|
16
|
+
const list_testcases_1 = __importDefault(require("./testcases/list-testcases.js"));
|
|
17
|
+
const delete_testcases_1 = __importDefault(require("./testcases/delete-testcases.js"));
|
|
18
|
+
const get_testcases_1 = __importDefault(require("./testcases/get-testcases.js"));
|
|
19
|
+
const create_runs_1 = __importDefault(require("./runs/create-runs.js"));
|
|
20
|
+
const update_runs_1 = __importDefault(require("./runs/update-runs.js"));
|
|
21
|
+
const create_records_1 = __importDefault(require("./records/create-records.js"));
|
|
22
|
+
const create_systems_1 = __importDefault(require("./systems/create-systems.js"));
|
|
23
|
+
const update_systems_1 = __importDefault(require("./systems/update-systems.js"));
|
|
24
|
+
const list_systems_1 = __importDefault(require("./systems/list-systems.js"));
|
|
25
|
+
const delete_systems_1 = __importDefault(require("./systems/delete-systems.js"));
|
|
26
|
+
const get_systems_1 = __importDefault(require("./systems/get-systems.js"));
|
|
27
|
+
const create_system_configs_1 = __importDefault(require("./system-configs/create-system-configs.js"));
|
|
28
|
+
const list_system_configs_1 = __importDefault(require("./system-configs/list-system-configs.js"));
|
|
29
|
+
const get_system_configs_1 = __importDefault(require("./system-configs/get-system-configs.js"));
|
|
30
|
+
exports.endpoints = [];
|
|
31
|
+
function addEndpoint(endpoint) {
|
|
32
|
+
exports.endpoints.push(endpoint);
|
|
33
|
+
}
|
|
34
|
+
addEndpoint(list_projects_1.default);
|
|
35
|
+
addEndpoint(create_testsets_1.default);
|
|
36
|
+
addEndpoint(update_testsets_1.default);
|
|
37
|
+
addEndpoint(list_testsets_1.default);
|
|
38
|
+
addEndpoint(delete_testsets_1.default);
|
|
39
|
+
addEndpoint(get_testsets_1.default);
|
|
40
|
+
addEndpoint(create_testcases_1.default);
|
|
41
|
+
addEndpoint(update_testcases_1.default);
|
|
42
|
+
addEndpoint(list_testcases_1.default);
|
|
43
|
+
addEndpoint(delete_testcases_1.default);
|
|
44
|
+
addEndpoint(get_testcases_1.default);
|
|
45
|
+
addEndpoint(create_runs_1.default);
|
|
46
|
+
addEndpoint(update_runs_1.default);
|
|
47
|
+
addEndpoint(create_records_1.default);
|
|
48
|
+
addEndpoint(create_systems_1.default);
|
|
49
|
+
addEndpoint(update_systems_1.default);
|
|
50
|
+
addEndpoint(list_systems_1.default);
|
|
51
|
+
addEndpoint(delete_systems_1.default);
|
|
52
|
+
addEndpoint(get_systems_1.default);
|
|
53
|
+
addEndpoint(create_system_configs_1.default);
|
|
54
|
+
addEndpoint(list_system_configs_1.default);
|
|
55
|
+
addEndpoint(get_system_configs_1.default);
|
|
56
|
+
function query(filters, endpoints) {
|
|
57
|
+
if (filters.length === 0) {
|
|
58
|
+
return endpoints;
|
|
59
|
+
}
|
|
60
|
+
const allExcludes = filters.every((filter) => filter.op === 'exclude');
|
|
61
|
+
const unmatchedFilters = new Set(filters);
|
|
62
|
+
const filtered = endpoints.filter((endpoint) => {
|
|
63
|
+
let included = false || allExcludes;
|
|
64
|
+
for (const filter of filters) {
|
|
65
|
+
if (match(filter, endpoint)) {
|
|
66
|
+
unmatchedFilters.delete(filter);
|
|
67
|
+
included = filter.op === 'include';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return included;
|
|
71
|
+
});
|
|
72
|
+
// Check if any filters didn't match
|
|
73
|
+
if (unmatchedFilters.size > 0) {
|
|
74
|
+
throw new Error(`The following filters did not match any endpoints: ${[...unmatchedFilters]
|
|
75
|
+
.map((f) => `${f.type}=${f.value}`)
|
|
76
|
+
.join(', ')}`);
|
|
77
|
+
}
|
|
78
|
+
return filtered;
|
|
79
|
+
}
|
|
80
|
+
exports.query = query;
|
|
81
|
+
function match({ type, value }, endpoint) {
|
|
82
|
+
switch (type) {
|
|
83
|
+
case 'resource': {
|
|
84
|
+
const regexStr = '^' + normalizeResource(value).replace(/\*/g, '.*') + '$';
|
|
85
|
+
const regex = new RegExp(regexStr);
|
|
86
|
+
return regex.test(normalizeResource(endpoint.metadata.resource));
|
|
87
|
+
}
|
|
88
|
+
case 'operation':
|
|
89
|
+
return endpoint.metadata.operation === value;
|
|
90
|
+
case 'tag':
|
|
91
|
+
return endpoint.metadata.tags.includes(value);
|
|
92
|
+
case 'tool':
|
|
93
|
+
return endpoint.tool.name === value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function normalizeResource(resource) {
|
|
97
|
+
return resource.toLowerCase().replace(/[^a-z.*\-_]*/g, '');
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/tools/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAKtF,gFAAqD;AACrD,oFAAyD;AACzD,oFAAyD;AACzD,gFAAqD;AACrD,oFAAyD;AACzD,8EAAmD;AACnD,uFAA4D;AAC5D,uFAA4D;AAC5D,mFAAwD;AACxD,uFAA4D;AAC5D,iFAAsD;AACtD,wEAA6C;AAC7C,wEAA6C;AAC7C,iFAAsD;AACtD,iFAAsD;AACtD,iFAAsD;AACtD,6EAAkD;AAClD,iFAAsD;AACtD,2EAAgD;AAChD,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