@langwatch/mcp-server 0.6.0 → 0.7.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/CHANGELOG.md +30 -0
- package/Dockerfile +22 -0
- package/README.md +51 -8
- package/dist/{archive-scenario-YFD5THOR.js → archive-scenario-WJ2A7ETN.js} +4 -4
- package/dist/archive-suite-4JOM4SSL.js +15 -0
- package/dist/archive-suite-4JOM4SSL.js.map +1 -0
- package/dist/assign-prompt-tag-GL7EAAF3.js +19 -0
- package/dist/assign-prompt-tag-GL7EAAF3.js.map +1 -0
- package/dist/{chunk-6U4TCGFC.js → chunk-2GT7IFWK.js} +2 -2
- package/dist/{chunk-LLRQIF52.js → chunk-2WPLXEKF.js} +49 -5
- package/dist/chunk-2WPLXEKF.js.map +1 -0
- package/dist/chunk-4AUB2BIA.js +71 -0
- package/dist/chunk-4AUB2BIA.js.map +1 -0
- package/dist/chunk-BWWY5KEF.js +71 -0
- package/dist/chunk-BWWY5KEF.js.map +1 -0
- package/dist/{chunk-IX6QJKAD.js → chunk-CCWCIJJ3.js} +2 -2
- package/dist/chunk-E5JYYU3J.js +1567 -0
- package/dist/chunk-E5JYYU3J.js.map +1 -0
- package/dist/chunk-EGH5RPXM.js +25 -0
- package/dist/chunk-EGH5RPXM.js.map +1 -0
- package/dist/chunk-EUQDVOSU.js +39 -0
- package/dist/chunk-EUQDVOSU.js.map +1 -0
- package/dist/{chunk-5UOPNRXW.js → chunk-HYMIWO3U.js} +10 -3
- package/dist/{chunk-5UOPNRXW.js.map → chunk-HYMIWO3U.js.map} +1 -1
- package/dist/chunk-IE4M5OGE.js +42 -0
- package/dist/chunk-IE4M5OGE.js.map +1 -0
- package/dist/chunk-LUMEZEHL.js +48 -0
- package/dist/chunk-LUMEZEHL.js.map +1 -0
- package/dist/chunk-NUFPTHKU.js +9 -0
- package/dist/chunk-NUFPTHKU.js.map +1 -0
- package/dist/chunk-WQG2DFHX.js +86 -0
- package/dist/chunk-WQG2DFHX.js.map +1 -0
- package/dist/chunk-WVI5CJ6S.js +21 -0
- package/dist/chunk-WVI5CJ6S.js.map +1 -0
- package/dist/chunk-ZVS4UKN2.js +35 -0
- package/dist/chunk-ZVS4UKN2.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +13 -0
- package/dist/create-agent-MBOOT3XK.js +23 -0
- package/dist/create-agent-MBOOT3XK.js.map +1 -0
- package/dist/create-annotation-XMV6A7ED.js +24 -0
- package/dist/create-annotation-XMV6A7ED.js.map +1 -0
- package/dist/create-dashboard-VRKLFVZJ.js +18 -0
- package/dist/create-dashboard-VRKLFVZJ.js.map +1 -0
- package/dist/create-dataset-7HQPZCRE.js +22 -0
- package/dist/create-dataset-7HQPZCRE.js.map +1 -0
- package/dist/create-dataset-records-2NIVFYTV.js +22 -0
- package/dist/create-dataset-records-2NIVFYTV.js.map +1 -0
- package/dist/{create-evaluator-E5X5ZP3B.js → create-evaluator-WYFRFLRC.js} +4 -4
- package/dist/create-mcp-server.d.ts +8 -0
- package/dist/create-mcp-server.js +8 -0
- package/dist/create-mcp-server.js.map +1 -0
- package/dist/{create-prompt-7Z35MIL6.js → create-prompt-IEN7O6JT.js} +7 -4
- package/dist/create-prompt-IEN7O6JT.js.map +1 -0
- package/dist/create-prompt-tag-CAEZ45VO.js +17 -0
- package/dist/create-prompt-tag-CAEZ45VO.js.map +1 -0
- package/dist/{create-scenario-DIMPJRPY.js → create-scenario-6YHSMGLP.js} +4 -4
- package/dist/create-suite-H5XOFDE5.js +38 -0
- package/dist/create-suite-H5XOFDE5.js.map +1 -0
- package/dist/delete-agent-JKTNBWAA.js +18 -0
- package/dist/delete-agent-JKTNBWAA.js.map +1 -0
- package/dist/delete-annotation-ACMDV6QO.js +17 -0
- package/dist/delete-annotation-ACMDV6QO.js.map +1 -0
- package/dist/delete-dashboard-VJSR7CRU.js +18 -0
- package/dist/delete-dashboard-VJSR7CRU.js.map +1 -0
- package/dist/delete-dataset-RTTTWP4D.js +20 -0
- package/dist/delete-dataset-RTTTWP4D.js.map +1 -0
- package/dist/delete-dataset-records-KNQTIPQK.js +21 -0
- package/dist/delete-dataset-records-KNQTIPQK.js.map +1 -0
- package/dist/delete-evaluator-7FVC5WM4.js +15 -0
- package/dist/delete-evaluator-7FVC5WM4.js.map +1 -0
- package/dist/delete-prompt-tag-ZMZUAGFW.js +17 -0
- package/dist/delete-prompt-tag-ZMZUAGFW.js.map +1 -0
- package/dist/delete-workflow-EYQ3T4RQ.js +17 -0
- package/dist/delete-workflow-EYQ3T4RQ.js.map +1 -0
- package/dist/get-agent-E3QSTVKG.js +28 -0
- package/dist/get-agent-E3QSTVKG.js.map +1 -0
- package/dist/{get-analytics-4YJW4S5L.js → get-analytics-2OHV763I.js} +22 -5
- package/dist/get-analytics-2OHV763I.js.map +1 -0
- package/dist/get-dashboard-PC7JDHH6.js +29 -0
- package/dist/get-dashboard-PC7JDHH6.js.map +1 -0
- package/dist/get-dataset-H5IK5FVU.js +48 -0
- package/dist/get-dataset-H5IK5FVU.js.map +1 -0
- package/dist/{get-evaluator-WDEH2F7M.js → get-evaluator-UWVUPYTM.js} +4 -4
- package/dist/{get-prompt-F6PDVC76.js → get-prompt-WZUOLLQC.js} +4 -4
- package/dist/get-prompt-WZUOLLQC.js.map +1 -0
- package/dist/{get-scenario-H24ZYNT5.js → get-scenario-Q6LCNUYN.js} +4 -4
- package/dist/get-simulation-run-Z2XKO256.js +56 -0
- package/dist/get-simulation-run-Z2XKO256.js.map +1 -0
- package/dist/get-suite-BXK5TN7P.js +44 -0
- package/dist/get-suite-BXK5TN7P.js.map +1 -0
- package/dist/{get-trace-27USKGO7.js → get-trace-4EJAYVBG.js} +3 -3
- package/dist/get-workflow-O34QJLHD.js +25 -0
- package/dist/get-workflow-O34QJLHD.js.map +1 -0
- package/dist/http-server-ISHF7NJX.js +224 -0
- package/dist/http-server-ISHF7NJX.js.map +1 -0
- package/dist/index.js +61109 -31519
- package/dist/index.js.map +1 -1
- package/dist/langwatch-api-annotations-ERBG27RF.js +17 -0
- package/dist/langwatch-api-annotations-ERBG27RF.js.map +1 -0
- package/dist/langwatch-api-dashboards-G6TR7VVO.js +17 -0
- package/dist/langwatch-api-dashboards-G6TR7VVO.js.map +1 -0
- package/dist/langwatch-api-monitors-WSXZLS2B.js +52 -0
- package/dist/langwatch-api-monitors-WSXZLS2B.js.map +1 -0
- package/dist/langwatch-api-secrets-RR5DKG2X.js +40 -0
- package/dist/langwatch-api-secrets-RR5DKG2X.js.map +1 -0
- package/dist/langwatch-api-triggers-2RTNSWQY.js +30 -0
- package/dist/langwatch-api-triggers-2RTNSWQY.js.map +1 -0
- package/dist/langwatch-api-workflows-VJRIIDZ7.js +15 -0
- package/dist/langwatch-api-workflows-VJRIIDZ7.js.map +1 -0
- package/dist/list-agents-AW3P6FJV.js +32 -0
- package/dist/list-agents-AW3P6FJV.js.map +1 -0
- package/dist/list-annotations-QNCGWPQ3.js +33 -0
- package/dist/list-annotations-QNCGWPQ3.js.map +1 -0
- package/dist/list-dashboards-R7RK2IXL.js +32 -0
- package/dist/list-dashboards-R7RK2IXL.js.map +1 -0
- package/dist/list-dataset-records-WVCSQP7P.js +39 -0
- package/dist/list-dataset-records-WVCSQP7P.js.map +1 -0
- package/dist/list-datasets-KEXRLDEU.js +60 -0
- package/dist/list-datasets-KEXRLDEU.js.map +1 -0
- package/dist/{list-evaluators-KRGI72EH.js → list-evaluators-7R2LB4JH.js} +4 -4
- package/dist/{list-model-providers-A5YCFTPI.js → list-model-providers-OBYJCKBX.js} +4 -4
- package/dist/list-prompt-tags-6LY3ZPYI.js +23 -0
- package/dist/list-prompt-tags-6LY3ZPYI.js.map +1 -0
- package/dist/{list-prompts-LKJSE7XN.js → list-prompts-VWEZ4CDE.js} +3 -3
- package/dist/{list-scenarios-ZK5CMGC4.js → list-scenarios-TXD4W2ZJ.js} +4 -4
- package/dist/list-simulation-runs-RHPOLMFI.js +43 -0
- package/dist/list-simulation-runs-RHPOLMFI.js.map +1 -0
- package/dist/list-suites-FSGBX27Z.js +42 -0
- package/dist/list-suites-FSGBX27Z.js.map +1 -0
- package/dist/list-workflows-VRGEZ3EN.js +35 -0
- package/dist/list-workflows-VRGEZ3EN.js.map +1 -0
- package/dist/rename-prompt-tag-VOJJLX4M.js +18 -0
- package/dist/rename-prompt-tag-VOJJLX4M.js.map +1 -0
- package/dist/run-agent-KTCC7TB7.js +36 -0
- package/dist/run-agent-KTCC7TB7.js.map +1 -0
- package/dist/run-evaluation-2X3V3Q6L.js +64 -0
- package/dist/run-evaluation-2X3V3Q6L.js.map +1 -0
- package/dist/run-suite-BTMHGI2D.js +29 -0
- package/dist/run-suite-BTMHGI2D.js.map +1 -0
- package/dist/run-workflow-IGAYGKJL.js +36 -0
- package/dist/run-workflow-IGAYGKJL.js.map +1 -0
- package/dist/{search-traces-SOKAAMAR.js → search-traces-VYFUIMXH.js} +3 -3
- package/dist/{set-model-provider-7MGULZDH.js → set-model-provider-W5IUI326.js} +4 -4
- package/dist/update-agent-4BB7EYLR.js +20 -0
- package/dist/update-agent-4BB7EYLR.js.map +1 -0
- package/dist/update-dataset-CXBKZ4W3.js +22 -0
- package/dist/update-dataset-CXBKZ4W3.js.map +1 -0
- package/dist/update-dataset-record-HOHAMHXG.js +19 -0
- package/dist/update-dataset-record-HOHAMHXG.js.map +1 -0
- package/dist/{update-evaluator-A3XINFLJ.js → update-evaluator-IVOR6FTR.js} +4 -4
- package/dist/{update-prompt-IW7X2UQM.js → update-prompt-OWQAKE7K.js} +5 -3
- package/dist/update-prompt-OWQAKE7K.js.map +1 -0
- package/dist/{update-scenario-ZT7TOBFR.js → update-scenario-GDFVILPN.js} +4 -4
- package/dist/update-suite-BXYUYSPT.js +39 -0
- package/dist/update-suite-BXYUYSPT.js.map +1 -0
- package/package.json +17 -3
- package/src/__tests__/all-tools.integration.test.ts +344 -0
- package/src/__tests__/config.unit.test.ts +81 -1
- package/src/__tests__/datasets.integration.test.ts +603 -0
- package/src/__tests__/datasets.unit.test.ts +240 -0
- package/src/__tests__/docker.integration.test.ts +234 -0
- package/src/__tests__/http-transport.integration.test.ts +397 -0
- package/src/__tests__/langwatch-api.unit.test.ts +174 -0
- package/src/__tests__/tools.unit.test.ts +177 -0
- package/src/config.d.ts +15 -0
- package/src/config.ts +83 -7
- package/src/create-mcp-server.d.ts +6 -0
- package/src/create-mcp-server.ts +1799 -0
- package/src/http-server.ts +329 -0
- package/src/index.ts +22 -593
- package/src/langwatch-api-agents.ts +108 -0
- package/src/langwatch-api-annotations.ts +49 -0
- package/src/langwatch-api-dashboards.ts +48 -0
- package/src/langwatch-api-datasets.ts +191 -0
- package/src/langwatch-api-evaluators.ts +10 -0
- package/src/langwatch-api-monitors.ts +82 -0
- package/src/langwatch-api-secrets.ts +48 -0
- package/src/langwatch-api-simulation-runs.ts +51 -0
- package/src/langwatch-api-suites.ts +118 -0
- package/src/langwatch-api-triggers.ts +48 -0
- package/src/langwatch-api-workflows.ts +41 -0
- package/src/langwatch-api.ts +60 -2
- package/src/schemas/create-dataset.ts +48 -0
- package/src/schemas/index.ts +1 -0
- package/src/tools/archive-suite.ts +12 -0
- package/src/tools/assign-prompt-tag.ts +16 -0
- package/src/tools/create-agent.ts +15 -0
- package/src/tools/create-annotation.ts +18 -0
- package/src/tools/create-dashboard.ts +7 -0
- package/src/tools/create-dataset-records.ts +23 -0
- package/src/tools/create-dataset.ts +22 -0
- package/src/tools/create-prompt-tag.ts +12 -0
- package/src/tools/create-prompt.ts +4 -0
- package/src/tools/create-suite.ts +42 -0
- package/src/tools/delete-agent.ts +7 -0
- package/src/tools/delete-annotation.ts +7 -0
- package/src/tools/delete-dashboard.ts +7 -0
- package/src/tools/delete-dataset-records.ts +22 -0
- package/src/tools/delete-dataset.ts +20 -0
- package/src/tools/delete-evaluator.ts +12 -0
- package/src/tools/delete-prompt-tag.ts +12 -0
- package/src/tools/delete-workflow.ts +7 -0
- package/src/tools/format-dataset-mutation.ts +25 -0
- package/src/tools/get-agent.ts +21 -0
- package/src/tools/get-analytics.ts +30 -3
- package/src/tools/get-dashboard.ts +22 -0
- package/src/tools/get-dataset.ts +63 -0
- package/src/tools/get-prompt.ts +2 -1
- package/src/tools/get-simulation-run.ts +60 -0
- package/src/tools/get-suite.ts +47 -0
- package/src/tools/get-workflow.ts +17 -0
- package/src/tools/list-agents.ts +27 -0
- package/src/tools/list-annotations.ts +33 -0
- package/src/tools/list-dashboards.ts +27 -0
- package/src/tools/list-dataset-records.ts +46 -0
- package/src/tools/list-datasets.ts +80 -0
- package/src/tools/list-prompt-tags.ts +21 -0
- package/src/tools/list-simulation-runs.ts +49 -0
- package/src/tools/list-suites.ts +43 -0
- package/src/tools/list-workflows.ts +31 -0
- package/src/tools/rename-prompt-tag.ts +14 -0
- package/src/tools/run-agent.ts +36 -0
- package/src/tools/run-evaluation.ts +87 -0
- package/src/tools/run-suite.ts +28 -0
- package/src/tools/run-workflow.ts +36 -0
- package/src/tools/update-agent.ts +13 -0
- package/src/tools/update-dataset-record.ts +21 -0
- package/src/tools/update-dataset.ts +23 -0
- package/src/tools/update-prompt.ts +3 -0
- package/src/tools/update-suite.ts +44 -0
- package/src/utils/escape-markdown.ts +12 -0
- package/tsup.config.ts +5 -1
- package/dist/chunk-AAQNA53E.js +0 -28
- package/dist/chunk-AAQNA53E.js.map +0 -1
- package/dist/chunk-LLRQIF52.js.map +0 -1
- package/dist/config-FIQWQRUB.js +0 -11
- package/dist/create-prompt-7Z35MIL6.js.map +0 -1
- package/dist/get-analytics-4YJW4S5L.js.map +0 -1
- package/dist/get-prompt-F6PDVC76.js.map +0 -1
- package/dist/update-prompt-IW7X2UQM.js.map +0 -1
- /package/dist/{archive-scenario-YFD5THOR.js.map → archive-scenario-WJ2A7ETN.js.map} +0 -0
- /package/dist/{chunk-6U4TCGFC.js.map → chunk-2GT7IFWK.js.map} +0 -0
- /package/dist/{chunk-IX6QJKAD.js.map → chunk-CCWCIJJ3.js.map} +0 -0
- /package/dist/{config-FIQWQRUB.js.map → config.js.map} +0 -0
- /package/dist/{create-evaluator-E5X5ZP3B.js.map → create-evaluator-WYFRFLRC.js.map} +0 -0
- /package/dist/{create-scenario-DIMPJRPY.js.map → create-scenario-6YHSMGLP.js.map} +0 -0
- /package/dist/{get-evaluator-WDEH2F7M.js.map → get-evaluator-UWVUPYTM.js.map} +0 -0
- /package/dist/{get-scenario-H24ZYNT5.js.map → get-scenario-Q6LCNUYN.js.map} +0 -0
- /package/dist/{get-trace-27USKGO7.js.map → get-trace-4EJAYVBG.js.map} +0 -0
- /package/dist/{list-evaluators-KRGI72EH.js.map → list-evaluators-7R2LB4JH.js.map} +0 -0
- /package/dist/{list-model-providers-A5YCFTPI.js.map → list-model-providers-OBYJCKBX.js.map} +0 -0
- /package/dist/{list-prompts-LKJSE7XN.js.map → list-prompts-VWEZ4CDE.js.map} +0 -0
- /package/dist/{list-scenarios-ZK5CMGC4.js.map → list-scenarios-TXD4W2ZJ.js.map} +0 -0
- /package/dist/{search-traces-SOKAAMAR.js.map → search-traces-VYFUIMXH.js.map} +0 -0
- /package/dist/{set-model-provider-7MGULZDH.js.map → set-model-provider-W5IUI326.js.map} +0 -0
- /package/dist/{update-evaluator-A3XINFLJ.js.map → update-evaluator-IVOR6FTR.js.map} +0 -0
- /package/dist/{update-scenario-ZT7TOBFR.js.map → update-scenario-GDFVILPN.js.map} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { makeRequest } from "./langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
// --- Suite types ---
|
|
4
|
+
|
|
5
|
+
export interface SuiteTarget {
|
|
6
|
+
type: "prompt" | "http" | "code" | "workflow";
|
|
7
|
+
referenceId: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SuiteSummary {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
scenarioIds: string[];
|
|
16
|
+
targets: SuiteTarget[];
|
|
17
|
+
repeatCount: number;
|
|
18
|
+
labels: string[];
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SuiteRunResult {
|
|
24
|
+
scheduled: boolean;
|
|
25
|
+
batchRunId: string;
|
|
26
|
+
setId: string;
|
|
27
|
+
jobCount: number;
|
|
28
|
+
skippedArchived: {
|
|
29
|
+
scenarios: string[];
|
|
30
|
+
targets: string[];
|
|
31
|
+
};
|
|
32
|
+
items: Array<{
|
|
33
|
+
scenarioRunId: string;
|
|
34
|
+
scenarioId: string;
|
|
35
|
+
target: SuiteTarget;
|
|
36
|
+
name: string | null;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SuiteArchiveResponse {
|
|
41
|
+
id: string;
|
|
42
|
+
archived: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// --- Suite API functions ---
|
|
46
|
+
|
|
47
|
+
/** Lists all suites (run plans) in the project. */
|
|
48
|
+
export async function listSuites(): Promise<SuiteSummary[]> {
|
|
49
|
+
return makeRequest("GET", "/api/suites") as Promise<SuiteSummary[]>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Retrieves a single suite by ID. */
|
|
53
|
+
export async function getSuite(id: string): Promise<SuiteSummary> {
|
|
54
|
+
return makeRequest(
|
|
55
|
+
"GET",
|
|
56
|
+
`/api/suites/${encodeURIComponent(id)}`
|
|
57
|
+
) as Promise<SuiteSummary>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Creates a new suite. */
|
|
61
|
+
export async function createSuite(data: {
|
|
62
|
+
name: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
scenarioIds: string[];
|
|
65
|
+
targets: SuiteTarget[];
|
|
66
|
+
repeatCount?: number;
|
|
67
|
+
labels?: string[];
|
|
68
|
+
}): Promise<SuiteSummary> {
|
|
69
|
+
return makeRequest("POST", "/api/suites", data) as Promise<SuiteSummary>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Updates an existing suite. */
|
|
73
|
+
export async function updateSuite(params: {
|
|
74
|
+
id: string;
|
|
75
|
+
name?: string;
|
|
76
|
+
description?: string | null;
|
|
77
|
+
scenarioIds?: string[];
|
|
78
|
+
targets?: SuiteTarget[];
|
|
79
|
+
repeatCount?: number;
|
|
80
|
+
labels?: string[];
|
|
81
|
+
}): Promise<SuiteSummary> {
|
|
82
|
+
const { id, ...data } = params;
|
|
83
|
+
return makeRequest(
|
|
84
|
+
"PATCH",
|
|
85
|
+
`/api/suites/${encodeURIComponent(id)}`,
|
|
86
|
+
data
|
|
87
|
+
) as Promise<SuiteSummary>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Duplicates a suite. */
|
|
91
|
+
export async function duplicateSuite(id: string): Promise<SuiteSummary> {
|
|
92
|
+
return makeRequest(
|
|
93
|
+
"POST",
|
|
94
|
+
`/api/suites/${encodeURIComponent(id)}/duplicate`
|
|
95
|
+
) as Promise<SuiteSummary>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Triggers a suite run. */
|
|
99
|
+
export async function runSuite(
|
|
100
|
+
id: string,
|
|
101
|
+
idempotencyKey?: string
|
|
102
|
+
): Promise<SuiteRunResult> {
|
|
103
|
+
return makeRequest(
|
|
104
|
+
"POST",
|
|
105
|
+
`/api/suites/${encodeURIComponent(id)}/run`,
|
|
106
|
+
{ idempotencyKey: idempotencyKey ?? `mcp-${Date.now()}-${Math.random().toString(36).slice(2)}` }
|
|
107
|
+
) as Promise<SuiteRunResult>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Archives (soft-deletes) a suite. */
|
|
111
|
+
export async function archiveSuite(
|
|
112
|
+
id: string
|
|
113
|
+
): Promise<SuiteArchiveResponse> {
|
|
114
|
+
return makeRequest(
|
|
115
|
+
"DELETE",
|
|
116
|
+
`/api/suites/${encodeURIComponent(id)}`
|
|
117
|
+
) as Promise<SuiteArchiveResponse>;
|
|
118
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { makeRequest } from "./langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
export interface TriggerSummary {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
action: string;
|
|
7
|
+
actionParams: Record<string, unknown>;
|
|
8
|
+
filters: Record<string, unknown>;
|
|
9
|
+
active: boolean;
|
|
10
|
+
message: string | null;
|
|
11
|
+
alertType: string | null;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function listTriggers(): Promise<TriggerSummary[]> {
|
|
17
|
+
return makeRequest("GET", "/api/triggers") as Promise<TriggerSummary[]>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function getTrigger(id: string): Promise<TriggerSummary> {
|
|
21
|
+
return makeRequest("GET", `/api/triggers/${encodeURIComponent(id)}`) as Promise<TriggerSummary>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function createTrigger(data: {
|
|
25
|
+
name: string;
|
|
26
|
+
action: string;
|
|
27
|
+
actionParams?: Record<string, unknown>;
|
|
28
|
+
filters?: Record<string, unknown>;
|
|
29
|
+
message?: string;
|
|
30
|
+
alertType?: string;
|
|
31
|
+
}): Promise<TriggerSummary> {
|
|
32
|
+
return makeRequest("POST", "/api/triggers", data) as Promise<TriggerSummary>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function updateTrigger(params: {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
active?: boolean;
|
|
39
|
+
message?: string | null;
|
|
40
|
+
alertType?: string | null;
|
|
41
|
+
}): Promise<TriggerSummary> {
|
|
42
|
+
const { id, ...data } = params;
|
|
43
|
+
return makeRequest("PATCH", `/api/triggers/${encodeURIComponent(id)}`, data) as Promise<TriggerSummary>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function deleteTrigger(id: string): Promise<{ id: string; deleted: boolean }> {
|
|
47
|
+
return makeRequest("DELETE", `/api/triggers/${encodeURIComponent(id)}`) as Promise<{ id: string; deleted: boolean }>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { makeRequest } from "./langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
export interface WorkflowSummary {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
icon: string | null;
|
|
7
|
+
description: string | null;
|
|
8
|
+
isEvaluator: boolean;
|
|
9
|
+
isComponent: boolean;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function listWorkflows(): Promise<WorkflowSummary[]> {
|
|
15
|
+
return makeRequest("GET", "/api/workflows") as Promise<WorkflowSummary[]>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function getWorkflow(id: string): Promise<WorkflowSummary> {
|
|
19
|
+
return makeRequest(
|
|
20
|
+
"GET",
|
|
21
|
+
`/api/workflows/${encodeURIComponent(id)}`,
|
|
22
|
+
) as Promise<WorkflowSummary>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function runWorkflow(
|
|
26
|
+
id: string,
|
|
27
|
+
input?: Record<string, unknown>
|
|
28
|
+
): Promise<Record<string, unknown>> {
|
|
29
|
+
return makeRequest(
|
|
30
|
+
"POST",
|
|
31
|
+
`/api/workflows/${encodeURIComponent(id)}/run`,
|
|
32
|
+
input ?? {},
|
|
33
|
+
) as Promise<Record<string, unknown>>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function deleteWorkflow(id: string): Promise<{ id: string; archived: boolean }> {
|
|
37
|
+
return makeRequest(
|
|
38
|
+
"DELETE",
|
|
39
|
+
`/api/workflows/${encodeURIComponent(id)}`,
|
|
40
|
+
) as Promise<{ id: string; archived: boolean }>;
|
|
41
|
+
}
|
package/src/langwatch-api.ts
CHANGED
|
@@ -140,6 +140,9 @@ export async function makeRequest(
|
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
if (response.status === 204 || response.headers?.get("content-length") === "0") {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
143
146
|
return response.json();
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -202,9 +205,12 @@ export async function listPrompts(): Promise<PromptSummary[]> {
|
|
|
202
205
|
/** Retrieves a single prompt by ID or handle. */
|
|
203
206
|
export async function getPrompt(
|
|
204
207
|
idOrHandle: string,
|
|
205
|
-
version?: number
|
|
208
|
+
options?: { version?: number; tag?: string }
|
|
206
209
|
): Promise<PromptDetailResponse> {
|
|
207
|
-
const
|
|
210
|
+
const params = new URLSearchParams();
|
|
211
|
+
if (options?.version != null) params.set("version", String(options.version));
|
|
212
|
+
if (options?.tag) params.set("tag", options.tag);
|
|
213
|
+
const query = params.toString() ? `?${params}` : "";
|
|
208
214
|
return makeRequest(
|
|
209
215
|
"GET",
|
|
210
216
|
`/api/prompts/${encodeURIComponent(idOrHandle)}${query}`
|
|
@@ -216,6 +222,7 @@ export async function createPrompt(data: {
|
|
|
216
222
|
handle: string;
|
|
217
223
|
messages: Array<{ role: string; content: string }>;
|
|
218
224
|
model: string;
|
|
225
|
+
tags?: string[];
|
|
219
226
|
}): Promise<PromptMutationResponse> {
|
|
220
227
|
return makeRequest(
|
|
221
228
|
"POST",
|
|
@@ -231,6 +238,7 @@ export async function updatePrompt(
|
|
|
231
238
|
messages?: Array<{ role: string; content: string }>;
|
|
232
239
|
model?: string;
|
|
233
240
|
commitMessage: string;
|
|
241
|
+
tags?: string[];
|
|
234
242
|
}
|
|
235
243
|
): Promise<PromptMutationResponse> {
|
|
236
244
|
return makeRequest(
|
|
@@ -239,3 +247,53 @@ export async function updatePrompt(
|
|
|
239
247
|
data
|
|
240
248
|
) as Promise<PromptMutationResponse>;
|
|
241
249
|
}
|
|
250
|
+
|
|
251
|
+
/** Assigns a tag to a specific prompt version. */
|
|
252
|
+
export async function assignPromptTag({
|
|
253
|
+
idOrHandle,
|
|
254
|
+
tag,
|
|
255
|
+
versionId,
|
|
256
|
+
}: {
|
|
257
|
+
idOrHandle: string;
|
|
258
|
+
tag: string;
|
|
259
|
+
versionId: string;
|
|
260
|
+
}): Promise<unknown> {
|
|
261
|
+
return makeRequest(
|
|
262
|
+
"PUT",
|
|
263
|
+
`/api/prompts/${encodeURIComponent(idOrHandle)}/tags/${encodeURIComponent(tag)}`,
|
|
264
|
+
{ versionId }
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Lists all prompt tag definitions for the organization. */
|
|
269
|
+
export async function listPromptTags(): Promise<unknown> {
|
|
270
|
+
return makeRequest("GET", "/api/prompts/tags");
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** Creates a custom prompt tag definition. */
|
|
274
|
+
export async function createPromptTag(name: string): Promise<unknown> {
|
|
275
|
+
return makeRequest("POST", "/api/prompts/tags", { name });
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Renames an existing prompt tag. */
|
|
279
|
+
export async function renamePromptTag({
|
|
280
|
+
tag,
|
|
281
|
+
name,
|
|
282
|
+
}: {
|
|
283
|
+
tag: string;
|
|
284
|
+
name: string;
|
|
285
|
+
}): Promise<unknown> {
|
|
286
|
+
return makeRequest(
|
|
287
|
+
"PUT",
|
|
288
|
+
`/api/prompts/tags/${encodeURIComponent(tag)}`,
|
|
289
|
+
{ name }
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Deletes a prompt tag and all its assignments. */
|
|
294
|
+
export async function deletePromptTag(tag: string): Promise<unknown> {
|
|
295
|
+
return makeRequest(
|
|
296
|
+
"DELETE",
|
|
297
|
+
`/api/prompts/tags/${encodeURIComponent(tag)}`
|
|
298
|
+
);
|
|
299
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* All supported dataset column types on the LangWatch platform.
|
|
5
|
+
*/
|
|
6
|
+
export const DATASET_COLUMN_TYPES = [
|
|
7
|
+
"string",
|
|
8
|
+
"boolean",
|
|
9
|
+
"number",
|
|
10
|
+
"date",
|
|
11
|
+
"list",
|
|
12
|
+
"json",
|
|
13
|
+
"spans",
|
|
14
|
+
"rag_contexts",
|
|
15
|
+
"chat_messages",
|
|
16
|
+
"annotations",
|
|
17
|
+
"evaluations",
|
|
18
|
+
"image",
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Zod schema for a single dataset column type value.
|
|
23
|
+
*/
|
|
24
|
+
export const datasetColumnTypeSchema = z.enum(DATASET_COLUMN_TYPES);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Zod schema for a dataset column definition (name + type).
|
|
28
|
+
*
|
|
29
|
+
* Shared between create and update tool registrations.
|
|
30
|
+
*/
|
|
31
|
+
export const datasetColumnDefinitionSchema = z.object({
|
|
32
|
+
name: z.string().describe("Column name"),
|
|
33
|
+
type: datasetColumnTypeSchema.describe("Column type"),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Zod schema for the platform_create_dataset MCP tool parameters.
|
|
38
|
+
*
|
|
39
|
+
* Extracted so it can be shared between the MCP tool registration
|
|
40
|
+
* (create-mcp-server.ts) and unit tests.
|
|
41
|
+
*/
|
|
42
|
+
export const createDatasetSchema = z.object({
|
|
43
|
+
name: z.string().min(1).describe("Dataset name"),
|
|
44
|
+
columnTypes: z
|
|
45
|
+
.array(datasetColumnDefinitionSchema)
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("Column definitions for the dataset"),
|
|
48
|
+
});
|
package/src/schemas/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { filterFields, type FilterFieldInfo } from "./filter-fields.js";
|
|
2
2
|
export { analyticsMetrics, type MetricInfo } from "./analytics-metrics.js";
|
|
3
3
|
export { analyticsGroups, type GroupByInfo } from "./analytics-groups.js";
|
|
4
|
+
export { createDatasetSchema } from "./create-dataset.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { archiveSuite as apiArchiveSuite } from "../langwatch-api-suites.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the platform_archive_suite MCP tool invocation.
|
|
5
|
+
*/
|
|
6
|
+
export async function handleArchiveSuite(params: {
|
|
7
|
+
id: string;
|
|
8
|
+
}): Promise<string> {
|
|
9
|
+
const result = await apiArchiveSuite(params.id);
|
|
10
|
+
|
|
11
|
+
return `Suite ${result.id} has been archived (soft-deleted).`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { assignPromptTag as apiAssignPromptTag } from "../langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
export async function handleAssignPromptTag(params: {
|
|
4
|
+
idOrHandle: string;
|
|
5
|
+
tag: string;
|
|
6
|
+
versionId: string;
|
|
7
|
+
}): Promise<string> {
|
|
8
|
+
await apiAssignPromptTag({ idOrHandle: params.idOrHandle, tag: params.tag, versionId: params.versionId });
|
|
9
|
+
|
|
10
|
+
const lines: string[] = [];
|
|
11
|
+
lines.push("Tag assigned successfully!\n");
|
|
12
|
+
lines.push(`**Prompt**: ${params.idOrHandle}`);
|
|
13
|
+
lines.push(`**Tag**: ${params.tag}`);
|
|
14
|
+
lines.push(`**Version ID**: ${params.versionId}`);
|
|
15
|
+
return lines.join("\n");
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createAgent as apiCreateAgent } from "../langwatch-api-agents.js";
|
|
2
|
+
|
|
3
|
+
export async function handleCreateAgent(params: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
config?: Record<string, unknown>;
|
|
7
|
+
}): Promise<string> {
|
|
8
|
+
const agent = await apiCreateAgent({
|
|
9
|
+
name: params.name,
|
|
10
|
+
type: params.type,
|
|
11
|
+
config: params.config ?? {},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return `Agent created successfully!\n\n**Name**: ${agent.name}\n**ID**: ${agent.id}\n**Type**: ${agent.type}`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createAnnotation as apiCreateAnnotation } from "../langwatch-api-annotations.js";
|
|
2
|
+
|
|
3
|
+
export async function handleCreateAnnotation(params: {
|
|
4
|
+
traceId: string;
|
|
5
|
+
comment?: string;
|
|
6
|
+
isThumbsUp?: boolean;
|
|
7
|
+
email?: string;
|
|
8
|
+
}): Promise<string> {
|
|
9
|
+
const annotation = await apiCreateAnnotation(params.traceId, {
|
|
10
|
+
comment: params.comment,
|
|
11
|
+
isThumbsUp: params.isThumbsUp,
|
|
12
|
+
email: params.email,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const rating = params.isThumbsUp === true ? " 👍" : params.isThumbsUp === false ? " 👎" : "";
|
|
16
|
+
|
|
17
|
+
return `Annotation created successfully!${rating}\n\n**ID**: ${annotation.id ?? "—"}\n**Trace ID**: ${params.traceId}${params.comment ? `\n**Comment**: ${params.comment}` : ""}`;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createDashboard as apiCreateDashboard } from "../langwatch-api-dashboards.js";
|
|
2
|
+
|
|
3
|
+
export async function handleCreateDashboard(params: { name: string }): Promise<string> {
|
|
4
|
+
const dashboard = await apiCreateDashboard({ name: params.name });
|
|
5
|
+
|
|
6
|
+
return `Dashboard created successfully!\n\n**Name**: ${dashboard.name}\n**ID**: ${dashboard.id}`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createDatasetRecords as apiCreateDatasetRecords } from "../langwatch-api-datasets.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the platform_create_dataset_records MCP tool invocation.
|
|
5
|
+
*
|
|
6
|
+
* Creates records in a dataset in batch and returns a confirmation
|
|
7
|
+
* with the count of records created.
|
|
8
|
+
*/
|
|
9
|
+
export async function handleCreateDatasetRecords(params: {
|
|
10
|
+
slugOrId: string;
|
|
11
|
+
entries: Record<string, unknown>[];
|
|
12
|
+
}): Promise<string> {
|
|
13
|
+
const result = await apiCreateDatasetRecords(params);
|
|
14
|
+
const count = Array.isArray(result.data) ? result.data.length : 0;
|
|
15
|
+
|
|
16
|
+
const lines: string[] = [];
|
|
17
|
+
lines.push(`${count} record(s) created successfully!\n`);
|
|
18
|
+
lines.push(
|
|
19
|
+
"> Use `platform_get_dataset` to see the updated dataset with all records.",
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return lines.join("\n");
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createDataset as apiCreateDataset } from "../langwatch-api-datasets.js";
|
|
2
|
+
import type { DatasetColumnType } from "../langwatch-api-datasets.js";
|
|
3
|
+
import { formatDatasetMutationDetails } from "./format-dataset-mutation.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Handles the platform_create_dataset MCP tool invocation.
|
|
7
|
+
*
|
|
8
|
+
* Creates a new dataset in the LangWatch project and returns a
|
|
9
|
+
* confirmation with the created dataset's details.
|
|
10
|
+
*/
|
|
11
|
+
export async function handleCreateDataset(params: {
|
|
12
|
+
name: string;
|
|
13
|
+
columnTypes?: DatasetColumnType[];
|
|
14
|
+
}): Promise<string> {
|
|
15
|
+
const result = await apiCreateDataset(params);
|
|
16
|
+
|
|
17
|
+
const lines: string[] = [];
|
|
18
|
+
lines.push("Dataset created successfully!\n");
|
|
19
|
+
lines.push(...formatDatasetMutationDetails(result));
|
|
20
|
+
|
|
21
|
+
return lines.join("\n");
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createPromptTag as apiCreatePromptTag } from "../langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
export async function handleCreatePromptTag(params: {
|
|
4
|
+
name: string;
|
|
5
|
+
}): Promise<string> {
|
|
6
|
+
await apiCreatePromptTag(params.name);
|
|
7
|
+
|
|
8
|
+
const lines: string[] = [];
|
|
9
|
+
lines.push("Tag created successfully!\n");
|
|
10
|
+
lines.push(`**Name**: ${params.name}`);
|
|
11
|
+
return lines.join("\n");
|
|
12
|
+
}
|
|
@@ -27,6 +27,7 @@ export async function handleCreatePrompt(params: {
|
|
|
27
27
|
handle?: string;
|
|
28
28
|
messages: Array<{ role: string; content: string }>;
|
|
29
29
|
model: string;
|
|
30
|
+
tags?: string[];
|
|
30
31
|
}): Promise<string> {
|
|
31
32
|
const handle = params.handle?.trim() || toHandle(params.name);
|
|
32
33
|
if (!handle || !HANDLE_PATTERN.test(handle)) {
|
|
@@ -39,6 +40,7 @@ export async function handleCreatePrompt(params: {
|
|
|
39
40
|
handle,
|
|
40
41
|
messages: params.messages,
|
|
41
42
|
model: params.model,
|
|
43
|
+
...(params.tags ? { tags: params.tags } : {}),
|
|
42
44
|
});
|
|
43
45
|
|
|
44
46
|
const lines: string[] = [];
|
|
@@ -49,6 +51,8 @@ export async function handleCreatePrompt(params: {
|
|
|
49
51
|
lines.push(`**Model**: ${params.model}`);
|
|
50
52
|
if (result.latestVersionNumber != null)
|
|
51
53
|
lines.push(`**Version**: v${result.latestVersionNumber}`);
|
|
54
|
+
if (params.tags && params.tags.length > 0)
|
|
55
|
+
lines.push(`**Tags**: ${params.tags.join(", ")}`);
|
|
52
56
|
|
|
53
57
|
return lines.join("\n");
|
|
54
58
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createSuite as apiCreateSuite } from "../langwatch-api-suites.js";
|
|
2
|
+
import type { SuiteTarget } from "../langwatch-api-suites.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Handles the platform_create_suite MCP tool invocation.
|
|
6
|
+
*/
|
|
7
|
+
export async function handleCreateSuite(params: {
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
scenarioIds: string[];
|
|
11
|
+
targets: string;
|
|
12
|
+
repeatCount?: number;
|
|
13
|
+
labels?: string[];
|
|
14
|
+
}): Promise<string> {
|
|
15
|
+
let parsedTargets: SuiteTarget[];
|
|
16
|
+
try {
|
|
17
|
+
parsedTargets = JSON.parse(params.targets) as SuiteTarget[];
|
|
18
|
+
} catch {
|
|
19
|
+
return "Error: `targets` must be a valid JSON array of objects with `type` and `referenceId` fields.\n\nExample: [{\"type\": \"http\", \"referenceId\": \"agent_abc123\"}]";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const suite = await apiCreateSuite({
|
|
23
|
+
name: params.name,
|
|
24
|
+
description: params.description,
|
|
25
|
+
scenarioIds: params.scenarioIds,
|
|
26
|
+
targets: parsedTargets,
|
|
27
|
+
repeatCount: params.repeatCount,
|
|
28
|
+
labels: params.labels,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return [
|
|
32
|
+
`Suite "${suite.name}" created successfully.`,
|
|
33
|
+
"",
|
|
34
|
+
`**ID**: ${suite.id}`,
|
|
35
|
+
`**Slug**: ${suite.slug}`,
|
|
36
|
+
`**Scenarios**: ${suite.scenarioIds.length}`,
|
|
37
|
+
`**Targets**: ${suite.targets.length}`,
|
|
38
|
+
`**Repeat**: ${suite.repeatCount}x`,
|
|
39
|
+
"",
|
|
40
|
+
`> Use \`platform_run_suite\` with ID \`${suite.id}\` to trigger execution.`,
|
|
41
|
+
].join("\n");
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { deleteAgent as apiDeleteAgent } from "../langwatch-api-agents.js";
|
|
2
|
+
|
|
3
|
+
export async function handleDeleteAgent(params: { id: string }): Promise<string> {
|
|
4
|
+
const result = await apiDeleteAgent(params.id);
|
|
5
|
+
|
|
6
|
+
return `Agent archived successfully!\n\n**Name**: ${result.name}\n**ID**: ${result.id}`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { deleteAnnotation as apiDeleteAnnotation } from "../langwatch-api-annotations.js";
|
|
2
|
+
|
|
3
|
+
export async function handleDeleteAnnotation(params: { id: string }): Promise<string> {
|
|
4
|
+
await apiDeleteAnnotation(params.id);
|
|
5
|
+
|
|
6
|
+
return `Annotation deleted successfully!\n\n**ID**: ${params.id}`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { deleteDashboard as apiDeleteDashboard } from "../langwatch-api-dashboards.js";
|
|
2
|
+
|
|
3
|
+
export async function handleDeleteDashboard(params: { id: string }): Promise<string> {
|
|
4
|
+
const result = await apiDeleteDashboard(params.id);
|
|
5
|
+
|
|
6
|
+
return `Dashboard deleted successfully!\n\n**Name**: ${result.name}\n**ID**: ${result.id}`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { deleteDatasetRecords as apiDeleteDatasetRecords } from "../langwatch-api-datasets.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the platform_delete_dataset_records MCP tool invocation.
|
|
5
|
+
*
|
|
6
|
+
* Deletes records from a dataset by IDs and returns confirmation
|
|
7
|
+
* with the count of records deleted.
|
|
8
|
+
*/
|
|
9
|
+
export async function handleDeleteDatasetRecords(params: {
|
|
10
|
+
slugOrId: string;
|
|
11
|
+
recordIds: string[];
|
|
12
|
+
}): Promise<string> {
|
|
13
|
+
const result = await apiDeleteDatasetRecords(params);
|
|
14
|
+
|
|
15
|
+
const lines: string[] = [];
|
|
16
|
+
lines.push(`${result.deletedCount} record(s) deleted successfully!\n`);
|
|
17
|
+
lines.push(
|
|
18
|
+
"> Use `platform_get_dataset` to see the updated dataset.",
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return lines.join("\n");
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { deleteDataset as apiDeleteDataset } from "../langwatch-api-datasets.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the platform_delete_dataset MCP tool invocation.
|
|
5
|
+
*
|
|
6
|
+
* Archives (soft-deletes) a dataset and returns confirmation.
|
|
7
|
+
*/
|
|
8
|
+
export async function handleDeleteDataset(params: {
|
|
9
|
+
slugOrId: string;
|
|
10
|
+
}): Promise<string> {
|
|
11
|
+
await apiDeleteDataset(params.slugOrId);
|
|
12
|
+
|
|
13
|
+
const lines: string[] = [];
|
|
14
|
+
lines.push("Dataset deleted successfully!\n");
|
|
15
|
+
lines.push(
|
|
16
|
+
"> The dataset has been archived and will no longer appear in listings.",
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return lines.join("\n");
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { deleteEvaluator as apiDeleteEvaluator } from "../langwatch-api-evaluators.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the platform_delete_evaluator MCP tool invocation.
|
|
5
|
+
*/
|
|
6
|
+
export async function handleDeleteEvaluator(params: {
|
|
7
|
+
idOrSlug: string;
|
|
8
|
+
}): Promise<string> {
|
|
9
|
+
const result = await apiDeleteEvaluator(params.idOrSlug);
|
|
10
|
+
|
|
11
|
+
return `Evaluator ${result.id} has been archived (soft-deleted).`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { deletePromptTag as apiDeletePromptTag } from "../langwatch-api.js";
|
|
2
|
+
|
|
3
|
+
export async function handleDeletePromptTag(params: {
|
|
4
|
+
tag: string;
|
|
5
|
+
}): Promise<string> {
|
|
6
|
+
await apiDeletePromptTag(params.tag);
|
|
7
|
+
|
|
8
|
+
const lines: string[] = [];
|
|
9
|
+
lines.push("Tag deleted successfully!\n");
|
|
10
|
+
lines.push(`**Tag**: ${params.tag}`);
|
|
11
|
+
return lines.join("\n");
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { deleteWorkflow as apiDeleteWorkflow } from "../langwatch-api-workflows.js";
|
|
2
|
+
|
|
3
|
+
export async function handleDeleteWorkflow(params: { id: string }): Promise<string> {
|
|
4
|
+
const result = await apiDeleteWorkflow(params.id);
|
|
5
|
+
|
|
6
|
+
return `Workflow archived successfully!\n\n**ID**: ${result.id}`;
|
|
7
|
+
}
|