@promptlayer/mcp-server 1.7.0 → 1.9.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/gcp/package.json CHANGED
@@ -22,5 +22,18 @@
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=20.0.0"
25
+ },
26
+ "overrides": {
27
+ "hono": "^4.12.14",
28
+ "@hono/node-server": "^1.19.13",
29
+ "express-rate-limit": "^8.2.2",
30
+ "express": {
31
+ "path-to-regexp": "^0.1.13"
32
+ },
33
+ "router": {
34
+ "path-to-regexp": "^8.4.0"
35
+ },
36
+ "qs": "^6.14.2",
37
+ "ajv": "^8.18.0"
25
38
  }
26
39
  }
package/gcp/src/index.ts CHANGED
@@ -65,8 +65,16 @@ const TOOL_HANDLERS: Record<string, ToolHandler> = {
65
65
  "get-report-score": (c, { report_id }) => c.getReportScore(report_id as number),
66
66
  "update-report-score-card": (c, { api_key: _, report_id, ...b }) =>
67
67
  c.updateReportScoreCard(report_id as number, b),
68
+ "rename-report": (c, { api_key: _, report_id, ...b }) =>
69
+ c.renameReport(report_id as number, b),
70
+ "delete-report": (c, { report_id }) => c.deleteReport(report_id as number),
68
71
  "delete-reports-by-name": (c, { report_name }) =>
69
72
  c.deleteReportsByName(report_name as string),
73
+ "add-report-column": (c, a) => c.addReportColumn(body(a)),
74
+ "edit-report-column": (c, { api_key: _, report_column_id, ...b }) =>
75
+ c.editReportColumn(report_column_id as number, b),
76
+ "delete-report-column": (c, { report_column_id }) =>
77
+ c.deleteReportColumn(report_column_id as number),
70
78
 
71
79
  // Agents
72
80
  "list-workflows": (c, a) => c.listWorkflows(body(a)),
@@ -82,6 +90,14 @@ const TOOL_HANDLERS: Record<string, ToolHandler> = {
82
90
  "get-workflow-labels": (c, { workflow_id_or_name }) =>
83
91
  c.getWorkflowLabels(workflow_id_or_name as string),
84
92
 
93
+ // Tool Registry
94
+ "list-tool-registries": (c) => c.listToolRegistries(),
95
+ "get-tool-registry": (c, { api_key: _, identifier, ...p }) =>
96
+ c.getToolRegistry(identifier as string, p),
97
+ "create-tool-registry": (c, a) => c.createToolRegistry(body(a)),
98
+ "create-tool-version": (c, { api_key: _, identifier, ...b }) =>
99
+ c.createToolVersion(identifier as string, b),
100
+
85
101
  // Folders
86
102
  "create-folder": (c, a) => c.createFolder(body(a)),
87
103
  "edit-folder": (c, { api_key: _, folder_id, ...b }) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptlayer/mcp-server",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Model Context Protocol server for PromptLayer",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -32,5 +32,13 @@
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=18.0.0"
35
+ },
36
+ "overrides": {
37
+ "hono": "^4.12.14",
38
+ "@hono/node-server": "^1.19.13",
39
+ "express-rate-limit": "^8.2.2",
40
+ "path-to-regexp": "^8.4.0",
41
+ "qs": "^6.14.2",
42
+ "ajv": "^8.18.0"
35
43
  }
36
44
  }
package/src/client.ts CHANGED
@@ -83,7 +83,12 @@ export class PromptLayerClient {
83
83
  getReport(id: number) { return this.get(`/reports/${id}`); }
84
84
  getReportScore(id: number) { return this.get(`/reports/${id}/score`); }
85
85
  updateReportScoreCard(id: number, body: Body) { return this.patch(`/reports/${id}/score-card`, body); }
86
+ renameReport(id: number, body: Body) { return this.patch(`/reports/${id}/rename`, body); }
87
+ deleteReport(id: number) { return this.del(`/reports/${id}`); }
86
88
  deleteReportsByName(name: string) { return this.del(`/reports/name/${this.enc(name)}`); }
89
+ addReportColumn(body: Body) { return this.post("/report-columns", body); }
90
+ editReportColumn(id: number, body: Body) { return this.patch(`/report-columns/${id}`, body); }
91
+ deleteReportColumn(id: number) { return this.del(`/report-columns/${id}`); }
87
92
 
88
93
  // Agents
89
94
  listWorkflows(params?: Body) { return this.get("/workflows", params); }
@@ -94,6 +99,12 @@ export class PromptLayerClient {
94
99
  runWorkflow(name: string, body: Body) { return this.post(`/workflows/${this.enc(name)}/run`, body); }
95
100
  getWorkflowVersionExecutionResults(params: Body) { return this.get("/workflow-version-execution-results", params); }
96
101
 
102
+ // Tool Registry
103
+ listToolRegistries() { return this.get("/api/public/v2/tool-registry"); }
104
+ getToolRegistry(identifier: string, params?: Body) { return this.get(`/api/public/v2/tool-registry/${this.enc(identifier)}`, params); }
105
+ createToolRegistry(body: Body) { return this.post("/api/public/v2/tool-registry", body); }
106
+ createToolVersion(identifier: string, body: Body) { return this.post(`/api/public/v2/tool-registry/${this.enc(identifier)}/versions`, body); }
107
+
97
108
  // Folders
98
109
  createFolder(body: Body) { return this.post("/api/public/v2/folders", body); }
99
110
  editFolder(folderId: number, body: Body) { return this.patch(`/api/public/v2/folders/${folderId}`, body); }
package/src/handlers.ts CHANGED
@@ -105,6 +105,20 @@ export function registerAllTools(server: any) {
105
105
  reg(t["delete-reports-by-name"],
106
106
  (c, a) => c.deleteReportsByName((a as { report_name: string }).report_name),
107
107
  () => "Reports archived");
108
+ reg(t["delete-report"],
109
+ (c, a) => c.deleteReport((a as { report_id: number }).report_id),
110
+ () => "Evaluation pipeline archived");
111
+ reg(t["rename-report"],
112
+ (c, a) => { const { api_key: _, report_id, ...b } = a as { report_id: number; api_key?: string } & Args; return c.renameReport(report_id, b); },
113
+ () => "Evaluation pipeline updated");
114
+ reg(t["add-report-column"], (c, a) => c.addReportColumn(body(a)),
115
+ (r) => { const id = (r as { report_column?: { id?: number } }).report_column?.id; return id ? `Column added (ID: ${id})` : "Column added"; });
116
+ reg(t["edit-report-column"],
117
+ (c, a) => { const { api_key: _, report_column_id, ...b } = a as { report_column_id: number; api_key?: string } & Args; return c.editReportColumn(report_column_id, b); },
118
+ () => "Column updated");
119
+ reg(t["delete-report-column"],
120
+ (c, a) => c.deleteReportColumn((a as { report_column_id: number }).report_column_id),
121
+ () => "Column deleted");
108
122
 
109
123
  // Agents
110
124
  reg(t["list-workflows"], (c, a) => c.listWorkflows(body(a)), () => "Agents listed");
@@ -125,6 +139,18 @@ export function registerAllTools(server: any) {
125
139
  (c, a) => c.getWorkflowLabels((a as { workflow_id_or_name: string }).workflow_id_or_name),
126
140
  (r) => { const labels = (r as { release_labels?: unknown[] }).release_labels; return `${labels?.length ?? 0} label(s) found`; });
127
141
 
142
+ // Tool Registry
143
+ reg(t["list-tool-registries"], (c) => c.listToolRegistries(),
144
+ (r) => { const tools = (r as { tool_registries?: unknown[] }).tool_registries; return `${tools?.length ?? 0} tool(s)`; });
145
+ reg(t["get-tool-registry"],
146
+ (c, a) => { const { api_key: _, identifier, ...p } = a as { identifier: string; api_key?: string } & Args; return c.getToolRegistry(identifier, p); },
147
+ (r) => { const t_ = (r as { tool_registry?: { name?: string } }).tool_registry; return `Tool "${t_?.name ?? ""}" retrieved`; });
148
+ reg(t["create-tool-registry"], (c, a) => c.createToolRegistry(body(a)),
149
+ (r) => { const t_ = (r as { tool_registry?: { name?: string; id?: number } }).tool_registry; return t_ ? `Tool "${t_.name}" created (ID: ${t_.id})` : "Tool created"; });
150
+ reg(t["create-tool-version"],
151
+ (c, a) => { const { api_key: _, identifier, ...b } = a as { identifier: string; api_key?: string } & Args; return c.createToolVersion(identifier, b); },
152
+ (r) => { const v = (r as { version?: { number?: number } }).version; return v ? `Version ${v.number} created` : "Version created"; });
153
+
128
154
  // Folders
129
155
  reg(t["create-folder"], (c, a) => c.createFolder(body(a)), () => "Folder created");
130
156
  reg(t["edit-folder"],
package/src/types.ts CHANGED
@@ -369,6 +369,53 @@ export const DeleteReportsByNameArgsSchema = z.object({
369
369
  api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
370
370
  });
371
371
 
372
+ // ── Delete Report by ID (DELETE /reports/{report_id}) ────────────────────
373
+
374
+ export const DeleteReportArgsSchema = z.object({
375
+ report_id: z.number().int().describe("Evaluation pipeline ID to archive"),
376
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
377
+ });
378
+
379
+ // ── Rename Report (PATCH /reports/{report_id}/rename) ────────────────────
380
+
381
+ export const RenameReportArgsSchema = z.object({
382
+ report_id: z.number().int().describe("Evaluation pipeline ID to rename"),
383
+ name: z.string().min(1).max(255).optional().describe("New name for the evaluation pipeline. Provide name, tags, or both."),
384
+ tags: z.array(z.string()).optional().describe("Replace the pipeline's tags. Pass an empty array to clear them. Provide name, tags, or both."),
385
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
386
+ });
387
+
388
+ // ── Add Report Column (POST /report-columns) ─────────────────────────────
389
+
390
+ export const AddReportColumnArgsSchema = z.object({
391
+ report_id: z.number().int().describe("Evaluation pipeline ID to add the column to"),
392
+ column_type: z.string().describe("Column type (e.g. LLM_ASSERTION, CODE_EXECUTION, PROMPT_TEMPLATE). See https://docs.promptlayer.com/features/evaluations/column-types"),
393
+ name: z.string().min(1).describe("Unique column name within the pipeline"),
394
+ configuration: z.record(z.unknown()).describe("Column-type-specific configuration"),
395
+ position: z.number().int().positive().optional().describe("Position in the pipeline (auto-assigned if omitted). Cannot overwrite dataset columns."),
396
+ is_part_of_score: z.boolean().optional().describe("Whether this column contributes to the score (default false)"),
397
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
398
+ });
399
+
400
+ // ── Edit Report Column (PATCH /report-columns/{report_column_id}) ────────
401
+
402
+ export const EditReportColumnArgsSchema = z.object({
403
+ report_column_id: z.number().int().describe("Report column ID to edit"),
404
+ report_id: z.number().int().describe("Parent evaluation pipeline ID (must match the column's report)"),
405
+ column_type: z.string().describe("Column type (e.g. LLM_ASSERTION, CODE_EXECUTION, PROMPT_TEMPLATE). DATASET is not allowed."),
406
+ configuration: z.record(z.unknown()).optional().describe("Replacement column configuration"),
407
+ name: z.string().min(1).optional().describe("New column name (must be unique within the pipeline)"),
408
+ position: z.number().int().positive().optional().describe("New position. Cannot overwrite dataset columns."),
409
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
410
+ });
411
+
412
+ // ── Delete Report Column (DELETE /report-columns/{report_column_id}) ─────
413
+
414
+ export const DeleteReportColumnArgsSchema = z.object({
415
+ report_column_id: z.number().int().describe("Report column ID to delete. Cannot be a DATASET column."),
416
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
417
+ });
418
+
372
419
 
373
420
  // ── List Agents (GET /workflows) ─────────────────────────────────────────
374
421
 
@@ -449,6 +496,34 @@ export const GetWorkflowLabelsArgsSchema = z.object({
449
496
  });
450
497
 
451
498
 
499
+ // ── Tool Registry ────────────────────────────────────────────────────
500
+
501
+ export const ListToolRegistriesArgsSchema = z.object({
502
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
503
+ });
504
+
505
+ export const GetToolRegistryArgsSchema = z.object({
506
+ identifier: z.string().describe("Tool ID (numeric) or name"),
507
+ label: z.string().optional().describe("Resolve version by label name (e.g. 'production')"),
508
+ version: z.number().int().optional().describe("Resolve by specific version number"),
509
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
510
+ });
511
+
512
+ export const CreateToolRegistryArgsSchema = z.object({
513
+ name: z.string().describe("Tool name (unique per workspace)"),
514
+ tool_definition: z.record(z.unknown()).describe("Tool definition in OpenAI function-calling format: {type: 'function', function: {name, description, parameters}}"),
515
+ folder_id: z.number().int().optional().describe("Folder ID to place tool in"),
516
+ commit_message: z.string().optional().describe("Commit message for the initial version"),
517
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
518
+ });
519
+
520
+ export const CreateToolVersionArgsSchema = z.object({
521
+ identifier: z.string().describe("Tool ID (numeric) or name"),
522
+ tool_definition: z.record(z.unknown()).describe("Updated tool definition in OpenAI function-calling format"),
523
+ commit_message: z.string().optional().describe("Commit message describing what changed"),
524
+ api_key: z.string().optional().describe("PromptLayer API key (optional, defaults to PROMPTLAYER_API_KEY env var)"),
525
+ });
526
+
452
527
  export const CreateFolderArgsSchema = z.object({
453
528
  name: z.string().describe("Folder name (unique within parent)"),
454
529
  parent_id: z.number().int().optional().describe("Parent folder ID (root if omitted)"),
@@ -852,6 +927,36 @@ export const TOOL_DEFINITIONS = {
852
927
  inputSchema: DeleteReportsByNameArgsSchema,
853
928
  annotations: { readOnlyHint: false },
854
929
  },
930
+ "delete-report": {
931
+ name: "delete-report",
932
+ description: "Archive a single evaluation pipeline by ID. Prefer this over delete-reports-by-name when you have the report_id, since names can collide.",
933
+ inputSchema: DeleteReportArgsSchema,
934
+ annotations: { readOnlyHint: false },
935
+ },
936
+ "rename-report": {
937
+ name: "rename-report",
938
+ description: "Rename or retag an evaluation pipeline. Provide name, tags, or both. Use this instead of recreating a misnamed pipeline.",
939
+ inputSchema: RenameReportArgsSchema,
940
+ annotations: { readOnlyHint: false },
941
+ },
942
+ "add-report-column": {
943
+ name: "add-report-column",
944
+ description: "Add a single column to an existing evaluation pipeline. Use this to extend a pipeline incrementally instead of recreating the entire report. Column names must be unique within the pipeline. For column types and configuration, see https://docs.promptlayer.com/features/evaluations/column-types.",
945
+ inputSchema: AddReportColumnArgsSchema,
946
+ annotations: { readOnlyHint: false },
947
+ },
948
+ "edit-report-column": {
949
+ name: "edit-report-column",
950
+ description: "Update an existing evaluation column's type, configuration, name, or position. Use this to fix a bug in a CODE_EXECUTION script or change a column's settings without recreating the whole pipeline. Cannot edit DATASET columns.",
951
+ inputSchema: EditReportColumnArgsSchema,
952
+ annotations: { readOnlyHint: false },
953
+ },
954
+ "delete-report-column": {
955
+ name: "delete-report-column",
956
+ description: "Delete a single column from an evaluation pipeline. Cannot delete DATASET columns. Surrounding columns shift left to fill the gap.",
957
+ inputSchema: DeleteReportColumnArgsSchema,
958
+ annotations: { readOnlyHint: false },
959
+ },
855
960
 
856
961
  // ── Agents / Workflows ──────────────────────────────────────────────
857
962
  "list-workflows": {
@@ -897,6 +1002,32 @@ export const TOOL_DEFINITIONS = {
897
1002
  annotations: { readOnlyHint: true },
898
1003
  },
899
1004
 
1005
+ // ── Tool Registry ───────────────────────────────────────────────────
1006
+ "list-tool-registries": {
1007
+ name: "list-tool-registries",
1008
+ description: "List all tools in the Tool Registry for the workspace. Returns tool names, IDs, and metadata.",
1009
+ inputSchema: ListToolRegistriesArgsSchema,
1010
+ annotations: { readOnlyHint: true },
1011
+ },
1012
+ "get-tool-registry": {
1013
+ name: "get-tool-registry",
1014
+ description: "Get a tool from the Tool Registry by ID or name. Optionally resolve a specific version by label or version number. Returns the tool definition and metadata.",
1015
+ inputSchema: GetToolRegistryArgsSchema,
1016
+ annotations: { readOnlyHint: true },
1017
+ },
1018
+ "create-tool-registry": {
1019
+ name: "create-tool-registry",
1020
+ description: "Create a new tool in the Tool Registry with an initial version. The tool definition should be in OpenAI function-calling format.",
1021
+ inputSchema: CreateToolRegistryArgsSchema,
1022
+ annotations: { readOnlyHint: false },
1023
+ },
1024
+ "create-tool-version": {
1025
+ name: "create-tool-version",
1026
+ description: "Create a new version of an existing tool in the Tool Registry. Each version is immutable — this adds a new version with the updated definition.",
1027
+ inputSchema: CreateToolVersionArgsSchema,
1028
+ annotations: { readOnlyHint: false },
1029
+ },
1030
+
900
1031
  // ── Folders ─────────────────────────────────────────────────────────
901
1032
  "create-folder": {
902
1033
  name: "create-folder",