@promptlayer/mcp-server 1.13.0 → 1.16.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/README.md +56 -3
- package/build/client.d.ts +40 -22
- package/build/client.d.ts.map +1 -1
- package/build/client.js +47 -24
- package/build/client.js.map +1 -1
- package/build/handlers.d.ts.map +1 -1
- package/build/handlers.js +63 -24
- 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 +2261 -793
- package/build/types.d.ts.map +1 -1
- package/build/types.js +623 -269
- 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/src/index.ts +96 -38
- package/package.json +1 -1
- package/src/client.ts +47 -25
- package/src/handlers.ts +139 -52
- package/src/index.ts +10 -5
- package/src/types.ts +686 -318
- package/src/utils.ts +8 -1
package/build/types.js
CHANGED
|
@@ -162,33 +162,7 @@ export const CreateSpansBulkArgsSchema = z.object({
|
|
|
162
162
|
spans: z.array(z.record(z.unknown())).describe("Array of span objects (each with name, context, kind, start_time, end_time, status, attributes, resource; optional: parent_id, log_request)"),
|
|
163
163
|
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
164
164
|
});
|
|
165
|
-
// ──
|
|
166
|
-
export const ListDatasetsArgsSchema = z.object({
|
|
167
|
-
page: z.number().int().optional().describe("Page number (default: 1)"),
|
|
168
|
-
per_page: z.number().int().optional().describe("Items per page (default: 10)"),
|
|
169
|
-
name: z.string().optional().describe("Filter by dataset group name (case-insensitive partial match)"),
|
|
170
|
-
status: z.enum(["active", "deleted", "all"]).optional().describe("Filter by status (default: 'active')"),
|
|
171
|
-
dataset_group_id: z.number().int().optional().describe("Filter by dataset group ID"),
|
|
172
|
-
prompt_id: z.number().int().optional().describe("Filter by prompt ID"),
|
|
173
|
-
prompt_version_id: z.number().int().optional().describe("Filter by prompt version ID"),
|
|
174
|
-
prompt_label_id: z.number().int().optional().describe("Filter by prompt label ID"),
|
|
175
|
-
report_id: z.number().int().optional().describe("Filter by report ID"),
|
|
176
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
177
|
-
});
|
|
178
|
-
// ── Create Dataset Group (POST /api/public/v2/dataset-groups) ────────────
|
|
179
|
-
export const CreateDatasetGroupArgsSchema = z.object({
|
|
180
|
-
name: z.string().optional().describe("Dataset group name (unique within workspace). Auto-generated if omitted."),
|
|
181
|
-
folder_id: z.number().int().optional().describe("Folder ID to place the dataset group into"),
|
|
182
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
183
|
-
});
|
|
184
|
-
// ── Create Dataset Version from File (POST /api/public/v2/dataset-versions/from-file)
|
|
185
|
-
export const CreateDatasetVersionFromFileArgsSchema = z.object({
|
|
186
|
-
dataset_group_id: z.number().int().describe("Dataset group ID"),
|
|
187
|
-
file_name: z.string().describe("File name with extension (e.g. 'data.csv' or 'data.json')"),
|
|
188
|
-
file_content_base64: z.string().describe("Base64-encoded file content"),
|
|
189
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
190
|
-
});
|
|
191
|
-
// ── Structured filter primitives (shared by request search + dataset-from-history) ──
|
|
165
|
+
// ── Structured filter primitives (shared by request search + Smart Table imports) ──
|
|
192
166
|
// NOTE: value/filters use loose types (z.unknown()) because the backend validates
|
|
193
167
|
// operator-field compatibility at runtime. This is tracked as a known exception in
|
|
194
168
|
// scripts/diff-endpoints.ts.
|
|
@@ -218,152 +192,6 @@ const StructuredFilterGroupSchema = z.object({
|
|
|
218
192
|
logic: z.enum(["AND", "OR"]).optional().describe("Logical operator (default: AND)"),
|
|
219
193
|
filters: z.array(z.union([StructuredFilterSchema, z.lazy(() => StructuredFilterGroupSchema)])).describe("Filters or nested filter groups"),
|
|
220
194
|
});
|
|
221
|
-
// ── Create Dataset Version from Filter Params (POST /api/public/v2/dataset-versions/from-filter-params)
|
|
222
|
-
export const CreateDatasetVersionFromFilterParamsArgsSchema = z.object({
|
|
223
|
-
dataset_group_id: z.number().int().describe("Dataset group ID to create the new version under"),
|
|
224
|
-
request_log_ids: z.array(z.number().int().positive()).optional().describe("Static snapshot mode: pin the dataset to an explicit list of request log IDs (capped at 50,000). " +
|
|
225
|
-
"≤50 IDs run synchronously; >50 are processed asynchronously. " +
|
|
226
|
-
"Datasets created this way are not refreshable."),
|
|
227
|
-
filter_group: StructuredFilterGroupSchema.optional().describe("Structured filter mode: same shape as search-request-logs (AND/OR groups of field/operator/value filters). " +
|
|
228
|
-
"Always processed asynchronously. Persisted on the dataset so refresh_dataset can replay it."),
|
|
229
|
-
q: z.string().optional().describe("Free-text search query applied alongside filter_group"),
|
|
230
|
-
sort_by: z.enum([
|
|
231
|
-
"request_start_time", "input_tokens", "output_tokens", "cost",
|
|
232
|
-
"latency_ms", "status", "turn_count", "tool_call_count",
|
|
233
|
-
]).optional().describe("Sort field"),
|
|
234
|
-
sort_order: z.enum(["asc", "desc"]).optional().describe("Sort direction (defaults to desc when sort_by is set)"),
|
|
235
|
-
variables_to_parse: z.array(z.string()).optional().describe("Input variable names to extract as dataset columns"),
|
|
236
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
237
|
-
});
|
|
238
|
-
// ── Get Dataset Rows (GET /api/public/v2/datasets/{dataset_id}/rows) ─────
|
|
239
|
-
export const GetDatasetRowsArgsSchema = z.object({
|
|
240
|
-
dataset_id: z.number().int().describe("The ID of the dataset to retrieve rows from"),
|
|
241
|
-
page: z.number().int().optional().describe("Page number (default: 1)"),
|
|
242
|
-
per_page: z.number().int().optional().describe("Rows per page (default: 10, max: 100)"),
|
|
243
|
-
q: z.string().optional().describe("Search query for filtering rows"),
|
|
244
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
245
|
-
});
|
|
246
|
-
// ── Create Draft Dataset Version (POST /api/public/v2/dataset-versions/create-draft) ─────
|
|
247
|
-
export const CreateDraftDatasetVersionArgsSchema = z.object({
|
|
248
|
-
dataset_group_id: z.number().int().describe("ID of the dataset group to create a draft version for"),
|
|
249
|
-
source_dataset_id: z.number().int().optional().describe("Optional ID of an existing dataset version to copy rows from. Must belong to the same dataset group."),
|
|
250
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
251
|
-
});
|
|
252
|
-
// ── Add Request Log to Draft Dataset (POST /api/public/v2/dataset-versions/add-request-log) ─────
|
|
253
|
-
export const AddRequestLogToDatasetVersionArgsSchema = z.object({
|
|
254
|
-
dataset_group_id: z.number().int().describe("ID of the dataset group containing the draft"),
|
|
255
|
-
request_log_id: z.number().int().describe("ID of the request log to add as a dataset row"),
|
|
256
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
257
|
-
});
|
|
258
|
-
// ── Save Draft Dataset Version (POST /api/public/v2/dataset-versions/save-draft) ─────
|
|
259
|
-
export const SaveDraftDatasetVersionArgsSchema = z.object({
|
|
260
|
-
dataset_group_id: z.number().int().describe("ID of the dataset group containing the draft to save"),
|
|
261
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
262
|
-
});
|
|
263
|
-
// ── Add Trace to Draft Dataset (POST /api/public/v2/dataset-versions/add-trace) ─────
|
|
264
|
-
export const AddTraceToDatasetVersionArgsSchema = z.object({
|
|
265
|
-
dataset_group_id: z.number().int().min(1).describe("ID of the dataset group containing the draft"),
|
|
266
|
-
trace_id: z.string().min(1).describe("ID of the trace to add as a dataset row"),
|
|
267
|
-
span_id: z.string().min(1).optional().describe("Optional span ID to anchor the row on a specific span subtree instead of the full trace"),
|
|
268
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
269
|
-
});
|
|
270
|
-
// ── List Evaluations (GET /api/public/v2/evaluations) ────────────────────
|
|
271
|
-
export const ListEvaluationsArgsSchema = z.object({
|
|
272
|
-
page: z.number().int().optional().describe("Page number (default: 1)"),
|
|
273
|
-
per_page: z.number().int().optional().describe("Items per page (default: 10)"),
|
|
274
|
-
name: z.string().optional().describe("Filter by name (case-insensitive partial match)"),
|
|
275
|
-
status: z.enum(["active", "deleted", "all"]).optional().describe("Filter by status (default: 'active')"),
|
|
276
|
-
include_runs: z.boolean().optional().describe("If true, include batch runs nested under each evaluation with status and cell status counts (default: false)"),
|
|
277
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
278
|
-
});
|
|
279
|
-
// ── Get Evaluation Rows (GET /api/public/v2/evaluations/{evaluation_id}/rows)
|
|
280
|
-
export const GetEvaluationRowsArgsSchema = z.object({
|
|
281
|
-
evaluation_id: z.number().int().describe("The ID of the evaluation to retrieve rows from"),
|
|
282
|
-
page: z.number().int().optional().describe("Page number (default: 1)"),
|
|
283
|
-
per_page: z.number().int().optional().describe("Rows per page (default: 10, max: 100)"),
|
|
284
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
285
|
-
});
|
|
286
|
-
// ── Create Evaluation Pipeline / Report (POST /reports) ──────────────────
|
|
287
|
-
export const CreateReportArgsSchema = z.object({
|
|
288
|
-
dataset_group_id: z.number().int().describe("Dataset group ID"),
|
|
289
|
-
name: z.string().optional().describe("Pipeline name (auto-generated if omitted)"),
|
|
290
|
-
folder_id: z.number().int().optional().describe("Folder ID for organization"),
|
|
291
|
-
dataset_version_number: z.number().int().optional().describe("Dataset version (uses latest if omitted)"),
|
|
292
|
-
columns: z.array(z.record(z.unknown())).optional().describe("Evaluation columns (each: column_type, name, configuration)"),
|
|
293
|
-
score_configuration: z.record(z.unknown()).optional().describe("Custom scoring logic configuration"),
|
|
294
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
295
|
-
});
|
|
296
|
-
// ── Run Evaluation (POST /reports/{report_id}/run) ───────────────────────
|
|
297
|
-
export const RunReportArgsSchema = z.object({
|
|
298
|
-
report_id: z.number().int().describe("Evaluation pipeline ID"),
|
|
299
|
-
name: z.string().describe("Name for this evaluation run"),
|
|
300
|
-
dataset_id: z.number().int().optional().describe("Override dataset ID"),
|
|
301
|
-
refresh_dataset: z.boolean().optional().describe("Refresh the dataset before running"),
|
|
302
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
303
|
-
});
|
|
304
|
-
// ── Get Evaluation (GET /reports/{report_id}) ────────────────────────────
|
|
305
|
-
export const GetReportArgsSchema = z.object({
|
|
306
|
-
report_id: z.number().int().describe("Evaluation pipeline ID"),
|
|
307
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
308
|
-
});
|
|
309
|
-
// ── Get Evaluation Score (GET /reports/{report_id}/score) ────────────────
|
|
310
|
-
export const GetReportScoreArgsSchema = z.object({
|
|
311
|
-
report_id: z.number().int().describe("Evaluation pipeline ID"),
|
|
312
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
313
|
-
});
|
|
314
|
-
// ── Configure Custom Scoring (PATCH /reports/{report_id}/score-card) ─────
|
|
315
|
-
// NOTE: This endpoint is in the PromptLayer reference docs but NOT in the
|
|
316
|
-
// OpenAPI spec. Tracked as a known exception in scripts/diff-endpoints.ts.
|
|
317
|
-
// See: https://docs.promptlayer.com/reference/update-report-score-card
|
|
318
|
-
export const UpdateReportScoreCardArgsSchema = z.object({
|
|
319
|
-
report_id: z.number().int().describe("Evaluation pipeline ID"),
|
|
320
|
-
column_names: z.array(z.string()).describe("Column names to include in score"),
|
|
321
|
-
code: z.string().optional().describe("Custom Python/JavaScript code for score calculation"),
|
|
322
|
-
code_language: z.enum(["PYTHON", "JAVASCRIPT"]).optional().describe("Code language (default: PYTHON)"),
|
|
323
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
324
|
-
});
|
|
325
|
-
// ── Delete Reports by Name (DELETE /reports/name/{report_name}) ──────────
|
|
326
|
-
export const DeleteReportsByNameArgsSchema = z.object({
|
|
327
|
-
report_name: z.string().describe("Name of reports to archive"),
|
|
328
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
329
|
-
});
|
|
330
|
-
// ── Delete Report by ID (DELETE /reports/{report_id}) ────────────────────
|
|
331
|
-
export const DeleteReportArgsSchema = z.object({
|
|
332
|
-
report_id: z.number().int().describe("Evaluation pipeline ID to archive"),
|
|
333
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
334
|
-
});
|
|
335
|
-
// ── Rename Report (PATCH /reports/{report_id}/rename) ────────────────────
|
|
336
|
-
export const RenameReportArgsSchema = z.object({
|
|
337
|
-
report_id: z.number().int().describe("Evaluation pipeline ID to rename"),
|
|
338
|
-
name: z.string().min(1).max(255).optional().describe("New name for the evaluation pipeline. Provide name, tags, or both."),
|
|
339
|
-
tags: z.array(z.string()).optional().describe("Replace the pipeline's tags. Pass an empty array to clear them. Provide name, tags, or both."),
|
|
340
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
341
|
-
});
|
|
342
|
-
// ── Add Report Column (POST /report-columns) ─────────────────────────────
|
|
343
|
-
export const AddReportColumnArgsSchema = z.object({
|
|
344
|
-
report_id: z.number().int().describe("Evaluation pipeline ID to add the column to"),
|
|
345
|
-
column_type: z.string().describe("Column type (e.g. LLM_ASSERTION, CODE_EXECUTION, PROMPT_TEMPLATE). See https://docs.promptlayer.com/features/evaluations/column-types"),
|
|
346
|
-
name: z.string().min(1).describe("Unique column name within the pipeline"),
|
|
347
|
-
configuration: z.record(z.unknown()).describe("Column-type-specific configuration"),
|
|
348
|
-
position: z.number().int().positive().optional().describe("Position in the pipeline (auto-assigned if omitted). Cannot overwrite dataset columns."),
|
|
349
|
-
is_part_of_score: z.boolean().optional().describe("Whether this column contributes to the score (default false)"),
|
|
350
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
351
|
-
});
|
|
352
|
-
// ── Edit Report Column (PATCH /report-columns/{report_column_id}) ────────
|
|
353
|
-
export const EditReportColumnArgsSchema = z.object({
|
|
354
|
-
report_column_id: z.number().int().describe("Report column ID to edit"),
|
|
355
|
-
report_id: z.number().int().describe("Parent evaluation pipeline ID (must match the column's report)"),
|
|
356
|
-
column_type: z.string().describe("Column type (e.g. LLM_ASSERTION, CODE_EXECUTION, PROMPT_TEMPLATE). DATASET is not allowed."),
|
|
357
|
-
configuration: z.record(z.unknown()).optional().describe("Replacement column configuration"),
|
|
358
|
-
name: z.string().min(1).optional().describe("New column name (must be unique within the pipeline)"),
|
|
359
|
-
position: z.number().int().positive().optional().describe("New position. Cannot overwrite dataset columns."),
|
|
360
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
361
|
-
});
|
|
362
|
-
// ── Delete Report Column (DELETE /report-columns/{report_column_id}) ─────
|
|
363
|
-
export const DeleteReportColumnArgsSchema = z.object({
|
|
364
|
-
report_column_id: z.number().int().describe("Report column ID to delete. Cannot be a DATASET column."),
|
|
365
|
-
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
366
|
-
});
|
|
367
195
|
// ── List Agents (GET /workflows) ─────────────────────────────────────────
|
|
368
196
|
export const ListWorkflowsArgsSchema = z.object({
|
|
369
197
|
page: z.number().int().optional().describe("Page number (default: 1)"),
|
|
@@ -467,6 +295,23 @@ export const TestExecuteToolRegistryArgsSchema = z.object({
|
|
|
467
295
|
version: z.number().int().optional().describe("Resolve by specific version number"),
|
|
468
296
|
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
469
297
|
});
|
|
298
|
+
// ── Env Vars ─────────────────────────────────────────────────────────────
|
|
299
|
+
export const ListWorkspaceEnvVarsArgsSchema = z.object({
|
|
300
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
301
|
+
});
|
|
302
|
+
export const CreateWorkspaceEnvVarArgsSchema = z.object({
|
|
303
|
+
key: z.string().describe("Env var name. Must match ^[A-Za-z_][A-Za-z0-9_]*$ and not be a reserved runtime name (PATH, LD_PRELOAD, PYTHONSTARTUP, NODE_OPTIONS, etc.)"),
|
|
304
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
305
|
+
});
|
|
306
|
+
export const ListToolEnvVarsArgsSchema = z.object({
|
|
307
|
+
identifier: z.string().describe("Tool ID (numeric) or name"),
|
|
308
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
309
|
+
});
|
|
310
|
+
export const CreateToolEnvVarArgsSchema = z.object({
|
|
311
|
+
identifier: z.string().describe("Tool ID (numeric) or name"),
|
|
312
|
+
key: z.string().describe("Env var name. Must match ^[A-Za-z_][A-Za-z0-9_]*$ and not be a reserved runtime name."),
|
|
313
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
314
|
+
});
|
|
470
315
|
export const CreateFolderArgsSchema = z.object({
|
|
471
316
|
name: z.string().describe("Folder name (unique within parent)"),
|
|
472
317
|
parent_id: z.number().int().optional().describe("Parent folder ID (root if omitted)"),
|
|
@@ -622,6 +467,53 @@ export const GetRequestAnalyticsArgsSchema = z.object({
|
|
|
622
467
|
...RequestLogQueryShape,
|
|
623
468
|
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
624
469
|
});
|
|
470
|
+
// ── Get Request Analytics Custom Analytics (POST /api/public/v2/requests/analytics/custom-analytics) ──
|
|
471
|
+
const METRIC_FIELD_VALUES = [
|
|
472
|
+
"input_tokens", "output_tokens", "cost", "latency_ms", "prompt_version_number",
|
|
473
|
+
"turn_count", "tool_call_count", "cached_tokens", "thinking_tokens",
|
|
474
|
+
];
|
|
475
|
+
const GROUP_BY_FIELD_VALUES = [
|
|
476
|
+
"engine", "provider_type", "prompt_id", "prompt_version_number", "status",
|
|
477
|
+
"error_type", "tags", "metadata_keys", "output_keys", "input_variable_keys", "tool_names",
|
|
478
|
+
];
|
|
479
|
+
const CustomChartSeriesSpecSchema = z.object({
|
|
480
|
+
key: z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/).describe("Unique series key within the chart"),
|
|
481
|
+
label: z.string().min(1).max(120).describe("Human-readable series label"),
|
|
482
|
+
metric: z.enum(["sum", "avg", "min", "max", "percentile"]).describe("Aggregation function"),
|
|
483
|
+
metricField: z.enum(METRIC_FIELD_VALUES).describe("Numeric field to aggregate"),
|
|
484
|
+
percentile: z.number().min(0).max(100).optional().describe("Required when metric is percentile (0–100)"),
|
|
485
|
+
});
|
|
486
|
+
const DerivedRatioInsightSchema = z.object({
|
|
487
|
+
label: z.string().min(1).max(200).describe("Display label for this insight"),
|
|
488
|
+
numeratorSeriesKey: z.string().describe("Key of the numerator series"),
|
|
489
|
+
denominatorSeriesKey: z.string().describe("Key of the denominator series"),
|
|
490
|
+
});
|
|
491
|
+
const CustomChartSpecSchema = z.object({
|
|
492
|
+
id: z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/).describe("Stable chart id (unique within the request)"),
|
|
493
|
+
title: z.string().max(200).optional().describe("Optional display title; defaults to id"),
|
|
494
|
+
chartType: z.enum(["bar", "line", "area"]).describe("Chart type. Overall aggregates (no timeSeries, no groupBy) must use bar"),
|
|
495
|
+
metric: z.enum(["count", "sum", "avg", "min", "max", "percentile"]).optional()
|
|
496
|
+
.describe("Aggregation function. Omit when using series (multi-series mode)"),
|
|
497
|
+
metricField: z.enum(METRIC_FIELD_VALUES).optional()
|
|
498
|
+
.describe("Numeric field to aggregate. Required unless metric is count or using series"),
|
|
499
|
+
percentile: z.number().min(0).max(100).optional().describe("Required when metric is percentile"),
|
|
500
|
+
series: z.array(CustomChartSeriesSpecSchema).min(2).optional()
|
|
501
|
+
.describe("Multi-series mode: two or more series specs. Omit metric/metricField when using this"),
|
|
502
|
+
derivedInsights: z.array(DerivedRatioInsightSchema).optional()
|
|
503
|
+
.describe("Ratio insights computed from series totals. Multi-series only"),
|
|
504
|
+
groupByField: z.enum(GROUP_BY_FIELD_VALUES).optional()
|
|
505
|
+
.describe("Break down by this request log field. Cannot be combined with groupByMetadataKey"),
|
|
506
|
+
groupByMetadataKey: z.string().min(1).max(120).optional()
|
|
507
|
+
.describe("Break down by values of this metadata key. Cannot be combined with groupByField"),
|
|
508
|
+
timeSeries: z.boolean().optional().describe("Bucket results over time when true"),
|
|
509
|
+
limit: z.number().int().min(1).max(100).optional().describe("Max group-by buckets to return (default 25)"),
|
|
510
|
+
});
|
|
511
|
+
export const GetRequestAnalyticsCustomAnalyticsArgsSchema = z.object({
|
|
512
|
+
...RequestLogQueryShape,
|
|
513
|
+
customCharts: z.array(CustomChartSpecSchema).min(1)
|
|
514
|
+
.describe("One or more analytics queries to compute. IDs must be unique within the request"),
|
|
515
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
516
|
+
});
|
|
625
517
|
// ── Get Request (GET /api/public/v2/requests/{request_id}) ───────────────
|
|
626
518
|
export const GetRequestArgsSchema = z.object({
|
|
627
519
|
request_id: z.number().int().describe("Request ID to retrieve"),
|
|
@@ -646,6 +538,325 @@ export const GetRequestSearchSuggestionsArgsSchema = z.object({
|
|
|
646
538
|
filter_group: z.string().optional().describe("JSON-encoded filter group to scope suggestions to matching requests"),
|
|
647
539
|
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
648
540
|
});
|
|
541
|
+
// ── Smart Tables (public v2) ────────────────────────────────────────────
|
|
542
|
+
const UuidSchema = z.string().uuid();
|
|
543
|
+
const CursorPaginationShape = {
|
|
544
|
+
cursor: z.string().optional().describe("Pagination cursor from a previous response"),
|
|
545
|
+
limit: z.number().int().min(1).max(100).optional().describe("Items per page (1-100)"),
|
|
546
|
+
};
|
|
547
|
+
const SmartTablePromptFilterShape = {
|
|
548
|
+
prompt_id: z.number().int().positive().optional().describe("Filter to tables/sheets that reference this prompt"),
|
|
549
|
+
prompt_version_id: z.number().int().positive().optional().describe("Filter to tables/sheets that reference this prompt version"),
|
|
550
|
+
prompt_label_id: z.number().int().positive().optional().describe("Filter to tables/sheets that reference this prompt label"),
|
|
551
|
+
};
|
|
552
|
+
const SmartTableColumnTypeSchema = z.enum([
|
|
553
|
+
"TEXT",
|
|
554
|
+
"ABSOLUTE_NUMERIC_DISTANCE",
|
|
555
|
+
"AI_DATA_EXTRACTION",
|
|
556
|
+
"APPLY_DIFF",
|
|
557
|
+
"ASSERT_VALID",
|
|
558
|
+
"COALESCE",
|
|
559
|
+
"CONDITION",
|
|
560
|
+
"CODE_EXECUTION",
|
|
561
|
+
"COMBINE_COLUMNS",
|
|
562
|
+
"COMPARE",
|
|
563
|
+
"COMPOSITION",
|
|
564
|
+
"CONTAINS",
|
|
565
|
+
"CONVERSATION_SIMULATOR",
|
|
566
|
+
"COSINE_SIMILARITY",
|
|
567
|
+
"COUNT",
|
|
568
|
+
"DATASET",
|
|
569
|
+
"ENDPOINT",
|
|
570
|
+
"FOR_LOOP",
|
|
571
|
+
"HUMAN",
|
|
572
|
+
"JSON_PATH",
|
|
573
|
+
"LLM_ASSERTION",
|
|
574
|
+
"MATH_OPERATOR",
|
|
575
|
+
"MCP",
|
|
576
|
+
"MIN_MAX",
|
|
577
|
+
"PARSE_VALUE",
|
|
578
|
+
"PROMPT_TEMPLATE",
|
|
579
|
+
"REGEX",
|
|
580
|
+
"REGEX_EXTRACTION",
|
|
581
|
+
"VARIABLE",
|
|
582
|
+
"WHILE_LOOP",
|
|
583
|
+
"WORKFLOW",
|
|
584
|
+
"XML_PATH",
|
|
585
|
+
]).describe("Smart Table column type. Use uppercase backend enum values.");
|
|
586
|
+
const SmartCellStatusSchema = z.enum(["STALE", "QUEUED", "DISPATCHED", "RUNNING", "COMPLETED", "FAILED"]);
|
|
587
|
+
const SmartTableColumnDependencySchema = z.object({
|
|
588
|
+
column_id: UuidSchema.describe("Source column UUID"),
|
|
589
|
+
reference_type: z.string().optional().describe("Dependency reference type, usually 'value'"),
|
|
590
|
+
config_key: z.string().optional().describe("Optional config key this dependency feeds"),
|
|
591
|
+
config_meta: z.record(z.unknown()).optional().describe("Optional dependency metadata"),
|
|
592
|
+
});
|
|
593
|
+
const SmartTableRequestLogImportBaseShape = {
|
|
594
|
+
request_log_ids: z.array(z.number().int().positive()).optional().describe("Explicit request log IDs to import"),
|
|
595
|
+
filter_group: StructuredFilterGroupSchema.optional().describe("Structured request log filters. Provide this or request_log_ids."),
|
|
596
|
+
q: z.string().optional().describe("Free-text request log search applied with filter_group"),
|
|
597
|
+
sort_by: z.string().optional().describe("Request log sort field"),
|
|
598
|
+
sort_order: z.enum(["asc", "desc"]).optional().describe("Request log sort direction"),
|
|
599
|
+
metadata_cost_breakdown_key: z.string().optional().describe("Optional metadata key used for cost breakdown filtering"),
|
|
600
|
+
variables_to_parse: z.array(z.string()).optional().describe("Input variable names to extract as columns"),
|
|
601
|
+
include_fields: z.array(z.string()).optional().describe("Additional request fields to include as imported columns"),
|
|
602
|
+
limit: z.number().int().positive().optional().describe("Maximum number of matching request logs to import"),
|
|
603
|
+
};
|
|
604
|
+
const SmartTableSheetFileSourceSchema = z.object({
|
|
605
|
+
type: z.literal("file"),
|
|
606
|
+
file_name: z.string().min(1).max(255).describe("CSV or JSON file name for a new sheet import"),
|
|
607
|
+
file_content_base64: z.string().min(1).describe("Base64-encoded file content"),
|
|
608
|
+
});
|
|
609
|
+
const SmartTableSheetRequestLogsSourceSchema = z.object({
|
|
610
|
+
type: z.literal("request_logs"),
|
|
611
|
+
...SmartTableRequestLogImportBaseShape,
|
|
612
|
+
});
|
|
613
|
+
export const ListSmartTablesArgsSchema = z.object({
|
|
614
|
+
folder_id: z.number().int().positive().optional().describe("Filter by folder ID"),
|
|
615
|
+
name: z.string().optional().describe("Filter by table title"),
|
|
616
|
+
...CursorPaginationShape,
|
|
617
|
+
sort: z.enum(["created_at"]).optional().describe("Sort field (default: created_at)"),
|
|
618
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
|
|
619
|
+
...SmartTablePromptFilterShape,
|
|
620
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
621
|
+
});
|
|
622
|
+
export const CreateSmartTableArgsSchema = z.object({
|
|
623
|
+
title: z.string().min(1).max(255).optional().describe("Table title. Omit for an auto-generated Untitled Table name."),
|
|
624
|
+
folder_id: z.number().int().positive().optional().describe("Folder ID to place the table into"),
|
|
625
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
626
|
+
});
|
|
627
|
+
export const GetSmartTableArgsSchema = z.object({
|
|
628
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
629
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
630
|
+
});
|
|
631
|
+
export const UpdateSmartTableArgsSchema = z.object({
|
|
632
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
633
|
+
title: z.string().min(1).max(255).optional().describe("New table title"),
|
|
634
|
+
folder_id: z.number().int().positive().optional().describe("Folder ID, or omit to leave unchanged"),
|
|
635
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
636
|
+
});
|
|
637
|
+
export const ListSmartTableSheetsArgsSchema = z.object({
|
|
638
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
639
|
+
...CursorPaginationShape,
|
|
640
|
+
sort: z.enum(["index"]).optional().describe("Sort field (default: index)"),
|
|
641
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: asc)"),
|
|
642
|
+
...SmartTablePromptFilterShape,
|
|
643
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
644
|
+
});
|
|
645
|
+
export const CreateSmartTableSheetArgsSchema = z.object({
|
|
646
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
647
|
+
title: z.string().min(1).max(255).optional().describe("Sheet title"),
|
|
648
|
+
index: z.number().int().min(0).optional().describe("Sheet index"),
|
|
649
|
+
operation_id: z.string().min(1).max(255).optional().describe("Optional idempotency/status operation ID"),
|
|
650
|
+
source: z.discriminatedUnion("type", [
|
|
651
|
+
SmartTableSheetFileSourceSchema,
|
|
652
|
+
SmartTableSheetRequestLogsSourceSchema,
|
|
653
|
+
]).describe("Source for the new sheet: file or request_logs"),
|
|
654
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
655
|
+
});
|
|
656
|
+
export const GetSmartTableSheetArgsSchema = z.object({
|
|
657
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
658
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
659
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
660
|
+
});
|
|
661
|
+
export const UpdateSmartTableSheetArgsSchema = z.object({
|
|
662
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
663
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
664
|
+
title: z.string().min(1).max(255).optional().describe("New sheet title"),
|
|
665
|
+
index: z.number().int().min(0).optional().describe("New sheet index"),
|
|
666
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
667
|
+
});
|
|
668
|
+
export const GetSmartTableSheetImportOperationArgsSchema = z.object({
|
|
669
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
670
|
+
operation_id: z.string().min(1).describe("Import operation ID"),
|
|
671
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
672
|
+
});
|
|
673
|
+
export const ImportSmartTableSheetFileArgsSchema = z.object({
|
|
674
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
675
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
676
|
+
operation_id: z.string().optional().describe("Optional idempotency/status operation ID"),
|
|
677
|
+
file_name: z.string().min(1).max(255).describe("CSV file name"),
|
|
678
|
+
file_content_base64: z.string().min(1).describe("Base64-encoded CSV content"),
|
|
679
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
680
|
+
});
|
|
681
|
+
export const ImportSmartTableSheetRequestLogsArgsSchema = z.object({
|
|
682
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
683
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
684
|
+
operation_id: z.string().optional().describe("Optional idempotency/status operation ID"),
|
|
685
|
+
...SmartTableRequestLogImportBaseShape,
|
|
686
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
687
|
+
});
|
|
688
|
+
export const ListSmartTableColumnsArgsSchema = z.object({
|
|
689
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
690
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
691
|
+
...CursorPaginationShape,
|
|
692
|
+
sort: z.enum(["position_rank"]).optional().describe("Sort field (default: position_rank)"),
|
|
693
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: asc)"),
|
|
694
|
+
include_system_columns: z.boolean().optional().describe("Include system columns in the response"),
|
|
695
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
696
|
+
});
|
|
697
|
+
export const CreateSmartTableColumnArgsSchema = z.object({
|
|
698
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
699
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
700
|
+
title: z.string().min(1).max(255).describe("Column title"),
|
|
701
|
+
type: SmartTableColumnTypeSchema,
|
|
702
|
+
config: z.record(z.unknown()).nullable().optional().describe("Column-type-specific configuration"),
|
|
703
|
+
dependencies: z.array(SmartTableColumnDependencySchema).nullable().optional().describe("Column dependencies"),
|
|
704
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
705
|
+
});
|
|
706
|
+
export const UpdateSmartTableColumnArgsSchema = z.object({
|
|
707
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
708
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
709
|
+
column_id: UuidSchema.describe("Column UUID"),
|
|
710
|
+
title: z.string().min(1).max(255).optional().describe("New column title"),
|
|
711
|
+
config: z.record(z.unknown()).nullable().optional().describe("Replacement column configuration"),
|
|
712
|
+
dependencies: z.array(SmartTableColumnDependencySchema).nullable().optional().describe("Replacement column dependencies"),
|
|
713
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
714
|
+
});
|
|
715
|
+
export const ListSmartTableRowsArgsSchema = z.object({
|
|
716
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
717
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
718
|
+
...CursorPaginationShape,
|
|
719
|
+
sort: z.enum(["row_index"]).optional().describe("Sort field (default: row_index)"),
|
|
720
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: asc)"),
|
|
721
|
+
include_columns: z.boolean().optional().describe("Include column metadata"),
|
|
722
|
+
include_row_count: z.boolean().optional().describe("Include total row count"),
|
|
723
|
+
include_system_columns: z.boolean().optional().describe("Include system columns"),
|
|
724
|
+
include_execution_metadata_aggregates: z.boolean().optional().describe("Include execution metadata aggregates"),
|
|
725
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
726
|
+
});
|
|
727
|
+
export const AddSmartTableRowsArgsSchema = z.object({
|
|
728
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
729
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
730
|
+
count: z.number().int().min(1).max(100).optional().describe("Number of rows to add (default: 1, max: 100)"),
|
|
731
|
+
values: z.array(z.record(z.unknown())).max(100).optional().describe("Optional row values, keyed by column UUID"),
|
|
732
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
733
|
+
});
|
|
734
|
+
export const GetSmartTableCellArgsSchema = z.object({
|
|
735
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
736
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
737
|
+
cell_id: UuidSchema.describe("Cell UUID"),
|
|
738
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
739
|
+
});
|
|
740
|
+
export const UpdateSmartTableCellArgsSchema = z.object({
|
|
741
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
742
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
743
|
+
cell_id: UuidSchema.describe("Cell UUID"),
|
|
744
|
+
display_value: z.string().nullable().optional().describe("Text to display for a text cell"),
|
|
745
|
+
value: z.unknown().optional().describe("Structured cell value"),
|
|
746
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
747
|
+
});
|
|
748
|
+
export const RecalculateSmartTableCellArgsSchema = z.object({
|
|
749
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
750
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
751
|
+
cell_id: UuidSchema.describe("Cell UUID"),
|
|
752
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
753
|
+
});
|
|
754
|
+
export const RecalculateSmartTableCellsArgsSchema = z.object({
|
|
755
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
756
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
757
|
+
cell_ids: z.array(UuidSchema).min(1).describe("Cell UUIDs to recalculate"),
|
|
758
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
759
|
+
});
|
|
760
|
+
export const ListSmartTableOperationsArgsSchema = z.object({
|
|
761
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
762
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
763
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
764
|
+
});
|
|
765
|
+
export const CreateSmartTableOperationArgsSchema = z.object({
|
|
766
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
767
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
768
|
+
operation: z.enum(["recalculate"]).optional().describe("Operation to run (default: recalculate)"),
|
|
769
|
+
column_ids: z.array(UuidSchema).optional().describe("Limit recalculation to these column UUIDs"),
|
|
770
|
+
row_ids: z.array(z.number().int()).optional().describe("Limit recalculation to these row IDs"),
|
|
771
|
+
statuses: z.array(SmartCellStatusSchema).optional().describe("Cell statuses to recalculate. Empty array means no status filter."),
|
|
772
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
773
|
+
});
|
|
774
|
+
export const GetSmartTableOperationArgsSchema = z.object({
|
|
775
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
776
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
777
|
+
operation_id: z.string().min(1).describe("Operation/execution ID"),
|
|
778
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
779
|
+
});
|
|
780
|
+
export const CancelSmartTableOperationArgsSchema = GetSmartTableOperationArgsSchema;
|
|
781
|
+
export const GetSmartTableScoreArgsSchema = z.object({
|
|
782
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
783
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
784
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
785
|
+
});
|
|
786
|
+
export const ConfigureSmartTableScoreArgsSchema = z.object({
|
|
787
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
788
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
789
|
+
score_type: z.enum(["auto", "boolean", "numeric", "custom"]).optional().describe("Score configuration type"),
|
|
790
|
+
score_config: z.record(z.unknown()).optional().describe("Full backend score configuration"),
|
|
791
|
+
column_ids: z.array(UuidSchema).optional().describe("Column UUIDs to include in the score"),
|
|
792
|
+
column_names: z.array(z.string()).optional().describe("Column names to include in the score"),
|
|
793
|
+
code: z.string().min(1).max(50000).optional().describe("Custom score code. Implies score_type=custom."),
|
|
794
|
+
code_language: z.enum(["PYTHON", "JAVASCRIPT"]).optional().describe("Custom score code language (default: PYTHON)"),
|
|
795
|
+
true_values: z.array(z.string()).optional().describe("Values treated as true for boolean scoring"),
|
|
796
|
+
false_values: z.array(z.string()).optional().describe("Values treated as false for boolean scoring"),
|
|
797
|
+
assertion_aggregation: z.enum(["all", "any", "mean"]).optional().describe("How boolean assertions are aggregated"),
|
|
798
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
799
|
+
});
|
|
800
|
+
export const RecalculateSmartTableScoreArgsSchema = GetSmartTableScoreArgsSchema;
|
|
801
|
+
export const ListSmartTableVersionsArgsSchema = z.object({
|
|
802
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
803
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
804
|
+
...CursorPaginationShape,
|
|
805
|
+
sort: z.enum(["version_number"]).optional().describe("Sort field (default: version_number)"),
|
|
806
|
+
order: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
|
|
807
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
808
|
+
});
|
|
809
|
+
export const GetSmartTableVersionArgsSchema = z.object({
|
|
810
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
811
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
812
|
+
version_id: UuidSchema.describe("Version UUID"),
|
|
813
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
814
|
+
});
|
|
815
|
+
export const CreateSmartTableVersionArgsSchema = z.object({
|
|
816
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
817
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
818
|
+
name: z.string().min(1).max(255).optional().describe("Name for a new snapshot version"),
|
|
819
|
+
source_version_id: UuidSchema.optional().describe("Existing version UUID to restore"),
|
|
820
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
821
|
+
});
|
|
822
|
+
export const GetSmartTableScoreHistoryArgsSchema = z.object({
|
|
823
|
+
table_id: UuidSchema.describe("Smart Table UUID"),
|
|
824
|
+
sheet_id: UuidSchema.describe("Sheet UUID"),
|
|
825
|
+
max_points: z.number().int().min(50).max(5000).optional().describe("Maximum score-history points (default: 1200)"),
|
|
826
|
+
range: z.string().optional().describe("Score-history range, e.g. all, last_25, last_50, last_100, last_250"),
|
|
827
|
+
resolution: z.string().optional().describe("Score-history resolution (default: auto)"),
|
|
828
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
829
|
+
});
|
|
830
|
+
const LegacySmartTableMigrationSourceTypeSchema = z.enum(["dataset_group", "dataset", "report"]);
|
|
831
|
+
export const ListLegacySmartTableMigrationsArgsSchema = z.object({
|
|
832
|
+
source_type: LegacySmartTableMigrationSourceTypeSchema.optional().describe("Legacy source type to filter by"),
|
|
833
|
+
source_id: z.union([
|
|
834
|
+
z.number().int().positive(),
|
|
835
|
+
z.array(z.number().int().positive()),
|
|
836
|
+
]).optional().describe("One or more legacy source IDs. Requires source_type."),
|
|
837
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
838
|
+
});
|
|
839
|
+
export const PreviewLegacySmartTableMigrationArgsSchema = z.object({
|
|
840
|
+
source_type: LegacySmartTableMigrationSourceTypeSchema.describe("Legacy source type"),
|
|
841
|
+
source_id: z.number().int().positive().describe("Legacy source ID"),
|
|
842
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
843
|
+
});
|
|
844
|
+
export const MigrateLegacyToSmartTableArgsSchema = z.object({
|
|
845
|
+
source_type: LegacySmartTableMigrationSourceTypeSchema.describe("Legacy source type"),
|
|
846
|
+
source_id: z.number().int().positive().describe("Legacy source ID"),
|
|
847
|
+
force: z.boolean().optional().describe("Force remigration of an already migrated source"),
|
|
848
|
+
dry_run: z.boolean().optional().describe("Preview migration work without writing data"),
|
|
849
|
+
resume: z.boolean().optional().describe("Resume prior migration progress when available"),
|
|
850
|
+
continue_on_error: z.boolean().optional().describe("Continue migration after row/column-level errors"),
|
|
851
|
+
include_reports_with_missing_datasets: z.boolean().optional().describe("Include reports even if their datasets are missing"),
|
|
852
|
+
max_version_snapshot_cells: z.number().int().min(0).optional().describe("Maximum cells to snapshot per migrated version"),
|
|
853
|
+
report_preview_row_limit: z.number().int().min(0).optional().describe("Rows to include in migrated report previews"),
|
|
854
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
855
|
+
});
|
|
856
|
+
export const GetLegacySmartTableMigrationJobArgsSchema = z.object({
|
|
857
|
+
job_id: z.string().min(1).describe("Legacy Smart Table migration job ID"),
|
|
858
|
+
api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
|
|
859
|
+
});
|
|
649
860
|
export const TOOL_DEFINITIONS = {
|
|
650
861
|
// ── Prompt Templates ────────────────────────────────────────────────
|
|
651
862
|
"get-prompt-template": {
|
|
@@ -785,144 +996,247 @@ export const TOOL_DEFINITIONS = {
|
|
|
785
996
|
inputSchema: CreateSpansBulkArgsSchema,
|
|
786
997
|
annotations: { readOnlyHint: false },
|
|
787
998
|
},
|
|
788
|
-
// ──
|
|
789
|
-
"list-
|
|
790
|
-
name: "list-
|
|
791
|
-
description: "List
|
|
792
|
-
|
|
999
|
+
// ── Smart Tables ───────────────────────────────────────────────────
|
|
1000
|
+
"list-smart-tables": {
|
|
1001
|
+
name: "list-smart-tables",
|
|
1002
|
+
description: "List Smart Tables with cursor pagination. Smart Tables are PromptLayer's general-purpose data and " +
|
|
1003
|
+
"computation layer — use them to organise test datasets, run prompt templates across rows, assert " +
|
|
1004
|
+
"on outputs, compare results, build evaluations, or track regression over time. " +
|
|
1005
|
+
"Filter by folder, title, or referenced prompt.",
|
|
1006
|
+
inputSchema: ListSmartTablesArgsSchema,
|
|
793
1007
|
annotations: { readOnlyHint: true },
|
|
794
1008
|
},
|
|
795
|
-
"create-
|
|
796
|
-
name: "create-
|
|
797
|
-
description: "Create a
|
|
798
|
-
|
|
1009
|
+
"create-smart-table": {
|
|
1010
|
+
name: "create-smart-table",
|
|
1011
|
+
description: "Create a Smart Table. Tables are general-purpose — they can hold any tabular data and run " +
|
|
1012
|
+
"computed columns (PROMPT_TEMPLATE, LLM_ASSERTION, CODE_EXECUTION, COMPARE, etc.) over rows. " +
|
|
1013
|
+
"Common uses include evaluations, regression testing, prompt comparisons, and dataset curation. " +
|
|
1014
|
+
"After creating a table, add a sheet, then add columns and rows (or import request logs).",
|
|
1015
|
+
inputSchema: CreateSmartTableArgsSchema,
|
|
799
1016
|
annotations: { readOnlyHint: false },
|
|
800
1017
|
},
|
|
801
|
-
"
|
|
802
|
-
name: "
|
|
803
|
-
description: "
|
|
804
|
-
inputSchema:
|
|
1018
|
+
"get-smart-table": {
|
|
1019
|
+
name: "get-smart-table",
|
|
1020
|
+
description: "Get a Smart Table by UUID, including sheet counts and row counts.",
|
|
1021
|
+
inputSchema: GetSmartTableArgsSchema,
|
|
1022
|
+
annotations: { readOnlyHint: true },
|
|
1023
|
+
},
|
|
1024
|
+
"update-smart-table": {
|
|
1025
|
+
name: "update-smart-table",
|
|
1026
|
+
description: "Update a Smart Table title or folder.",
|
|
1027
|
+
inputSchema: UpdateSmartTableArgsSchema,
|
|
805
1028
|
annotations: { readOnlyHint: false },
|
|
806
1029
|
},
|
|
807
|
-
"
|
|
808
|
-
name: "
|
|
809
|
-
description: "
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1030
|
+
"list-smart-table-sheets": {
|
|
1031
|
+
name: "list-smart-table-sheets",
|
|
1032
|
+
description: "List sheets in a Smart Table with cursor pagination.",
|
|
1033
|
+
inputSchema: ListSmartTableSheetsArgsSchema,
|
|
1034
|
+
annotations: { readOnlyHint: true },
|
|
1035
|
+
},
|
|
1036
|
+
"create-smart-table-sheet": {
|
|
1037
|
+
name: "create-smart-table-sheet",
|
|
1038
|
+
description: "Add a sheet (tab) to a Smart Table. Two source types:\n" +
|
|
1039
|
+
" - file: seed rows from a base64-encoded CSV or JSON file.\n" +
|
|
1040
|
+
" - request_logs: import historical request logs from PromptLayer by filter or explicit IDs — " +
|
|
1041
|
+
" use this to build datasets from real production traffic for evaluation or analysis.",
|
|
1042
|
+
inputSchema: CreateSmartTableSheetArgsSchema,
|
|
1043
|
+
annotations: { readOnlyHint: false },
|
|
1044
|
+
},
|
|
1045
|
+
"get-smart-table-sheet": {
|
|
1046
|
+
name: "get-smart-table-sheet",
|
|
1047
|
+
description: "Get a single Smart Table sheet.",
|
|
1048
|
+
inputSchema: GetSmartTableSheetArgsSchema,
|
|
1049
|
+
annotations: { readOnlyHint: true },
|
|
1050
|
+
},
|
|
1051
|
+
"update-smart-table-sheet": {
|
|
1052
|
+
name: "update-smart-table-sheet",
|
|
1053
|
+
description: "Update a Smart Table sheet title or index.",
|
|
1054
|
+
inputSchema: UpdateSmartTableSheetArgsSchema,
|
|
815
1055
|
annotations: { readOnlyHint: false },
|
|
816
1056
|
},
|
|
817
|
-
"get-
|
|
818
|
-
name: "get-
|
|
819
|
-
description: "Get
|
|
820
|
-
inputSchema:
|
|
1057
|
+
"get-smart-table-sheet-import-operation": {
|
|
1058
|
+
name: "get-smart-table-sheet-import-operation",
|
|
1059
|
+
description: "Get status for a Smart Table sheet import operation.",
|
|
1060
|
+
inputSchema: GetSmartTableSheetImportOperationArgsSchema,
|
|
821
1061
|
annotations: { readOnlyHint: true },
|
|
822
1062
|
},
|
|
823
|
-
"
|
|
824
|
-
name: "
|
|
825
|
-
description: "
|
|
826
|
-
inputSchema:
|
|
1063
|
+
"import-smart-table-sheet-file": {
|
|
1064
|
+
name: "import-smart-table-sheet-file",
|
|
1065
|
+
description: "Import base64 CSV content into an existing Smart Table sheet.",
|
|
1066
|
+
inputSchema: ImportSmartTableSheetFileArgsSchema,
|
|
827
1067
|
annotations: { readOnlyHint: false },
|
|
828
1068
|
},
|
|
829
|
-
"
|
|
830
|
-
name: "
|
|
831
|
-
description: "
|
|
832
|
-
|
|
1069
|
+
"import-smart-table-sheet-request-logs": {
|
|
1070
|
+
name: "import-smart-table-sheet-request-logs",
|
|
1071
|
+
description: "Import historical request logs from PromptLayer into a Smart Table sheet. Provide either explicit " +
|
|
1072
|
+
"request_log_ids or a filter_group (same syntax as search-request-logs — filter by model, prompt, " +
|
|
1073
|
+
"metadata, date range, status, etc.). Use this to add production traffic rows to a table for " +
|
|
1074
|
+
"evaluation, comparison, or any other analysis.",
|
|
1075
|
+
inputSchema: ImportSmartTableSheetRequestLogsArgsSchema,
|
|
833
1076
|
annotations: { readOnlyHint: false },
|
|
834
1077
|
},
|
|
835
|
-
"
|
|
836
|
-
name: "
|
|
837
|
-
description: "
|
|
838
|
-
inputSchema:
|
|
1078
|
+
"list-smart-table-columns": {
|
|
1079
|
+
name: "list-smart-table-columns",
|
|
1080
|
+
description: "List columns in a Smart Table sheet.",
|
|
1081
|
+
inputSchema: ListSmartTableColumnsArgsSchema,
|
|
1082
|
+
annotations: { readOnlyHint: true },
|
|
1083
|
+
},
|
|
1084
|
+
"create-smart-table-column": {
|
|
1085
|
+
name: "create-smart-table-column",
|
|
1086
|
+
description: "Add a column to a Smart Table sheet. Common types:\n" +
|
|
1087
|
+
" - PROMPT_TEMPLATE: run a prompt template against each row (e.g. regression testing or A/B comparison).\n" +
|
|
1088
|
+
" - LLM_ASSERTION: use an LLM to judge or assert something about a row's values.\n" +
|
|
1089
|
+
" - CODE_EXECUTION: run custom Python/JS logic per row.\n" +
|
|
1090
|
+
" - COMPARE: compare two column values side-by-side.\n" +
|
|
1091
|
+
" - CONTAINS / REGEX: string-matching checks.\n" +
|
|
1092
|
+
" - TEXT: static or manually entered text.\n" +
|
|
1093
|
+
" - DATASET: read a field from the imported dataset rows.\n" +
|
|
1094
|
+
"Use uppercase type values. Columns can depend on other columns via the dependencies field.",
|
|
1095
|
+
inputSchema: CreateSmartTableColumnArgsSchema,
|
|
839
1096
|
annotations: { readOnlyHint: false },
|
|
840
1097
|
},
|
|
841
|
-
"
|
|
842
|
-
name: "
|
|
843
|
-
description: "
|
|
844
|
-
inputSchema:
|
|
1098
|
+
"update-smart-table-column": {
|
|
1099
|
+
name: "update-smart-table-column",
|
|
1100
|
+
description: "Update a Smart Table column title, config, or dependencies. Column type and position are not changed by this tool.",
|
|
1101
|
+
inputSchema: UpdateSmartTableColumnArgsSchema,
|
|
845
1102
|
annotations: { readOnlyHint: false },
|
|
846
1103
|
},
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
inputSchema: ListEvaluationsArgsSchema,
|
|
1104
|
+
"list-smart-table-rows": {
|
|
1105
|
+
name: "list-smart-table-rows",
|
|
1106
|
+
description: "List rows in a Smart Table sheet with optional column metadata and row counts.",
|
|
1107
|
+
inputSchema: ListSmartTableRowsArgsSchema,
|
|
852
1108
|
annotations: { readOnlyHint: true },
|
|
853
1109
|
},
|
|
854
|
-
"
|
|
855
|
-
name: "
|
|
856
|
-
description: "
|
|
857
|
-
inputSchema:
|
|
1110
|
+
"add-smart-table-rows": {
|
|
1111
|
+
name: "add-smart-table-rows",
|
|
1112
|
+
description: "Add up to 100 rows to a Smart Table sheet, optionally with values keyed by column UUID.",
|
|
1113
|
+
inputSchema: AddSmartTableRowsArgsSchema,
|
|
1114
|
+
annotations: { readOnlyHint: false },
|
|
1115
|
+
},
|
|
1116
|
+
"get-smart-table-cell": {
|
|
1117
|
+
name: "get-smart-table-cell",
|
|
1118
|
+
description: "Get a Smart Table cell by UUID.",
|
|
1119
|
+
inputSchema: GetSmartTableCellArgsSchema,
|
|
858
1120
|
annotations: { readOnlyHint: true },
|
|
859
1121
|
},
|
|
860
|
-
"
|
|
861
|
-
name: "
|
|
862
|
-
description: "
|
|
863
|
-
inputSchema:
|
|
1122
|
+
"update-smart-table-cell": {
|
|
1123
|
+
name: "update-smart-table-cell",
|
|
1124
|
+
description: "Update a Smart Table text cell. Computed cells should be recalculated instead.",
|
|
1125
|
+
inputSchema: UpdateSmartTableCellArgsSchema,
|
|
864
1126
|
annotations: { readOnlyHint: false },
|
|
865
1127
|
},
|
|
866
|
-
"
|
|
867
|
-
name: "
|
|
868
|
-
description: "
|
|
869
|
-
inputSchema:
|
|
1128
|
+
"recalculate-smart-table-cell": {
|
|
1129
|
+
name: "recalculate-smart-table-cell",
|
|
1130
|
+
description: "Queue recalculation for one Smart Table computed cell.",
|
|
1131
|
+
inputSchema: RecalculateSmartTableCellArgsSchema,
|
|
870
1132
|
annotations: { readOnlyHint: false },
|
|
871
1133
|
},
|
|
872
|
-
"
|
|
873
|
-
name: "
|
|
874
|
-
description: "
|
|
875
|
-
inputSchema:
|
|
876
|
-
annotations: { readOnlyHint:
|
|
1134
|
+
"recalculate-smart-table-cells": {
|
|
1135
|
+
name: "recalculate-smart-table-cells",
|
|
1136
|
+
description: "Queue recalculation for multiple Smart Table computed cells.",
|
|
1137
|
+
inputSchema: RecalculateSmartTableCellsArgsSchema,
|
|
1138
|
+
annotations: { readOnlyHint: false },
|
|
877
1139
|
},
|
|
878
|
-
"
|
|
879
|
-
name: "
|
|
880
|
-
description: "
|
|
881
|
-
inputSchema:
|
|
1140
|
+
"list-smart-table-operations": {
|
|
1141
|
+
name: "list-smart-table-operations",
|
|
1142
|
+
description: "List active Smart Table sheet operations and cell status counts.",
|
|
1143
|
+
inputSchema: ListSmartTableOperationsArgsSchema,
|
|
882
1144
|
annotations: { readOnlyHint: true },
|
|
883
1145
|
},
|
|
884
|
-
"
|
|
885
|
-
name: "
|
|
886
|
-
description: "
|
|
887
|
-
|
|
1146
|
+
"create-smart-table-operation": {
|
|
1147
|
+
name: "create-smart-table-operation",
|
|
1148
|
+
description: "Trigger a recalculate operation on a Smart Table sheet — executes all computed columns " +
|
|
1149
|
+
"(PROMPT_TEMPLATE, LLM_ASSERTION, CODE_EXECUTION, etc.) for the selected rows and columns. " +
|
|
1150
|
+
"Scope the run with column_ids, row_ids, or statuses (e.g. only STALE cells). " +
|
|
1151
|
+
"Returns an operation_id to poll with get-smart-table-operation.",
|
|
1152
|
+
inputSchema: CreateSmartTableOperationArgsSchema,
|
|
888
1153
|
annotations: { readOnlyHint: false },
|
|
889
1154
|
},
|
|
890
|
-
"
|
|
891
|
-
name: "
|
|
892
|
-
description: "
|
|
893
|
-
inputSchema:
|
|
894
|
-
annotations: { readOnlyHint:
|
|
1155
|
+
"get-smart-table-operation": {
|
|
1156
|
+
name: "get-smart-table-operation",
|
|
1157
|
+
description: "Get status for a Smart Table sheet operation.",
|
|
1158
|
+
inputSchema: GetSmartTableOperationArgsSchema,
|
|
1159
|
+
annotations: { readOnlyHint: true },
|
|
895
1160
|
},
|
|
896
|
-
"
|
|
897
|
-
name: "
|
|
898
|
-
description: "
|
|
899
|
-
inputSchema:
|
|
1161
|
+
"cancel-smart-table-operation": {
|
|
1162
|
+
name: "cancel-smart-table-operation",
|
|
1163
|
+
description: "Cancel an active Smart Table sheet operation.",
|
|
1164
|
+
inputSchema: CancelSmartTableOperationArgsSchema,
|
|
900
1165
|
annotations: { readOnlyHint: false },
|
|
901
1166
|
},
|
|
902
|
-
"
|
|
903
|
-
name: "
|
|
904
|
-
description: "
|
|
905
|
-
|
|
1167
|
+
"get-smart-table-score": {
|
|
1168
|
+
name: "get-smart-table-score",
|
|
1169
|
+
description: "Get the configured score and current aggregate result for a Smart Table sheet. " +
|
|
1170
|
+
"Useful when the sheet is being used as an evaluation — the score summarises how well the " +
|
|
1171
|
+
"assertion/computation columns performed across all rows.",
|
|
1172
|
+
inputSchema: GetSmartTableScoreArgsSchema,
|
|
1173
|
+
annotations: { readOnlyHint: true },
|
|
1174
|
+
},
|
|
1175
|
+
"configure-smart-table-score": {
|
|
1176
|
+
name: "configure-smart-table-score",
|
|
1177
|
+
description: "Configure scoring for a Smart Table sheet. Choose which columns contribute, set score_type " +
|
|
1178
|
+
"(auto, boolean, numeric, or custom), supply custom Python/JS aggregation code, or pass a full " +
|
|
1179
|
+
"score_config object.",
|
|
1180
|
+
inputSchema: ConfigureSmartTableScoreArgsSchema,
|
|
906
1181
|
annotations: { readOnlyHint: false },
|
|
907
1182
|
},
|
|
908
|
-
"
|
|
909
|
-
name: "
|
|
910
|
-
description: "
|
|
911
|
-
inputSchema:
|
|
1183
|
+
"recalculate-smart-table-score": {
|
|
1184
|
+
name: "recalculate-smart-table-score",
|
|
1185
|
+
description: "Recompute the aggregate score for a Smart Table sheet.",
|
|
1186
|
+
inputSchema: RecalculateSmartTableScoreArgsSchema,
|
|
912
1187
|
annotations: { readOnlyHint: false },
|
|
913
1188
|
},
|
|
914
|
-
"
|
|
915
|
-
name: "
|
|
916
|
-
description: "
|
|
917
|
-
|
|
1189
|
+
"list-smart-table-versions": {
|
|
1190
|
+
name: "list-smart-table-versions",
|
|
1191
|
+
description: "List saved snapshots (versions) for a Smart Table sheet. Versions capture the state of all rows " +
|
|
1192
|
+
"and cells at a point in time — useful for tracking how results change across prompt updates or runs.",
|
|
1193
|
+
inputSchema: ListSmartTableVersionsArgsSchema,
|
|
1194
|
+
annotations: { readOnlyHint: true },
|
|
1195
|
+
},
|
|
1196
|
+
"get-smart-table-version": {
|
|
1197
|
+
name: "get-smart-table-version",
|
|
1198
|
+
description: "Get a saved Smart Table sheet version, including its full snapshot of cell values.",
|
|
1199
|
+
inputSchema: GetSmartTableVersionArgsSchema,
|
|
1200
|
+
annotations: { readOnlyHint: true },
|
|
1201
|
+
},
|
|
1202
|
+
"create-smart-table-version": {
|
|
1203
|
+
name: "create-smart-table-version",
|
|
1204
|
+
description: "Save a named snapshot of a Smart Table sheet's current state — useful for capturing results " +
|
|
1205
|
+
"before making changes so you can compare later. Pass source_version_id to restore a prior snapshot.",
|
|
1206
|
+
inputSchema: CreateSmartTableVersionArgsSchema,
|
|
918
1207
|
annotations: { readOnlyHint: false },
|
|
919
1208
|
},
|
|
920
|
-
"
|
|
921
|
-
name: "
|
|
922
|
-
description: "
|
|
923
|
-
|
|
1209
|
+
"get-smart-table-score-history": {
|
|
1210
|
+
name: "get-smart-table-score-history",
|
|
1211
|
+
description: "Get score history across saved versions for a Smart Table sheet. Use this to track how scores " +
|
|
1212
|
+
"change over time — useful for regression monitoring when the sheet is used as an evaluation.",
|
|
1213
|
+
inputSchema: GetSmartTableScoreHistoryArgsSchema,
|
|
1214
|
+
annotations: { readOnlyHint: true },
|
|
1215
|
+
},
|
|
1216
|
+
"list-legacy-smart-table-migrations": {
|
|
1217
|
+
name: "list-legacy-smart-table-migrations",
|
|
1218
|
+
description: "List successful legacy dataset/evaluation to Smart Table migration mappings.",
|
|
1219
|
+
inputSchema: ListLegacySmartTableMigrationsArgsSchema,
|
|
1220
|
+
annotations: { readOnlyHint: true },
|
|
1221
|
+
},
|
|
1222
|
+
"preview-legacy-smart-table-migration": {
|
|
1223
|
+
name: "preview-legacy-smart-table-migration",
|
|
1224
|
+
description: "Preview conversion of a legacy dataset group, dataset, or report into a Smart Table.",
|
|
1225
|
+
inputSchema: PreviewLegacySmartTableMigrationArgsSchema,
|
|
1226
|
+
annotations: { readOnlyHint: true },
|
|
1227
|
+
},
|
|
1228
|
+
"migrate-legacy-to-smart-table": {
|
|
1229
|
+
name: "migrate-legacy-to-smart-table",
|
|
1230
|
+
description: "Start or dry-run conversion of a legacy dataset group, dataset, or report into a Smart Table.",
|
|
1231
|
+
inputSchema: MigrateLegacyToSmartTableArgsSchema,
|
|
924
1232
|
annotations: { readOnlyHint: false },
|
|
925
1233
|
},
|
|
1234
|
+
"get-legacy-smart-table-migration-job": {
|
|
1235
|
+
name: "get-legacy-smart-table-migration-job",
|
|
1236
|
+
description: "Get status and result details for a legacy Smart Table migration job.",
|
|
1237
|
+
inputSchema: GetLegacySmartTableMigrationJobArgsSchema,
|
|
1238
|
+
annotations: { readOnlyHint: true },
|
|
1239
|
+
},
|
|
926
1240
|
// ── Agents / Workflows ──────────────────────────────────────────────
|
|
927
1241
|
"list-workflows": {
|
|
928
1242
|
name: "list-workflows",
|
|
@@ -997,6 +1311,31 @@ export const TOOL_DEFINITIONS = {
|
|
|
997
1311
|
inputSchema: TestExecuteToolRegistryArgsSchema,
|
|
998
1312
|
annotations: { readOnlyHint: false },
|
|
999
1313
|
},
|
|
1314
|
+
// ── Env Vars ────────────────────────────────────────────────────────
|
|
1315
|
+
"list-workspace-env-vars": {
|
|
1316
|
+
name: "list-workspace-env-vars",
|
|
1317
|
+
description: "List workspace-scoped environment variables. Returned values are masked (only `value_suffix` — last 4 chars). Workspace vars auto-inject into every auto-executing tool in this workspace; tool-scoped vars override them on the same key.",
|
|
1318
|
+
inputSchema: ListWorkspaceEnvVarsArgsSchema,
|
|
1319
|
+
annotations: { readOnlyHint: true },
|
|
1320
|
+
},
|
|
1321
|
+
"create-workspace-env-var": {
|
|
1322
|
+
name: "create-workspace-env-var",
|
|
1323
|
+
description: "Scaffold a workspace-scoped environment variable placeholder. Auto-injected into every auto-executing tool in this workspace. The value is always created empty; the user fills in the real value via Settings, Environment Variables. Key must match ^[A-Za-z_][A-Za-z0-9_]*$ and not collide with reserved runtime names.",
|
|
1324
|
+
inputSchema: CreateWorkspaceEnvVarArgsSchema,
|
|
1325
|
+
annotations: { readOnlyHint: false },
|
|
1326
|
+
},
|
|
1327
|
+
"list-tool-env-vars": {
|
|
1328
|
+
name: "list-tool-env-vars",
|
|
1329
|
+
description: "List tool-scoped environment variables for a specific tool (by ID or name). Returned values are masked (only `value_suffix`). Tool-scoped vars override workspace-scoped vars on the same key during sandbox execution.",
|
|
1330
|
+
inputSchema: ListToolEnvVarsArgsSchema,
|
|
1331
|
+
annotations: { readOnlyHint: true },
|
|
1332
|
+
},
|
|
1333
|
+
"create-tool-env-var": {
|
|
1334
|
+
name: "create-tool-env-var",
|
|
1335
|
+
description: "Scaffold a tool-scoped environment variable placeholder on a specific tool. Auto-injected only into THIS tool's sandbox execution and overrides any workspace-scoped var with the same key. The value is always created empty; the user fills in the real value via Settings.",
|
|
1336
|
+
inputSchema: CreateToolEnvVarArgsSchema,
|
|
1337
|
+
annotations: { readOnlyHint: false },
|
|
1338
|
+
},
|
|
1000
1339
|
// ── Folders ─────────────────────────────────────────────────────────
|
|
1001
1340
|
"create-folder": {
|
|
1002
1341
|
name: "create-folder",
|
|
@@ -1080,6 +1419,21 @@ export const TOOL_DEFINITIONS = {
|
|
|
1080
1419
|
inputSchema: GetRequestAnalyticsArgsSchema,
|
|
1081
1420
|
annotations: { readOnlyHint: true },
|
|
1082
1421
|
},
|
|
1422
|
+
"get-request-analytics-custom-analytics": {
|
|
1423
|
+
name: "get-request-analytics-custom-analytics",
|
|
1424
|
+
description: "Run custom analytics queries over request logs. You define which metrics to compute and how to slice them; the API runs the aggregations and returns structured data rows you can use however you want — charts, analysis, dashboards, or programmatic processing.\n\n" +
|
|
1425
|
+
"Each query spec in `customCharts` controls:\n" +
|
|
1426
|
+
" - `metric`: count | sum | avg | min | max | percentile (with optional `percentile` 0–100)\n" +
|
|
1427
|
+
" - `metricField`: the numeric field to aggregate (input_tokens, output_tokens, cost, latency_ms, turn_count, tool_call_count, cached_tokens, thinking_tokens)\n" +
|
|
1428
|
+
" - `groupByField`: break down by engine, provider_type, prompt_id, status, error_type, tags, etc.\n" +
|
|
1429
|
+
" - `groupByMetadataKey`: break down by values of a specific metadata key\n" +
|
|
1430
|
+
" - `timeSeries: true`: bucket results over time\n" +
|
|
1431
|
+
" - `series`: multi-series mode — define two or more named series instead of a single metric\n\n" +
|
|
1432
|
+
"Use this when get-request-analytics doesn't cover the slice you need. " +
|
|
1433
|
+
"Examples: cost by metadata environment, p95 latency over time by prompt, input vs output token ratio.",
|
|
1434
|
+
inputSchema: GetRequestAnalyticsCustomAnalyticsArgsSchema,
|
|
1435
|
+
annotations: { readOnlyHint: true },
|
|
1436
|
+
},
|
|
1083
1437
|
// ── Prompt Template Patch ───────────────────────────────────────────
|
|
1084
1438
|
"patch-prompt-template-version": {
|
|
1085
1439
|
name: "patch-prompt-template-version",
|