@neon/tools 2.14.3 → 2.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/README.md +79 -2
- package/dist/effect.d.ts +22 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +3 -0
- package/dist/generated/output.gen.d.ts +3418 -0
- package/dist/generated/output.gen.d.ts.map +1 -0
- package/dist/generated/output.gen.js +1498 -0
- package/dist/lib/custom/auth-config.d.ts +63 -1
- package/dist/lib/custom/auth-config.d.ts.map +1 -1
- package/dist/lib/custom/auth-config.js +21 -1
- package/dist/lib/custom/docs.d.ts +32 -2
- package/dist/lib/custom/docs.d.ts.map +1 -1
- package/dist/lib/custom/docs.js +16 -1
- package/dist/lib/custom/feedback.d.ts +7 -2
- package/dist/lib/custom/feedback.d.ts.map +1 -1
- package/dist/lib/custom/feedback.js +2 -0
- package/dist/lib/custom/fetch.d.ts +15 -1
- package/dist/lib/custom/fetch.d.ts.map +1 -1
- package/dist/lib/custom/fetch.js +9 -1
- package/dist/lib/custom/organizations.d.ts +23 -1
- package/dist/lib/custom/organizations.d.ts.map +1 -1
- package/dist/lib/custom/organizations.js +2 -0
- package/dist/lib/custom/resources.d.ts +15 -1
- package/dist/lib/custom/resources.d.ts.map +1 -1
- package/dist/lib/custom/resources.js +7 -1
- package/dist/lib/custom/sql/connection.js +1 -1
- package/dist/lib/custom/sql/describe-branch.d.ts +99 -1
- package/dist/lib/custom/sql/describe-branch.d.ts.map +1 -1
- package/dist/lib/custom/sql/describe-branch.js +9 -0
- package/dist/lib/custom/sql/inspect/inspect.d.ts +27 -1
- package/dist/lib/custom/sql/inspect/inspect.d.ts.map +1 -1
- package/dist/lib/custom/sql/inspect/inspect.js +15 -1
- package/dist/lib/custom/sql/migrations.d.ts +46 -2
- package/dist/lib/custom/sql/migrations.d.ts.map +1 -1
- package/dist/lib/custom/sql/migrations.js +26 -2
- package/dist/lib/custom/sql/plan.d.ts +8 -2
- package/dist/lib/custom/sql/plan.d.ts.map +1 -1
- package/dist/lib/custom/sql/plan.js +13 -6
- package/dist/lib/custom/sql/query-tuning.d.ts +90 -2
- package/dist/lib/custom/sql/query-tuning.d.ts.map +1 -1
- package/dist/lib/custom/sql/query-tuning.js +33 -8
- package/dist/lib/custom/sql/run.d.ts +30 -3
- package/dist/lib/custom/sql/run.d.ts.map +1 -1
- package/dist/lib/custom/sql/run.js +11 -1
- package/dist/lib/custom/sql/schema.d.ts +76 -2
- package/dist/lib/custom/sql/schema.d.ts.map +1 -1
- package/dist/lib/custom/sql/schema.js +78 -36
- package/dist/lib/custom/sql/slow-queries.d.ts +15 -1
- package/dist/lib/custom/sql/slow-queries.d.ts.map +1 -1
- package/dist/lib/custom/sql/slow-queries.js +9 -1
- package/dist/lib/effect/errors.d.ts +51 -0
- package/dist/lib/effect/errors.d.ts.map +1 -0
- package/dist/lib/effect/errors.js +37 -0
- package/dist/lib/effect/tools.d.ts +56 -0
- package/dist/lib/effect/tools.d.ts.map +1 -0
- package/dist/lib/effect/tools.js +67 -0
- package/dist/lib/ergonomic/bind.d.ts +20 -6
- package/dist/lib/ergonomic/bind.d.ts.map +1 -1
- package/dist/lib/ergonomic/bind.js +2 -1
- package/dist/lib/ergonomic/catalog.d.ts +5333 -172
- package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
- package/dist/lib/ergonomic/catalog.js +186 -1
- package/dist/lib/ergonomic/composed.d.ts +866 -12
- package/dist/lib/ergonomic/composed.d.ts.map +1 -1
- package/dist/lib/ergonomic/composed.js +34 -0
- package/dist/lib/mcp-json-schema.d.ts +20 -0
- package/dist/lib/mcp-json-schema.d.ts.map +1 -1
- package/dist/lib/mcp-json-schema.js +89 -1
- package/dist/lib/mcp-register.d.ts +1 -1
- package/dist/lib/mcp-register.d.ts.map +1 -1
- package/dist/lib/mcp-register.js +2 -1
- package/dist/lib/operation.d.ts +6 -1
- package/dist/lib/operation.d.ts.map +1 -1
- package/dist/mcp-v1.d.ts.map +1 -1
- package/dist/mcp-v1.js +3 -1
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +3 -3
- package/dist/operations.gen.d.ts +194 -194
- package/package.json +22 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composed.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/composed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"composed.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/composed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAUzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAwD1E,eAAO,MAAM,uBAAuB;;;;;;;;;;kBAuBjC,CAAC;AAEJ,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAQ5C,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAEnC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG7C,CAAC;AAEH,eAAO,MAAM,qBAAqB;;kBAIhC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;kBAWrC,CAAC;AAIH,eAAO,MAAM,wBAAwB;;;;;;;;;kBAiBnC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;kBAuCpC,CAAC;AAoBH,eAAO,MAAM,kBAAkB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC3D,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;kBAatC,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;kBAgD/B,CAAC;AAEJ,eAAO,M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,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { pathInputDescriptions } from "../../descriptions.gen.js";
|
|
|
2
2
|
import { zBackupScheduleItem, zBranchCreateRequest, zBranchRestoreRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zCreateProjectBranchRoleBody, zCreateProjectBranchRolePath, zGetConnectionUriPath, zGetConnectionUriQuery, zGetProjectBranchSchemaComparisonPath, zGetProjectBranchSchemaComparisonQuery, zListProjectBranchesPath, zQueryProjectBranchLogsPath, zRestoreProjectBranchPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
|
|
3
3
|
import { bindTool, publishedId } from "./bind.js";
|
|
4
4
|
import { COMPUTE_ID_DESCRIPTION, databaseNameField, resolveConnection, roleNameField } from "../custom/sql/connection.js";
|
|
5
|
+
import { Branch, BranchSchemaCompareResponse, Endpoint, Project, Role } from "../../generated/output.gen.js";
|
|
5
6
|
import * as z from "zod";
|
|
6
7
|
// src/lib/ergonomic/composed.ts
|
|
7
8
|
const writeAnnotations = {
|
|
@@ -80,12 +81,24 @@ const lokiQueryRangeInputSchema = z.strictObject({
|
|
|
80
81
|
limit: z.number().int().positive().describe("Maximum log lines. The server enforces its own cap.").optional(),
|
|
81
82
|
direction: z.enum(["forward", "backward"]).describe("backward (default) is newest first.").optional()
|
|
82
83
|
});
|
|
84
|
+
const lokiQueryRangeOutputSchema = z.looseObject({
|
|
85
|
+
status: z.string().describe("Loki's response status, `success`."),
|
|
86
|
+
data: z.looseObject({
|
|
87
|
+
resultType: z.string(),
|
|
88
|
+
result: z.array(z.looseObject({
|
|
89
|
+
stream: z.record(z.string(), z.string()),
|
|
90
|
+
values: z.array(z.array(z.string()))
|
|
91
|
+
}))
|
|
92
|
+
}).describe("Log streams: each has its labels and `[timestamp_ns, line]` pairs."),
|
|
93
|
+
warnings: z.array(z.string()).nullish().describe("Loki query warnings.")
|
|
94
|
+
});
|
|
83
95
|
const lokiQueryRangeTool = (options) => bindTool(options, {
|
|
84
96
|
operationId: "logs.loki.queryRange",
|
|
85
97
|
id: publishedId("logs.loki.queryRange"),
|
|
86
98
|
title: "Query branch logs (Loki)",
|
|
87
99
|
description: "Runs a LogQL range query on a branch's logs and returns Loki's response: data.result groups lines by stream label as [nanosecond timestamp, line]. {{logs.query}} has structured filters; {{logs.fields}} and {{logs.fieldValues}} list labels. No cursor: limit lines, or the silent 10,000 cap, may mean more exist; narrow the window.",
|
|
88
100
|
inputSchema: lokiQueryRangeInputSchema,
|
|
101
|
+
outputSchema: lokiQueryRangeOutputSchema,
|
|
89
102
|
annotations: {
|
|
90
103
|
readOnlyHint: true,
|
|
91
104
|
destructiveHint: false,
|
|
@@ -165,6 +178,7 @@ const createBranchTool = (options) => bindTool(options, {
|
|
|
165
178
|
title: "Create branch",
|
|
166
179
|
description: "Creates a branch from its parent's current data, with a read-write compute unless no_compute, and waits until it is ready. Returns no connection string; use {{postgres.connectionString}}.",
|
|
167
180
|
inputSchema: createBranchInputSchema,
|
|
181
|
+
outputSchema: Branch,
|
|
168
182
|
annotations: writeAnnotations,
|
|
169
183
|
requiresApproval: true,
|
|
170
184
|
metadata: {
|
|
@@ -188,12 +202,18 @@ const createBranchTool = (options) => bindTool(options, {
|
|
|
188
202
|
compute: mapCompute(input.compute)
|
|
189
203
|
}, { signal });
|
|
190
204
|
});
|
|
205
|
+
const branchConnectionOutputSchema = z.looseObject({
|
|
206
|
+
branch: Branch.describe("The created branch."),
|
|
207
|
+
endpoint: Endpoint.describe("The branch's read-write compute."),
|
|
208
|
+
connectionString: z.string().describe("Connection string for the branch's database.")
|
|
209
|
+
});
|
|
191
210
|
const createBranchAndConnectTool = (options) => bindTool(options, {
|
|
192
211
|
operationId: "branches.createAndConnect",
|
|
193
212
|
id: publishedId("branches.createAndConnect"),
|
|
194
213
|
title: "Create branch and connect",
|
|
195
214
|
description: "Creates a branch with a read-write compute, waits until it is ready, and returns its connection string.",
|
|
196
215
|
inputSchema: createBranchAndConnectInputSchema,
|
|
216
|
+
outputSchema: branchConnectionOutputSchema,
|
|
197
217
|
annotations: writeAnnotations,
|
|
198
218
|
requiresApproval: true,
|
|
199
219
|
metadata: {
|
|
@@ -216,6 +236,7 @@ const createProjectTool = (options) => bindTool(options, {
|
|
|
216
236
|
title: "Create project",
|
|
217
237
|
description: "Creates a project with a default branch and read-write compute and waits until it is ready. Returns no connection string; use {{postgres.connectionString}}.",
|
|
218
238
|
inputSchema: createProjectInputSchema,
|
|
239
|
+
outputSchema: Project,
|
|
219
240
|
annotations: writeAnnotations,
|
|
220
241
|
requiresApproval: true,
|
|
221
242
|
metadata: {
|
|
@@ -226,12 +247,17 @@ const createProjectTool = (options) => bindTool(options, {
|
|
|
226
247
|
tags: ["Project"]
|
|
227
248
|
}
|
|
228
249
|
}, (neon, input, signal) => neon.projects.create(input, { signal }));
|
|
250
|
+
const projectConnectionOutputSchema = z.looseObject({
|
|
251
|
+
project: Project.describe("The created project."),
|
|
252
|
+
connectionString: z.string().describe("Connection string for the default branch's database.")
|
|
253
|
+
});
|
|
229
254
|
const createProjectAndConnectTool = (options) => bindTool(options, {
|
|
230
255
|
operationId: "projects.createAndConnect",
|
|
231
256
|
id: publishedId("projects.createAndConnect"),
|
|
232
257
|
title: "Create project and connect",
|
|
233
258
|
description: "Creates a project, waits until its default branch is ready, and returns a connection string to it.",
|
|
234
259
|
inputSchema: createProjectAndConnectInputSchema,
|
|
260
|
+
outputSchema: projectConnectionOutputSchema,
|
|
235
261
|
annotations: writeAnnotations,
|
|
236
262
|
requiresApproval: true,
|
|
237
263
|
metadata: {
|
|
@@ -248,6 +274,7 @@ const getDefaultTool = (options) => bindTool(options, {
|
|
|
248
274
|
title: "Get default branch",
|
|
249
275
|
description: "Gets the project's default branch by its default flag, not its name.",
|
|
250
276
|
inputSchema: getDefaultInputSchema,
|
|
277
|
+
outputSchema: Branch,
|
|
251
278
|
annotations: readAnnotations,
|
|
252
279
|
requiresApproval: false,
|
|
253
280
|
metadata: {
|
|
@@ -264,6 +291,7 @@ const resetFromParentTool = (options) => bindTool(options, {
|
|
|
264
291
|
title: "Reset branch from parent",
|
|
265
292
|
description: "Resets a branch to its parent's current state, discarding the branch's own changes. NEVER run autonomously; always ask the user first. preserve_under_name first saves the current state as a new branch. To restore a snapshot, use {{snapshots.restore}}.",
|
|
266
293
|
inputSchema: resetFromParentInputSchema,
|
|
294
|
+
outputSchema: Branch,
|
|
267
295
|
annotations: writeAnnotations,
|
|
268
296
|
requiresApproval: true,
|
|
269
297
|
metadata: {
|
|
@@ -284,6 +312,7 @@ const compareSchemaTool = (options) => bindTool(options, {
|
|
|
284
312
|
title: "Compare database schema",
|
|
285
313
|
description: "Diffs one database's SQL schema on a branch against another branch, by default its parent. lsn, timestamp, base_lsn, and base_timestamp are only for point-in-time comparisons.",
|
|
286
314
|
inputSchema: compareSchemaInputSchema,
|
|
315
|
+
outputSchema: BranchSchemaCompareResponse,
|
|
287
316
|
annotations: readAnnotations,
|
|
288
317
|
requiresApproval: false,
|
|
289
318
|
metadata: {
|
|
@@ -303,12 +332,14 @@ const compareSchemaTool = (options) => bindTool(options, {
|
|
|
303
332
|
...input.base_lsn === void 0 ? {} : { baseLsn: input.base_lsn },
|
|
304
333
|
...input.base_timestamp === void 0 ? {} : { baseTimestamp: input.base_timestamp }
|
|
305
334
|
}, { signal }));
|
|
335
|
+
const connectionStringOutputSchema = z.string().describe("A postgresql:// connection string.");
|
|
306
336
|
const connectionStringTool = (options) => bindTool(options, {
|
|
307
337
|
operationId: "postgres.connectionString",
|
|
308
338
|
id: publishedId("postgres.connectionString"),
|
|
309
339
|
title: "Get connection string",
|
|
310
340
|
description: "Returns a Postgres connection string with a role password; the branch needs a compute. Omitted inputs resolve like the SQL tools: default branch, neondb or the first database, and its owner. Call it after {{projects.create}} or {{branches.create}}, which return none.",
|
|
311
341
|
inputSchema: connectionStringInputSchema,
|
|
342
|
+
outputSchema: connectionStringOutputSchema,
|
|
312
343
|
annotations: readAnnotations,
|
|
313
344
|
requiresApproval: true,
|
|
314
345
|
metadata: {
|
|
@@ -331,6 +362,7 @@ const createRoleTool = (options) => bindTool(options, {
|
|
|
331
362
|
title: "Create role",
|
|
332
363
|
description: "Creates a Postgres role on a branch and returns its password. The default access, admin, joins neon_superuser: every database, creating databases and roles, bypassing row-level security, and it cannot be narrowed later. For least privilege pass read_only or read_write with database_name and schemas, covering the tables the database owner owns, now and later.",
|
|
333
364
|
inputSchema: createRoleInputSchema,
|
|
365
|
+
outputSchema: Role,
|
|
334
366
|
annotations: writeAnnotations,
|
|
335
367
|
requiresApproval: true,
|
|
336
368
|
metadata: {
|
|
@@ -361,6 +393,7 @@ const restoreSnapshotTool = (options) => bindTool(options, {
|
|
|
361
393
|
title: "Restore snapshot",
|
|
362
394
|
description: "Restores a snapshot into a new branch and waits until it is ready. finalize true replaces target_branch_id (default: the snapshot's source branch) with it. NEVER finalize autonomously; ask the user first. Swap in later with {{branches.finalizeRestore}}.",
|
|
363
395
|
inputSchema: restoreSnapshotInputSchema,
|
|
396
|
+
outputSchema: Branch,
|
|
364
397
|
annotations: writeAnnotations,
|
|
365
398
|
requiresApproval: true,
|
|
366
399
|
metadata: {
|
|
@@ -383,6 +416,7 @@ const setScheduleTool = (options) => bindTool(options, {
|
|
|
383
416
|
title: "Set snapshot schedule",
|
|
384
417
|
description: "Replaces a branch's automatic snapshot schedule.",
|
|
385
418
|
inputSchema: setScheduleInputSchema,
|
|
419
|
+
outputSchema: z.null(),
|
|
386
420
|
annotations: writeAnnotations,
|
|
387
421
|
requiresApproval: true,
|
|
388
422
|
metadata: {
|
|
@@ -11,5 +11,25 @@ export interface McpStandardSchema {
|
|
|
11
11
|
validate: (value: unknown) => unknown;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
export interface McpOutputSchemaOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Field names the host removes from results before returning them, such as
|
|
17
|
+
* credentials. They are dropped from the schema at every level, so a result
|
|
18
|
+
* without them still validates.
|
|
19
|
+
*/
|
|
20
|
+
omit?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The JSON Schema MCP publishes for a tool's `structuredContent`:
|
|
24
|
+
* `{ data: <compact output schema> }`. Failed calls return `{ error }` with
|
|
25
|
+
* `isError`, which MCP does not validate.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toMcpOutputJsonSchema: (outputSchema: z.ZodType, options?: McpOutputSchemaOptions) => Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Publishes {@link toMcpOutputJsonSchema} and validates `structuredContent`
|
|
30
|
+
* against that same compact schema, so the server rejects exactly what a
|
|
31
|
+
* validating client would. Validation returns the content unchanged.
|
|
32
|
+
*/
|
|
33
|
+
export declare const toMcpOutputSchema: (outputSchema: z.ZodType, options?: McpOutputSchemaOptions) => McpStandardSchema;
|
|
14
34
|
export declare const toMcpInputSchema: (schema: z.ZodType) => McpStandardSchema;
|
|
15
35
|
//# sourceMappingURL=mcp-json-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-json-schema.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,KAAG,OAOjD,CAAC;AAMF,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE;YACX,KAAK,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACrC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACtC,CAAC;QACF,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;KACtC,CAAC;CACF;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,iBAiCpD,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp-json-schema.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,KAAG,OAOjD,CAAC;AAMF,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE;YACX,KAAK,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACrC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACtC,CAAC;QACF,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;KACtC,CAAC;CACF;AAqHD,MAAM,WAAW,sBAAsB;IACtC;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GACjC,cAAc,CAAC,CAAC,OAAO,EACvB,UAAS,sBAA2B,KAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAUvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC7B,cAAc,CAAC,CAAC,OAAO,EACvB,UAAS,sBAA2B,KAClC,iBAoBF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,iBAiCpD,CAAC"}
|
|
@@ -8,6 +8,94 @@ const compactJsonSchema = (node) => {
|
|
|
8
8
|
return rest;
|
|
9
9
|
};
|
|
10
10
|
const isStandardValidate = (value) => typeof value === "function";
|
|
11
|
+
/**
|
|
12
|
+
* Levels of `data` that keep their properties: the fields of `data`, or of each
|
|
13
|
+
* list item, are typed, and objects below them are `{ "type": "object" }`. Every
|
|
14
|
+
* listed level adds to `tools/list` for every tool and to what a validating
|
|
15
|
+
* client can reject.
|
|
16
|
+
*/
|
|
17
|
+
const OUTPUT_PROPERTY_DEPTH = 1;
|
|
18
|
+
/** Levels of `data` that keep their descriptions. */
|
|
19
|
+
const OUTPUT_DESCRIPTION_DEPTH = 1;
|
|
20
|
+
const jsonType = (node) => {
|
|
21
|
+
const keys = Object.keys(node);
|
|
22
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
23
|
+
return Array.isArray(node.type) ? node.type : [node.type];
|
|
24
|
+
};
|
|
25
|
+
const compactUnion = (members) => {
|
|
26
|
+
const unique = members.filter((member, index) => members.findIndex((other) => JSON.stringify(other) === JSON.stringify(member)) === index);
|
|
27
|
+
const types = unique.map((member) => isPlainObject(member) ? jsonType(member) : void 0);
|
|
28
|
+
if (types.every((type) => type !== void 0)) {
|
|
29
|
+
const flat = [...new Set(types.flat())];
|
|
30
|
+
return { type: flat.length === 1 ? flat[0] : flat };
|
|
31
|
+
}
|
|
32
|
+
return unique.length === 1 && isPlainObject(unique[0]) ? unique[0] : { anyOf: unique };
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Types, properties, and required keys down to {@link OUTPUT_PROPERTY_DEPTH};
|
|
36
|
+
* descriptions down to {@link OUTPUT_DESCRIPTION_DEPTH}. Array items share their
|
|
37
|
+
* array's depth, so a list's items read like a single result. Formats, patterns,
|
|
38
|
+
* bounds, and `additionalProperties` are dropped: results may carry fields the
|
|
39
|
+
* spec does not list yet.
|
|
40
|
+
*/
|
|
41
|
+
const compactOutputNode = (node, depth, omit) => {
|
|
42
|
+
if (!isPlainObject(node)) return node;
|
|
43
|
+
const out = {};
|
|
44
|
+
if (depth <= OUTPUT_DESCRIPTION_DEPTH && typeof node.description === "string") out.description = node.description;
|
|
45
|
+
if (node.type !== void 0) out.type = node.type;
|
|
46
|
+
if (Array.isArray(node.enum)) out.enum = node.enum;
|
|
47
|
+
if (node.const !== void 0) out.const = node.const;
|
|
48
|
+
const union = Array.isArray(node.anyOf) ? node.anyOf : Array.isArray(node.oneOf) ? node.oneOf : void 0;
|
|
49
|
+
if (union !== void 0) {
|
|
50
|
+
const members = union.map((member) => {
|
|
51
|
+
const compact = compactOutputNode(member, depth, omit);
|
|
52
|
+
if (!isPlainObject(compact)) return compact;
|
|
53
|
+
const { description, ...rest } = compact;
|
|
54
|
+
if (out.description === void 0 && typeof description === "string") out.description = description;
|
|
55
|
+
return rest;
|
|
56
|
+
});
|
|
57
|
+
Object.assign(out, compactUnion(members));
|
|
58
|
+
}
|
|
59
|
+
if (node.items !== void 0) out.items = compactOutputNode(node.items, depth, omit);
|
|
60
|
+
if (depth < OUTPUT_PROPERTY_DEPTH && isPlainObject(node.properties)) {
|
|
61
|
+
out.properties = Object.fromEntries(Object.entries(node.properties).filter(([key]) => !omit.has(key)).map(([key, value]) => [key, compactOutputNode(value, depth + 1, omit)]));
|
|
62
|
+
const required = Array.isArray(node.required) ? node.required.filter((key) => typeof key === "string" && !omit.has(key)) : [];
|
|
63
|
+
if (required.length > 0) out.required = required;
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The JSON Schema MCP publishes for a tool's `structuredContent`:
|
|
69
|
+
* `{ data: <compact output schema> }`. Failed calls return `{ error }` with
|
|
70
|
+
* `isError`, which MCP does not validate.
|
|
71
|
+
*/
|
|
72
|
+
const toMcpOutputJsonSchema = (outputSchema, options = {}) => ({
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: { data: compactOutputNode(z.toJSONSchema(outputSchema, { io: "input" }), 0, new Set(options.omit)) },
|
|
75
|
+
required: ["data"]
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Publishes {@link toMcpOutputJsonSchema} and validates `structuredContent`
|
|
79
|
+
* against that same compact schema, so the server rejects exactly what a
|
|
80
|
+
* validating client would. Validation returns the content unchanged.
|
|
81
|
+
*/
|
|
82
|
+
const toMcpOutputSchema = (outputSchema, options = {}) => {
|
|
83
|
+
const json = toMcpOutputJsonSchema(outputSchema, options);
|
|
84
|
+
let validator;
|
|
85
|
+
return { "~standard": {
|
|
86
|
+
version: 1,
|
|
87
|
+
vendor: "neon",
|
|
88
|
+
jsonSchema: {
|
|
89
|
+
input: () => json,
|
|
90
|
+
output: () => json
|
|
91
|
+
},
|
|
92
|
+
validate: (value) => {
|
|
93
|
+
validator ??= z.fromJSONSchema(json);
|
|
94
|
+
const parsed = validator.safeParse(value);
|
|
95
|
+
return parsed.success ? { value } : { issues: parsed.error.issues };
|
|
96
|
+
}
|
|
97
|
+
} };
|
|
98
|
+
};
|
|
11
99
|
const toMcpInputSchema = (schema) => {
|
|
12
100
|
const json = compactJsonSchema(z.toJSONSchema(schema, { io: "input" }));
|
|
13
101
|
if (!isPlainObject(json)) throw new TypeError("MCP tool input schemas must be JSON Schema objects");
|
|
@@ -27,4 +115,4 @@ const toMcpInputSchema = (schema) => {
|
|
|
27
115
|
}
|
|
28
116
|
} };
|
|
29
117
|
};
|
|
30
|
-
export { compactJsonSchema, toMcpInputSchema };
|
|
118
|
+
export { compactJsonSchema, toMcpInputSchema, toMcpOutputJsonSchema, toMcpOutputSchema };
|
|
@@ -10,5 +10,5 @@ export interface McpToolResult {
|
|
|
10
10
|
export interface McpToolServer {
|
|
11
11
|
registerTool: object;
|
|
12
12
|
}
|
|
13
|
-
export declare const registerNeonToolsWithSchema: (server: McpToolServer, tools: Readonly<Record<string, NeonTool>>, inputSchema: (tool: NeonTool) => unknown) => void;
|
|
13
|
+
export declare const registerNeonToolsWithSchema: (server: McpToolServer, tools: Readonly<Record<string, NeonTool>>, inputSchema: (tool: NeonTool) => unknown, outputSchema: (schema: NonNullable<NeonTool["outputSchema"]>) => unknown) => void;
|
|
14
14
|
//# sourceMappingURL=mcp-register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-register.d.ts","sourceRoot":"","sources":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AAC,CAAC,KAAK,OAAO,KACtE,IAqBF,CAAC"}
|
package/dist/lib/mcp-register.js
CHANGED
|
@@ -58,7 +58,7 @@ const createToolHandler = (tool) => async (input, context) => {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
const registerNeonToolsWithSchema = (server, tools, inputSchema) => {
|
|
61
|
+
const registerNeonToolsWithSchema = (server, tools, inputSchema, outputSchema) => {
|
|
62
62
|
if (typeof server.registerTool !== "function") throw new TypeError("Expected an MCP server with registerTool().");
|
|
63
63
|
for (const tool of Object.values(tools)) Reflect.apply(server.registerTool, server, [
|
|
64
64
|
tool.id,
|
|
@@ -66,6 +66,7 @@ const registerNeonToolsWithSchema = (server, tools, inputSchema) => {
|
|
|
66
66
|
title: tool.title,
|
|
67
67
|
description: tool.description,
|
|
68
68
|
inputSchema: inputSchema(tool),
|
|
69
|
+
...tool.outputSchema === void 0 ? {} : { outputSchema: outputSchema(tool.outputSchema) },
|
|
69
70
|
annotations: tool.annotations,
|
|
70
71
|
_meta: { "neon/requiresApproval": tool.requiresApproval }
|
|
71
72
|
},
|
package/dist/lib/operation.d.ts
CHANGED
|
@@ -40,12 +40,17 @@ export type JsonSafe<Value> = unknown extends Value ? unknown : Value extends nu
|
|
|
40
40
|
export interface NeonToolResult<Data = unknown> {
|
|
41
41
|
data: Data;
|
|
42
42
|
}
|
|
43
|
-
export interface NeonTool<InputSchema extends z.ZodType = z.ZodType, Id extends string = string, Output = unknown> {
|
|
43
|
+
export interface NeonTool<InputSchema extends z.ZodType = z.ZodType, Id extends string = string, Output = unknown, OutputSchema extends z.ZodType = z.ZodType> {
|
|
44
44
|
operationId: string;
|
|
45
45
|
id: Id;
|
|
46
46
|
title: string;
|
|
47
47
|
description: string;
|
|
48
48
|
inputSchema: InputSchema;
|
|
49
|
+
/**
|
|
50
|
+
* The shape of `execute()`'s `data`. It describes results; it does not
|
|
51
|
+
* validate them. Every catalog tool has one; hand-built tools may omit it.
|
|
52
|
+
*/
|
|
53
|
+
outputSchema?: OutputSchema;
|
|
49
54
|
annotations: NeonToolAnnotations;
|
|
50
55
|
requiresApproval: boolean;
|
|
51
56
|
metadata: NeonToolMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/lib/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,KAAK,oBAAoB,EAA2B,MAAM,WAAW,CAAC;AAG/E,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAA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AAe,GAC3B,KAAK,CAAC,WAAW,SAAS,CAAC,CAAC,OAAO,EACnC,KAAK,CAAC,EAAE,SAAS,MAAM,EACvB,MAAM,EAEN,WAAW,aAAa,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,2CACpC,CAAC;AAEf,eAAO,MAAM,aAAa,GACzB,KAAK,CAAC,WAAW,SAAS,CAAC,CAAC,OAAO,EACnC,KAAK,CAAC,EAAE,SAAS,MAAM,EACvB,MAAM,EAEN,WAAW,aAAa,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EACjD,QAAQ,MAAM,KACZ,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAsBpD,CAAC"}
|
package/dist/mcp-v1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-v1.d.ts","sourceRoot":"","sources":["../src/mcp-v1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-v1.d.ts","sourceRoot":"","sources":["../src/mcp-v1.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAE7C,eAAO,MAAM,iBAAiB,GAC7B,QAAQ,aAAa,EACrB,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,KACvC,IAOF,CAAC"}
|
package/dist/mcp-v1.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { toMcpOutputJsonSchema } from "./lib/mcp-json-schema.js";
|
|
1
2
|
import { registerNeonToolsWithSchema } from "./lib/mcp-register.js";
|
|
3
|
+
import * as z from "zod";
|
|
2
4
|
// src/mcp-v1.ts
|
|
3
5
|
const registerNeonTools = (server, tools) => {
|
|
4
|
-
registerNeonToolsWithSchema(server, tools, (tool) => tool.inputSchema);
|
|
6
|
+
registerNeonToolsWithSchema(server, tools, (tool) => tool.inputSchema, (schema) => z.fromJSONSchema(toMcpOutputJsonSchema(schema)));
|
|
5
7
|
};
|
|
6
8
|
export { registerNeonTools };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { compactJsonSchema, toMcpInputSchema } from "./lib/mcp-json-schema.js";
|
|
1
|
+
import { compactJsonSchema, toMcpInputSchema, toMcpOutputJsonSchema, toMcpOutputSchema } from "./lib/mcp-json-schema.js";
|
|
2
2
|
import { type McpToolResult, type McpToolServer } from "./lib/mcp-register.js";
|
|
3
3
|
import type { NeonTool } from "./lib/operation.js";
|
|
4
|
-
export type { McpStandardSchema } from "./lib/mcp-json-schema.js";
|
|
4
|
+
export type { McpOutputSchemaOptions, McpStandardSchema, } from "./lib/mcp-json-schema.js";
|
|
5
5
|
export type { McpToolResult, McpToolServer };
|
|
6
|
-
export { compactJsonSchema, toMcpInputSchema };
|
|
6
|
+
export { compactJsonSchema, toMcpInputSchema, toMcpOutputJsonSchema, toMcpOutputSchema, };
|
|
7
7
|
export declare const registerNeonTools: (server: McpToolServer, tools: Readonly<Record<string, NeonTool>>) => void;
|
|
8
8
|
//# sourceMappingURL=mcp.d.ts.map
|
package/dist/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,YAAY,EACX,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAC7C,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC7B,QAAQ,aAAa,EACrB,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,KACvC,IAOF,CAAC"}
|
package/dist/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { compactJsonSchema, toMcpInputSchema, toMcpOutputJsonSchema, toMcpOutputSchema } from "./lib/mcp-json-schema.js";
|
|
1
2
|
import { registerNeonToolsWithSchema } from "./lib/mcp-register.js";
|
|
2
|
-
import { compactJsonSchema, toMcpInputSchema } from "./lib/mcp-json-schema.js";
|
|
3
3
|
// src/mcp.ts
|
|
4
4
|
const registerNeonTools = (server, tools) => {
|
|
5
|
-
registerNeonToolsWithSchema(server, tools, (tool) => toMcpInputSchema(tool.inputSchema));
|
|
5
|
+
registerNeonToolsWithSchema(server, tools, (tool) => toMcpInputSchema(tool.inputSchema), toMcpOutputSchema);
|
|
6
6
|
};
|
|
7
|
-
export { compactJsonSchema, registerNeonTools, toMcpInputSchema };
|
|
7
|
+
export { compactJsonSchema, registerNeonTools, toMcpInputSchema, toMcpOutputJsonSchema, toMcpOutputSchema };
|