@promptlayer/mcp-server 1.11.0 → 1.15.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/CLAUDE.md +3 -0
- package/README.md +57 -3
- package/build/client.d.ts +40 -21
- package/build/client.d.ts.map +1 -1
- package/build/client.js +47 -23
- package/build/client.js.map +1 -1
- package/build/handlers.d.ts.map +1 -1
- package/build/handlers.js +78 -23
- package/build/handlers.js.map +1 -1
- package/build/index.js +10 -5
- package/build/index.js.map +1 -1
- package/build/types.d.ts +2143 -749
- package/build/types.d.ts.map +1 -1
- package/build/types.js +588 -260
- package/build/types.js.map +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +10 -1
- package/build/utils.js.map +1 -1
- package/gcp/app.yaml +1 -1
- package/gcp/package-lock.json +12 -12
- package/gcp/package.json +5 -3
- package/gcp/src/index.ts +101 -37
- package/package.json +6 -4
- package/src/client.ts +47 -24
- package/src/handlers.ts +150 -50
- package/src/index.ts +10 -5
- package/src/types.ts +644 -307
- package/src/utils.ts +8 -1
package/src/client.ts
CHANGED
|
@@ -65,30 +65,46 @@ export class PromptLayerClient {
|
|
|
65
65
|
logRequest(body: Body) { return this.post("/log-request", body); }
|
|
66
66
|
createSpansBulk(body: Body) { return this.post("/spans-bulk", body); }
|
|
67
67
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
// Smart Tables
|
|
69
|
+
listSmartTables(params?: Body) { return this.get("/api/public/v2/tables", params); }
|
|
70
|
+
createSmartTable(body: Body) { return this.post("/api/public/v2/tables", body); }
|
|
71
|
+
getSmartTable(tableId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}`); }
|
|
72
|
+
updateSmartTable(tableId: string, body: Body) { return this.patch(`/api/public/v2/tables/${this.enc(tableId)}`, body); }
|
|
73
|
+
listSmartTableSheets(tableId: string, params?: Body) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets`, params); }
|
|
74
|
+
createSmartTableSheet(tableId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets`, body); }
|
|
75
|
+
getSmartTableSheet(tableId: string, sheetId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}`); }
|
|
76
|
+
updateSmartTableSheet(tableId: string, sheetId: string, body: Body) { return this.patch(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}`, body); }
|
|
77
|
+
getSmartTableSheetImportOperation(tableId: string, operationId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/operations/${this.enc(operationId)}`); }
|
|
78
|
+
importSmartTableSheetFile(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/imports/file`, body); }
|
|
79
|
+
importSmartTableSheetRequestLogs(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/imports/request-logs`, body); }
|
|
80
|
+
listSmartTableColumns(tableId: string, sheetId: string, params?: Body) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/columns`, params); }
|
|
81
|
+
createSmartTableColumn(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/columns`, body); }
|
|
82
|
+
updateSmartTableColumn(tableId: string, sheetId: string, columnId: string, body: Body) { return this.patch(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/columns/${this.enc(columnId)}`, body); }
|
|
83
|
+
listSmartTableRows(tableId: string, sheetId: string, params?: Body) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/rows`, params); }
|
|
84
|
+
addSmartTableRows(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/rows`, body); }
|
|
85
|
+
getSmartTableCell(tableId: string, sheetId: string, cellId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/cells/${this.enc(cellId)}`); }
|
|
86
|
+
updateSmartTableCell(tableId: string, sheetId: string, cellId: string, body: Body) { return this.patch(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/cells/${this.enc(cellId)}`, body); }
|
|
87
|
+
recalculateSmartTableCell(tableId: string, sheetId: string, cellId: string) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/cells/${this.enc(cellId)}/recalculate`); }
|
|
88
|
+
recalculateSmartTableCells(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/cells/recalculate`, body); }
|
|
89
|
+
listSmartTableOperations(tableId: string, sheetId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/operations`); }
|
|
90
|
+
createSmartTableOperation(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/operations`, body); }
|
|
91
|
+
getSmartTableOperation(tableId: string, sheetId: string, operationId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/operations/${this.enc(operationId)}`); }
|
|
92
|
+
cancelSmartTableOperation(tableId: string, sheetId: string, operationId: string) { return this.del(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/operations/${this.enc(operationId)}`); }
|
|
93
|
+
getSmartTableScore(tableId: string, sheetId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/score`); }
|
|
94
|
+
configureSmartTableScore(tableId: string, sheetId: string, body: Body) { return this.patch(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/score`, body); }
|
|
95
|
+
recalculateSmartTableScore(tableId: string, sheetId: string) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/score`); }
|
|
96
|
+
listSmartTableVersions(tableId: string, sheetId: string, params?: Body) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/versions`, params); }
|
|
97
|
+
getSmartTableVersion(tableId: string, sheetId: string, versionId: string) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/versions/${this.enc(versionId)}`); }
|
|
98
|
+
createSmartTableVersion(tableId: string, sheetId: string, body: Body) { return this.post(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/versions`, body); }
|
|
99
|
+
getSmartTableScoreHistory(tableId: string, sheetId: string, params?: Body) { return this.get(`/api/public/v2/tables/${this.enc(tableId)}/sheets/${this.enc(sheetId)}/versions/score-history`, params); }
|
|
100
|
+
listLegacySmartTableMigrations(params?: Body) {
|
|
101
|
+
const query = params ? { ...params } : undefined;
|
|
102
|
+
if (query && typeof query.source_id === "number") query.source_id = [query.source_id];
|
|
103
|
+
return this.get("/api/public/v2/tables/legacy-migrations", query);
|
|
104
|
+
}
|
|
105
|
+
previewLegacySmartTableMigration(params: Body) { return this.get("/api/public/v2/tables/legacy-migrations/preview", params); }
|
|
106
|
+
migrateLegacyToSmartTable(body: Body) { return this.post("/api/public/v2/tables/legacy-migrations", body); }
|
|
107
|
+
getLegacySmartTableMigrationJob(jobId: string) { return this.get(`/api/public/v2/tables/legacy-migrations/jobs/${this.enc(jobId)}`); }
|
|
92
108
|
|
|
93
109
|
// Agents
|
|
94
110
|
listWorkflows(params?: Body) { return this.get("/workflows", params); }
|
|
@@ -104,6 +120,13 @@ export class PromptLayerClient {
|
|
|
104
120
|
getToolRegistry(identifier: string, params?: Body) { return this.get(`/api/public/v2/tool-registry/${this.enc(identifier)}`, params); }
|
|
105
121
|
createToolRegistry(body: Body) { return this.post("/api/public/v2/tool-registry", body); }
|
|
106
122
|
createToolVersion(identifier: string, body: Body) { return this.post(`/api/public/v2/tool-registry/${this.enc(identifier)}/versions`, body); }
|
|
123
|
+
testExecuteToolRegistry(identifier: string, body: Body, query?: Body) { return this.post(`/api/public/v2/tool-registry/${this.enc(identifier)}/test-execute${buildQueryParams(query)}`, body); }
|
|
124
|
+
|
|
125
|
+
// Env Vars (workspace + tool scopes)
|
|
126
|
+
listWorkspaceEnvVars() { return this.get("/api/public/v2/env-vars"); }
|
|
127
|
+
createWorkspaceEnvVar(body: Body) { return this.post("/api/public/v2/env-vars", body); }
|
|
128
|
+
listToolEnvVars(identifier: string) { return this.get(`/api/public/v2/tool-registry/${this.enc(identifier)}/env-vars`); }
|
|
129
|
+
createToolEnvVar(identifier: string, body: Body) { return this.post(`/api/public/v2/tool-registry/${this.enc(identifier)}/env-vars`, body); }
|
|
107
130
|
|
|
108
131
|
// Folders
|
|
109
132
|
createFolder(body: Body) { return this.post("/api/public/v2/folders", body); }
|
package/src/handlers.ts
CHANGED
|
@@ -4,6 +4,11 @@ import { createToolHandler } from "./utils.js";
|
|
|
4
4
|
|
|
5
5
|
type Args = Record<string, unknown> & { api_key?: string };
|
|
6
6
|
function body(args: Args) { const { api_key: _, ...rest } = args; return rest; }
|
|
7
|
+
function omit(args: Args, ...keys: string[]) {
|
|
8
|
+
const rest = body(args);
|
|
9
|
+
for (const key of keys) delete rest[key];
|
|
10
|
+
return rest;
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
14
|
export function registerAllTools(server: any) {
|
|
@@ -69,56 +74,125 @@ export function registerAllTools(server: any) {
|
|
|
69
74
|
reg(t["create-spans-bulk"], (c, a) => c.createSpansBulk(body(a)),
|
|
70
75
|
(r) => `Created ${(r as { spans?: unknown[] }).spans?.length ?? 0} span(s)`);
|
|
71
76
|
|
|
72
|
-
//
|
|
73
|
-
reg(t["list-
|
|
74
|
-
(r) => {
|
|
75
|
-
reg(t["create-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
reg(t["
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
reg(t["list-
|
|
87
|
-
(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
(r) => {
|
|
116
|
-
reg(t["
|
|
117
|
-
(c, a) =>
|
|
118
|
-
() => "Column updated");
|
|
119
|
-
reg(t["
|
|
120
|
-
(c, a) => c.
|
|
121
|
-
() =>
|
|
77
|
+
// Smart Tables
|
|
78
|
+
reg(t["list-smart-tables"], (c, a) => c.listSmartTables(body(a)),
|
|
79
|
+
(r) => `${(r as { data?: unknown[] }).data?.length ?? 0} table(s)`);
|
|
80
|
+
reg(t["create-smart-table"], (c, a) => c.createSmartTable(body(a)),
|
|
81
|
+
(r) => {
|
|
82
|
+
const table = (r as { table?: { id?: string; title?: string } }).table;
|
|
83
|
+
return table?.id ? `Table "${table.title ?? ""}" created (${table.id})` : "Table created";
|
|
84
|
+
});
|
|
85
|
+
reg(t["get-smart-table"],
|
|
86
|
+
(c, a) => c.getSmartTable(a.table_id as string),
|
|
87
|
+
(r) => `Table "${(r as { table?: { title?: string } }).table?.title ?? ""}" retrieved`);
|
|
88
|
+
reg(t["update-smart-table"],
|
|
89
|
+
(c, a) => c.updateSmartTable(a.table_id as string, omit(a, "table_id")),
|
|
90
|
+
() => "Table updated");
|
|
91
|
+
reg(t["list-smart-table-sheets"],
|
|
92
|
+
(c, a) => c.listSmartTableSheets(a.table_id as string, omit(a, "table_id")),
|
|
93
|
+
(r) => `${(r as { data?: unknown[] }).data?.length ?? 0} sheet(s)`);
|
|
94
|
+
reg(t["create-smart-table-sheet"],
|
|
95
|
+
(c, a) => c.createSmartTableSheet(a.table_id as string, omit(a, "table_id")),
|
|
96
|
+
(r) => {
|
|
97
|
+
const op = (r as { operation_id?: string }).operation_id;
|
|
98
|
+
return op ? `Sheet import started (${op})` : "Sheet created";
|
|
99
|
+
});
|
|
100
|
+
reg(t["get-smart-table-sheet"],
|
|
101
|
+
(c, a) => c.getSmartTableSheet(a.table_id as string, a.sheet_id as string),
|
|
102
|
+
() => "Sheet retrieved");
|
|
103
|
+
reg(t["update-smart-table-sheet"],
|
|
104
|
+
(c, a) => c.updateSmartTableSheet(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
105
|
+
() => "Sheet updated");
|
|
106
|
+
reg(t["get-smart-table-sheet-import-operation"],
|
|
107
|
+
(c, a) => c.getSmartTableSheetImportOperation(a.table_id as string, a.operation_id as string),
|
|
108
|
+
(r) => `Import operation ${(r as { operation?: { status?: string } }).operation?.status ?? "retrieved"}`);
|
|
109
|
+
reg(t["import-smart-table-sheet-file"],
|
|
110
|
+
(c, a) => c.importSmartTableSheetFile(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
111
|
+
(r) => `File import started (${(r as { operation_id?: string }).operation_id ?? "operation queued"})`);
|
|
112
|
+
reg(t["import-smart-table-sheet-request-logs"],
|
|
113
|
+
(c, a) => c.importSmartTableSheetRequestLogs(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
114
|
+
(r) => `Request-log import started (${(r as { operation_id?: string }).operation_id ?? "operation queued"})`);
|
|
115
|
+
reg(t["list-smart-table-columns"],
|
|
116
|
+
(c, a) => c.listSmartTableColumns(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
117
|
+
(r) => `${(r as { data?: unknown[] }).data?.length ?? 0} column(s)`);
|
|
118
|
+
reg(t["create-smart-table-column"],
|
|
119
|
+
(c, a) => c.createSmartTableColumn(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
120
|
+
(r) => `Column created${(r as { column?: { id?: string } }).column?.id ? ` (${(r as { column?: { id?: string } }).column?.id})` : ""}`);
|
|
121
|
+
reg(t["update-smart-table-column"],
|
|
122
|
+
(c, a) => c.updateSmartTableColumn(a.table_id as string, a.sheet_id as string, a.column_id as string, omit(a, "table_id", "sheet_id", "column_id")),
|
|
123
|
+
(r) => (r as { requires_recalculation?: boolean }).requires_recalculation ? "Column updated; recalculation required" : "Column updated");
|
|
124
|
+
reg(t["list-smart-table-rows"],
|
|
125
|
+
(c, a) => c.listSmartTableRows(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
126
|
+
(r) => `${(r as { data?: unknown[] }).data?.length ?? 0} row(s)`);
|
|
127
|
+
reg(t["add-smart-table-rows"],
|
|
128
|
+
(c, a) => c.addSmartTableRows(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
129
|
+
(r) => `${(r as { rows?: unknown[]; data?: unknown[] }).rows?.length ?? (r as { data?: unknown[] }).data?.length ?? 0} row(s) added`);
|
|
130
|
+
reg(t["get-smart-table-cell"],
|
|
131
|
+
(c, a) => c.getSmartTableCell(a.table_id as string, a.sheet_id as string, a.cell_id as string),
|
|
132
|
+
() => "Cell retrieved");
|
|
133
|
+
reg(t["update-smart-table-cell"],
|
|
134
|
+
(c, a) => c.updateSmartTableCell(a.table_id as string, a.sheet_id as string, a.cell_id as string, omit(a, "table_id", "sheet_id", "cell_id")),
|
|
135
|
+
() => "Cell updated");
|
|
136
|
+
reg(t["recalculate-smart-table-cell"],
|
|
137
|
+
(c, a) => c.recalculateSmartTableCell(a.table_id as string, a.sheet_id as string, a.cell_id as string),
|
|
138
|
+
(r) => `${(r as { cell_count?: number }).cell_count ?? 0} cell(s) queued`);
|
|
139
|
+
reg(t["recalculate-smart-table-cells"],
|
|
140
|
+
(c, a) => c.recalculateSmartTableCells(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
141
|
+
(r) => `${(r as { cell_count?: number }).cell_count ?? 0} cell(s) queued`);
|
|
142
|
+
reg(t["list-smart-table-operations"],
|
|
143
|
+
(c, a) => c.listSmartTableOperations(a.table_id as string, a.sheet_id as string),
|
|
144
|
+
(r) => `${(r as { active_operations?: unknown[] }).active_operations?.length ?? 0} active operation(s)`);
|
|
145
|
+
reg(t["create-smart-table-operation"],
|
|
146
|
+
(c, a) => c.createSmartTableOperation(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
147
|
+
(r) => {
|
|
148
|
+
const op = (r as { operation_id?: string; cell_count?: number }).operation_id;
|
|
149
|
+
return op ? `Operation started (${op})` : `${(r as { cell_count?: number }).cell_count ?? 0} cell(s) affected`;
|
|
150
|
+
});
|
|
151
|
+
reg(t["get-smart-table-operation"],
|
|
152
|
+
(c, a) => c.getSmartTableOperation(a.table_id as string, a.sheet_id as string, a.operation_id as string),
|
|
153
|
+
(r) => `Operation ${(r as { operation?: { status?: string } }).operation?.status ?? "retrieved"}`);
|
|
154
|
+
reg(t["cancel-smart-table-operation"],
|
|
155
|
+
(c, a) => c.cancelSmartTableOperation(a.table_id as string, a.sheet_id as string, a.operation_id as string),
|
|
156
|
+
(r) => `${(r as { cancelled_cell_count?: number }).cancelled_cell_count ?? 0} cell(s) cancelled`);
|
|
157
|
+
reg(t["get-smart-table-score"],
|
|
158
|
+
(c, a) => c.getSmartTableScore(a.table_id as string, a.sheet_id as string),
|
|
159
|
+
(r) => `Score ${(r as { status?: string | null }).status ?? "retrieved"}`);
|
|
160
|
+
reg(t["configure-smart-table-score"],
|
|
161
|
+
(c, a) => c.configureSmartTableScore(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
162
|
+
() => "Score configured; recalculation required");
|
|
163
|
+
reg(t["recalculate-smart-table-score"],
|
|
164
|
+
(c, a) => c.recalculateSmartTableScore(a.table_id as string, a.sheet_id as string),
|
|
165
|
+
(r) => `Score recalculation ${(r as { status?: string }).status ?? "queued"}`);
|
|
166
|
+
reg(t["list-smart-table-versions"],
|
|
167
|
+
(c, a) => c.listSmartTableVersions(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
168
|
+
(r) => `${(r as { data?: unknown[] }).data?.length ?? 0} version(s)`);
|
|
169
|
+
reg(t["get-smart-table-version"],
|
|
170
|
+
(c, a) => c.getSmartTableVersion(a.table_id as string, a.sheet_id as string, a.version_id as string),
|
|
171
|
+
() => "Version retrieved");
|
|
172
|
+
reg(t["create-smart-table-version"],
|
|
173
|
+
(c, a) => c.createSmartTableVersion(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
174
|
+
(r) => `Version ${(r as { version?: { version_number?: number } }).version?.version_number ?? "created"}`);
|
|
175
|
+
reg(t["get-smart-table-score-history"],
|
|
176
|
+
(c, a) => c.getSmartTableScoreHistory(a.table_id as string, a.sheet_id as string, omit(a, "table_id", "sheet_id")),
|
|
177
|
+
(r) => `${(r as { score_history?: { returned_points?: number } }).score_history?.returned_points ?? 0} score point(s)`);
|
|
178
|
+
reg(t["list-legacy-smart-table-migrations"],
|
|
179
|
+
(c, a) => c.listLegacySmartTableMigrations(body(a)),
|
|
180
|
+
(r) => `${(r as { legacy_migrations?: unknown[] }).legacy_migrations?.length ?? 0} migration mapping(s)`);
|
|
181
|
+
reg(t["preview-legacy-smart-table-migration"],
|
|
182
|
+
(c, a) => c.previewLegacySmartTableMigration(body(a)),
|
|
183
|
+
(r) => {
|
|
184
|
+
const counts = (r as { estimated_counts?: { sheets?: number; columns?: number; cells?: number } }).estimated_counts;
|
|
185
|
+
return counts ? `Preview: ${counts.sheets ?? 0} sheet(s), ${counts.columns ?? 0} column(s), ${counts.cells ?? 0} cell(s)` : "Migration preview retrieved";
|
|
186
|
+
});
|
|
187
|
+
reg(t["migrate-legacy-to-smart-table"],
|
|
188
|
+
(c, a) => c.migrateLegacyToSmartTable(body(a)),
|
|
189
|
+
(r) => {
|
|
190
|
+
const job = (r as { job_id?: string; dry_run?: boolean }).job_id;
|
|
191
|
+
return (r as { dry_run?: boolean }).dry_run ? "Migration dry run complete" : `Migration queued${job ? ` (${job})` : ""}`;
|
|
192
|
+
});
|
|
193
|
+
reg(t["get-legacy-smart-table-migration-job"],
|
|
194
|
+
(c, a) => c.getLegacySmartTableMigrationJob(a.job_id as string),
|
|
195
|
+
(r) => `Migration job ${(r as { status?: string }).status ?? "retrieved"}`);
|
|
122
196
|
|
|
123
197
|
// Agents
|
|
124
198
|
reg(t["list-workflows"], (c, a) => c.listWorkflows(body(a)), () => "Agents listed");
|
|
@@ -150,6 +224,32 @@ export function registerAllTools(server: any) {
|
|
|
150
224
|
reg(t["create-tool-version"],
|
|
151
225
|
(c, a) => { const { api_key: _, identifier, ...b } = a as { identifier: string; api_key?: string } & Args; return c.createToolVersion(identifier, b); },
|
|
152
226
|
(r) => { const v = (r as { version?: { number?: number } }).version; return v ? `Version ${v.number} created` : "Version created"; });
|
|
227
|
+
reg(t["test-execute-tool-registry"],
|
|
228
|
+
(c, a) => {
|
|
229
|
+
const { api_key: _, identifier, label, version, ...rest } = a as { identifier: string; api_key?: string; label?: string; version?: number } & Args;
|
|
230
|
+
const query: Record<string, unknown> = {};
|
|
231
|
+
if (label !== undefined) query.label = label;
|
|
232
|
+
if (version !== undefined) query.version = version;
|
|
233
|
+
return c.testExecuteToolRegistry(identifier, rest, query);
|
|
234
|
+
},
|
|
235
|
+
(r) => {
|
|
236
|
+
const res = (r as { result?: { status?: string; duration_ms?: number; error?: { message?: string } } }).result;
|
|
237
|
+
if (!res) return "Tool executed";
|
|
238
|
+
if (res.status === "error") return `Tool failed: ${res.error?.message ?? "unknown error"}`;
|
|
239
|
+
return `Tool executed (${res.duration_ms ?? 0} ms)`;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Env Vars
|
|
243
|
+
reg(t["list-workspace-env-vars"], (c) => c.listWorkspaceEnvVars(),
|
|
244
|
+
(r) => { const v = (r as { workspace_env_vars?: unknown[] }).workspace_env_vars; return `${v?.length ?? 0} workspace env var(s)`; });
|
|
245
|
+
reg(t["create-workspace-env-var"], (c, a) => c.createWorkspaceEnvVar({ ...body(a), value: "" }),
|
|
246
|
+
(r) => { const v = (r as { workspace_env_var?: { key?: string; id?: number } }).workspace_env_var; return v ? `Workspace env var "${v.key}" scaffolded (ID: ${v.id}) — set the value in Settings` : "Workspace env var scaffolded"; });
|
|
247
|
+
reg(t["list-tool-env-vars"],
|
|
248
|
+
(c, a) => c.listToolEnvVars((a as { identifier: string }).identifier),
|
|
249
|
+
(r) => { const v = (r as { tool_env_vars?: unknown[] }).tool_env_vars; return `${v?.length ?? 0} tool env var(s)`; });
|
|
250
|
+
reg(t["create-tool-env-var"],
|
|
251
|
+
(c, a) => { const { api_key: _, identifier, ...b } = a as { identifier: string; api_key?: string } & Args; return c.createToolEnvVar(identifier, { ...b, value: "" }); },
|
|
252
|
+
(r) => { const v = (r as { tool_env_var?: { key?: string; id?: number } }).tool_env_var; return v ? `Tool env var "${v.key}" scaffolded (ID: ${v.id}) — set the value in Settings` : "Tool env var scaffolded"; });
|
|
153
253
|
|
|
154
254
|
// Folders
|
|
155
255
|
reg(t["create-folder"], (c, a) => c.createFolder(body(a)), () => "Folder created");
|
package/src/index.ts
CHANGED
|
@@ -13,9 +13,10 @@ PromptLayer is a prompt management and observability platform. This MCP server l
|
|
|
13
13
|
- **Snippet**: A reusable prompt fragment referenced inside prompt templates with @@@snippet_name@@@ markers. Snippets are themselves prompt templates (with type "completion"). When a prompt is fetched, snippets are expanded inline by default.
|
|
14
14
|
- **Release label**: A pointer (e.g. "prod", "staging") attached to a specific prompt version. Move labels between versions for deployment.
|
|
15
15
|
- **Agent** (backend name: workflow): A multi-step pipeline of nodes. Each node has a type, configuration, and dependencies. Agents are versioned like prompts.
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
16
|
+
- **Smart Table**: The primary workspace for test data, evaluation columns, request-log imports, execution, scoring, and version history.
|
|
17
|
+
- **Smart Table sheet**: A tab inside a Smart Table. Sheets contain rows, columns, cells, operations, score configuration, and saved versions.
|
|
18
|
+
- **Legacy dataset/evaluation**: Older dataset and report resources. Tools for these remain available for compatibility, but prefer Smart Tables for new work.
|
|
19
|
+
- **Folder**: Organizes prompts, agents, Smart Tables, and other entities into a hierarchy.
|
|
19
20
|
|
|
20
21
|
## Working with prompts and snippets
|
|
21
22
|
|
|
@@ -25,9 +26,13 @@ When publishing back, keep @@@snippet_name@@@ markers intact in the prompt_templ
|
|
|
25
26
|
|
|
26
27
|
Use get-prompt-template (the POST variant) only when you need a fully rendered prompt ready to send to an LLM, with input_variables filled in and provider-specific formatting applied.
|
|
27
28
|
|
|
28
|
-
## Working with
|
|
29
|
+
## Working with Smart Tables
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
For new dataset or evaluation-style workflows, use Smart Tables instead of legacy datasets and reports. A typical flow is: create-smart-table, add or import sheets, create columns, add rows or import request logs, run recalculation operations, configure sheet scoring, and save versions.
|
|
32
|
+
|
|
33
|
+
Use uppercase Smart Table column type values such as TEXT, PROMPT_TEMPLATE, LLM_ASSERTION, CODE_EXECUTION, and COMPOSITION. Direct cell edits are for text cells; computed cells should be recalculated with cell or sheet operation tools.
|
|
34
|
+
|
|
35
|
+
Use the legacy migration tools to preview or convert existing dataset groups, datasets, and reports into Smart Tables.
|
|
31
36
|
|
|
32
37
|
## Additional documentation
|
|
33
38
|
|