@neon/tools 2.14.4 → 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.
Files changed (77) hide show
  1. package/README.md +78 -1
  2. package/dist/effect.d.ts +22 -0
  3. package/dist/effect.d.ts.map +1 -0
  4. package/dist/effect.js +3 -0
  5. package/dist/generated/output.gen.d.ts +3418 -0
  6. package/dist/generated/output.gen.d.ts.map +1 -0
  7. package/dist/generated/output.gen.js +1498 -0
  8. package/dist/lib/custom/auth-config.d.ts +63 -1
  9. package/dist/lib/custom/auth-config.d.ts.map +1 -1
  10. package/dist/lib/custom/auth-config.js +21 -1
  11. package/dist/lib/custom/docs.d.ts +32 -2
  12. package/dist/lib/custom/docs.d.ts.map +1 -1
  13. package/dist/lib/custom/docs.js +16 -1
  14. package/dist/lib/custom/feedback.d.ts +7 -2
  15. package/dist/lib/custom/feedback.d.ts.map +1 -1
  16. package/dist/lib/custom/feedback.js +2 -0
  17. package/dist/lib/custom/fetch.d.ts +15 -1
  18. package/dist/lib/custom/fetch.d.ts.map +1 -1
  19. package/dist/lib/custom/fetch.js +9 -1
  20. package/dist/lib/custom/organizations.d.ts +23 -1
  21. package/dist/lib/custom/organizations.d.ts.map +1 -1
  22. package/dist/lib/custom/organizations.js +2 -0
  23. package/dist/lib/custom/resources.d.ts +15 -1
  24. package/dist/lib/custom/resources.d.ts.map +1 -1
  25. package/dist/lib/custom/resources.js +7 -1
  26. package/dist/lib/custom/sql/connection.js +1 -1
  27. package/dist/lib/custom/sql/describe-branch.d.ts +99 -1
  28. package/dist/lib/custom/sql/describe-branch.d.ts.map +1 -1
  29. package/dist/lib/custom/sql/describe-branch.js +9 -0
  30. package/dist/lib/custom/sql/inspect/inspect.d.ts +27 -1
  31. package/dist/lib/custom/sql/inspect/inspect.d.ts.map +1 -1
  32. package/dist/lib/custom/sql/inspect/inspect.js +15 -1
  33. package/dist/lib/custom/sql/migrations.d.ts +46 -2
  34. package/dist/lib/custom/sql/migrations.d.ts.map +1 -1
  35. package/dist/lib/custom/sql/migrations.js +26 -2
  36. package/dist/lib/custom/sql/query-tuning.d.ts +90 -2
  37. package/dist/lib/custom/sql/query-tuning.d.ts.map +1 -1
  38. package/dist/lib/custom/sql/query-tuning.js +28 -3
  39. package/dist/lib/custom/sql/run.d.ts +30 -3
  40. package/dist/lib/custom/sql/run.d.ts.map +1 -1
  41. package/dist/lib/custom/sql/run.js +11 -1
  42. package/dist/lib/custom/sql/schema.d.ts +76 -2
  43. package/dist/lib/custom/sql/schema.d.ts.map +1 -1
  44. package/dist/lib/custom/sql/schema.js +31 -2
  45. package/dist/lib/custom/sql/slow-queries.d.ts +15 -1
  46. package/dist/lib/custom/sql/slow-queries.d.ts.map +1 -1
  47. package/dist/lib/custom/sql/slow-queries.js +9 -1
  48. package/dist/lib/effect/errors.d.ts +51 -0
  49. package/dist/lib/effect/errors.d.ts.map +1 -0
  50. package/dist/lib/effect/errors.js +37 -0
  51. package/dist/lib/effect/tools.d.ts +56 -0
  52. package/dist/lib/effect/tools.d.ts.map +1 -0
  53. package/dist/lib/effect/tools.js +67 -0
  54. package/dist/lib/ergonomic/bind.d.ts +20 -6
  55. package/dist/lib/ergonomic/bind.d.ts.map +1 -1
  56. package/dist/lib/ergonomic/bind.js +2 -1
  57. package/dist/lib/ergonomic/catalog.d.ts +5333 -172
  58. package/dist/lib/ergonomic/catalog.d.ts.map +1 -1
  59. package/dist/lib/ergonomic/catalog.js +186 -1
  60. package/dist/lib/ergonomic/composed.d.ts +866 -12
  61. package/dist/lib/ergonomic/composed.d.ts.map +1 -1
  62. package/dist/lib/ergonomic/composed.js +34 -0
  63. package/dist/lib/mcp-json-schema.d.ts +20 -0
  64. package/dist/lib/mcp-json-schema.d.ts.map +1 -1
  65. package/dist/lib/mcp-json-schema.js +89 -1
  66. package/dist/lib/mcp-register.d.ts +1 -1
  67. package/dist/lib/mcp-register.d.ts.map +1 -1
  68. package/dist/lib/mcp-register.js +2 -1
  69. package/dist/lib/operation.d.ts +6 -1
  70. package/dist/lib/operation.d.ts.map +1 -1
  71. package/dist/mcp-v1.d.ts.map +1 -1
  72. package/dist/mcp-v1.js +3 -1
  73. package/dist/mcp.d.ts +3 -3
  74. package/dist/mcp.d.ts.map +1 -1
  75. package/dist/mcp.js +3 -3
  76. package/dist/operations.gen.d.ts +194 -194
  77. package/package.json +22 -3
@@ -1,7 +1,7 @@
1
1
  import { bindTool, publishedId } from "../../ergonomic/bind.js";
2
2
  import { SQL_METADATA, branchIdField, computeIdField, databaseNameField, projectIdField, resolveConnection, sqlClient } from "./connection.js";
3
- import { NeonClientError } from "@neon/sdk";
4
3
  import * as z from "zod";
4
+ import { NeonClientError } from "@neon/sdk";
5
5
  // src/lib/custom/sql/slow-queries.ts
6
6
  const listSlowQueriesInputSchema = z.strictObject({
7
7
  project_id: projectIdField,
@@ -38,12 +38,20 @@ const SLOW_QUERIES_SQL = `
38
38
  ORDER BY mean_exec_time DESC
39
39
  LIMIT $1;
40
40
  `;
41
+ const listSlowQueriesOutputSchema = z.looseObject({
42
+ slow_queries: z.array(z.looseObject({
43
+ query: z.unknown(),
44
+ calls: z.unknown()
45
+ })).describe("pg_stat_statements entries: query, calls, timings in ms, rows, and block and WAL counters."),
46
+ total_queries_found: z.number()
47
+ });
41
48
  const listSlowQueriesTool = (options) => bindTool(options, {
42
49
  operationId: "queries.listSlow",
43
50
  id: publishedId("queries.listSlow"),
44
51
  title: "List Slow Queries",
45
52
  description: "Lists queries from pg_stat_statements, slowest mean execution time first. For sizes, indexes, locks, cache, bloat, or replication, use {{database.inspect}}.",
46
53
  inputSchema: listSlowQueriesInputSchema,
54
+ outputSchema: listSlowQueriesOutputSchema,
47
55
  annotations: {
48
56
  readOnlyHint: true,
49
57
  destructiveHint: false,
@@ -0,0 +1,51 @@
1
+ import { type NeonEffectError } from "@neon/effect";
2
+ import * as z from "zod";
3
+ declare const NeonToolInputError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
4
+ readonly _tag: "NeonToolInputError";
5
+ } & Readonly<A>;
6
+ /** The tool input failed its schema. */
7
+ export declare class NeonToolInputError extends NeonToolInputError_base<{
8
+ readonly message: string;
9
+ readonly issues: z.ZodError["issues"];
10
+ /** The `ZodError` the input schema threw. */
11
+ readonly cause: z.ZodError;
12
+ }> {
13
+ }
14
+ declare const NeonSqlError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
15
+ readonly _tag: "NeonSqlError";
16
+ } & Readonly<A>;
17
+ /** Postgres rejected the statement. */
18
+ export declare class NeonSqlError extends NeonSqlError_base<{
19
+ readonly message: string;
20
+ /** The SQLSTATE Postgres answered with. */
21
+ readonly code: string;
22
+ readonly position: string | undefined;
23
+ readonly detail: string | undefined;
24
+ readonly hint: string | undefined;
25
+ readonly where: string | undefined;
26
+ /** The driver's `NeonDbError`. */
27
+ readonly cause: Error;
28
+ }> {
29
+ }
30
+ declare const NeonSqlConnectionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
31
+ readonly _tag: "NeonSqlConnectionError";
32
+ } & Readonly<A>;
33
+ /** The SQL endpoint failed before Postgres answered, so there is no SQLSTATE. */
34
+ export declare class NeonSqlConnectionError extends NeonSqlConnectionError_base<{
35
+ readonly message: string;
36
+ /** The driver's `NeonDbError`. */
37
+ readonly cause: Error;
38
+ }> {
39
+ }
40
+ /**
41
+ * Every error an Effect tool can fail with. A cancelled call is an interrupted
42
+ * fiber, so aborts have no counterpart here.
43
+ */
44
+ export type NeonToolError = NeonEffectError | NeonToolInputError | NeonSqlError | NeonSqlConnectionError;
45
+ /**
46
+ * Map a failure a tool threw to its tagged error. Anything else, including the
47
+ * aborts an interrupted call produces, is rethrown so Effect records a defect.
48
+ */
49
+ export declare const toNeonToolError: (error: unknown) => NeonToolError;
50
+ export {};
51
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/effect/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,cAAc,CAAC;AAGvE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;;;;AAEzB,wCAAwC;AACxC,qBAAa,kBAAmB,SAAQ,wBAAuC;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;CAC3B,CAAC;CAAG;;;;AAEL,uCAAuC;AACvC,qBAAa,YAAa,SAAQ,kBAAiC;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACtB,CAAC;CAAG;;;;AAEL,iFAAiF;AACjF,qBAAa,sBAAuB,SAAQ,4BAE1C;IACD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACtB,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,MAAM,aAAa,GACtB,eAAe,GACf,kBAAkB,GAClB,YAAY,GACZ,sBAAsB,CAAC;AAe1B;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,aAYhD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { toNeonEffectError } from "@neon/effect";
2
+ import { NeonDbError } from "@neondatabase/serverless";
3
+ import { Data } from "effect";
4
+ import * as z from "zod";
5
+ // src/lib/effect/errors.ts
6
+ /** The tool input failed its schema. */
7
+ var NeonToolInputError = class extends Data.TaggedError("NeonToolInputError") {};
8
+ /** Postgres rejected the statement. */
9
+ var NeonSqlError = class extends Data.TaggedError("NeonSqlError") {};
10
+ /** The SQL endpoint failed before Postgres answered, so there is no SQLSTATE. */
11
+ var NeonSqlConnectionError = class extends Data.TaggedError("NeonSqlConnectionError") {};
12
+ const sqlError = (error) => error.code === void 0 || error.code === "" ? new NeonSqlConnectionError({
13
+ message: error.message,
14
+ cause: error
15
+ }) : new NeonSqlError({
16
+ message: error.message,
17
+ code: error.code,
18
+ position: error.position,
19
+ detail: error.detail,
20
+ hint: error.hint,
21
+ where: error.where,
22
+ cause: error
23
+ });
24
+ /**
25
+ * Map a failure a tool threw to its tagged error. Anything else, including the
26
+ * aborts an interrupted call produces, is rethrown so Effect records a defect.
27
+ */
28
+ const toNeonToolError = (error) => {
29
+ if (error instanceof z.ZodError) return new NeonToolInputError({
30
+ message: error.message,
31
+ issues: error.issues,
32
+ cause: error
33
+ });
34
+ if (error instanceof NeonDbError) return sqlError(error);
35
+ return toNeonEffectError(error);
36
+ };
37
+ export { NeonSqlConnectionError, NeonSqlError, NeonToolInputError, toNeonToolError };
@@ -0,0 +1,56 @@
1
+ import { Effect, Schedule } from "effect";
2
+ import type { NeonToolAnnotations, NeonToolExecutionContext } from "../operation.js";
3
+ import { type NeonToolError } from "./errors.js";
4
+ /** The tool shape an Effect tool is built from: any Neon tool, customized or not. */
5
+ export interface ExecutableNeonTool<Input = never, Output = unknown> {
6
+ readonly id: string;
7
+ readonly annotations: NeonToolAnnotations;
8
+ execute(input: Input, context?: NeonToolExecutionContext): Promise<Output>;
9
+ }
10
+ /** The execution context of an Effect tool. Interrupting the fiber cancels the call. */
11
+ export type NeonEffectToolContext = Omit<NeonToolExecutionContext, "signal">;
12
+ type ToolInput<Tool> = Tool extends ExecutableNeonTool<infer Input, unknown> ? Input : never;
13
+ type ToolOutput<Tool> = Tool extends ExecutableNeonTool<never, infer Output> ? Output : never;
14
+ /** A Neon tool whose `execute` returns an Effect. Every other field is unchanged. */
15
+ export type NeonEffectTool<Tool extends ExecutableNeonTool, Input = ToolInput<Tool>, Output = ToolOutput<Tool>> = Omit<Tool, "execute"> & {
16
+ readonly execute: (input: Input, context?: NeonEffectToolContext) => Effect.Effect<Output, NeonToolError>;
17
+ };
18
+ export type NeonEffectTools<Tools extends Readonly<Record<string, ExecutableNeonTool>>> = {
19
+ readonly [Id in keyof Tools]: NeonEffectTool<Tools[Id]>;
20
+ };
21
+ /**
22
+ * Which failures to retry and how. A policy only ever sees failures of
23
+ * read-only tools that the SDK did not already retry: the adapter never resends
24
+ * a mutation, and leaves 423, 429, and 503 responses to the SDK, which retries
25
+ * them and honours `Retry-After`.
26
+ */
27
+ export interface NeonToolRetryPolicy {
28
+ readonly schedule: Schedule.Schedule<unknown, NeonToolError>;
29
+ /** Retries after the first attempt. */
30
+ readonly times: number;
31
+ readonly shouldRetry: (failure: {
32
+ readonly tool: ExecutableNeonTool;
33
+ readonly error: NeonToolError;
34
+ }) => boolean;
35
+ }
36
+ export interface EffectToolOptions {
37
+ /** No retries unless set. A retry runs the whole tool again, hooks included. */
38
+ readonly retry?: NeonToolRetryPolicy;
39
+ }
40
+ /**
41
+ * Retries a read-only tool that got no response from the Neon API, twice, with
42
+ * jittered exponential backoff from 200 ms. A read is safe to send again; a
43
+ * mutation that may have reached the API is not, so it is never retried.
44
+ */
45
+ export declare const retryReadOnlyNetworkFailures: NeonToolRetryPolicy;
46
+ /**
47
+ * Run a Neon tool as an Effect, in a span named `NeonTools.<id>`. The span
48
+ * records `error.type` for every failure but fails only for the server's: a
49
+ * caller's mistake keeps it ok. `neon.tool.attempts` counts the attempts, and
50
+ * `neon.tool.retried_error.type` names the failure a retry recovered from.
51
+ */
52
+ export declare const toEffectTool: <Input, Output, Tool extends ExecutableNeonTool>(tool: Tool & ExecutableNeonTool<Input, Output>, options?: EffectToolOptions) => NeonEffectTool<Tool, Input, Output>;
53
+ /** Run every tool of a `createNeonTools` result as an Effect. */
54
+ export declare const toEffectTools: <Tools extends Readonly<Record<string, ExecutableNeonTool>>>(tools: Tools, options?: EffectToolOptions) => NeonEffectTools<Tools>;
55
+ export {};
56
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/lib/effect/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,KAAK,EACX,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,aAAa,CAAC;AAElE,qFAAqF;AACrF,MAAM,WAAW,kBAAkB,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,GAAG,OAAO;IAClE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3E;AAED,wFAAwF;AACxF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;AAE7E,KAAK,SAAS,CAAC,IAAI,IAClB,IAAI,SAAS,kBAAkB,CAAC,MAAM,KAAK,EAAE,OAAO,CAAC,GAAG,KAAK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AC;AAiDF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,EAAE,MAAM,EAAE,IAAI,SAAS,kBAAkB,EAC1E,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,EAC9C,UAAS,iBAAsB,KAC7B,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CA+DpC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,aAAa,GACzB,KAAK,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAE1D,OAAO,KAAK,EACZ,UAAS,iBAAsB,KAC7B,eAAe,CAAC,KAAK,CAMI,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { toNeonToolError } from "./errors.js";
2
+ import { Effect, Predicate, Ref, Result, Schedule } from "effect";
3
+ // src/lib/effect/tools.ts
4
+ /**
5
+ * Retries a read-only tool that got no response from the Neon API, twice, with
6
+ * jittered exponential backoff from 200 ms. A read is safe to send again; a
7
+ * mutation that may have reached the API is not, so it is never retried.
8
+ */
9
+ const retryReadOnlyNetworkFailures = {
10
+ schedule: Schedule.exponential("200 millis").pipe(Schedule.jittered),
11
+ times: 2,
12
+ shouldRetry: ({ error }) => Predicate.isTagged(error, "NeonNetworkError")
13
+ };
14
+ const SDK_RETRIED_STATUSES = /* @__PURE__ */ new Set([
15
+ 423,
16
+ 429,
17
+ 503
18
+ ]);
19
+ const sdkRetried = (error) => "status" in error && typeof error.status === "number" && SDK_RETRIED_STATUSES.has(error.status);
20
+ const mayRetry = (tool, error, policy) => tool.annotations.readOnlyHint && !sdkRetried(error) && policy.shouldRetry({
21
+ tool,
22
+ error
23
+ });
24
+ const SERVER_SQLSTATE_CLASSES = /* @__PURE__ */ new Set([
25
+ "08",
26
+ "40",
27
+ "53",
28
+ "55",
29
+ "57",
30
+ "58",
31
+ "F0",
32
+ "XX"
33
+ ]);
34
+ const isCallerError = (error) => {
35
+ if (Predicate.isTagged(error, "NeonSqlError")) return !SERVER_SQLSTATE_CLASSES.has(error.code.slice(0, 2));
36
+ return Predicate.isTagged(error, "NeonToolInputError") || "status" in error && typeof error.status === "number" && error.status < 500;
37
+ };
38
+ /**
39
+ * Run a Neon tool as an Effect, in a span named `NeonTools.<id>`. The span
40
+ * records `error.type` for every failure but fails only for the server's: a
41
+ * caller's mistake keeps it ok. `neon.tool.attempts` counts the attempts, and
42
+ * `neon.tool.retried_error.type` names the failure a retry recovered from.
43
+ */
44
+ const toEffectTool = (tool, options = {}) => {
45
+ const { retry } = options;
46
+ const attempt = (input, context, attempts) => Ref.updateAndGet(attempts, (n) => n + 1).pipe(Effect.flatMap((n) => Effect.annotateCurrentSpan("neon.tool.attempts", n)), Effect.andThen(Effect.tryPromise({
47
+ try: (signal) => tool.execute(input, {
48
+ ...context,
49
+ signal
50
+ }),
51
+ catch: toNeonToolError
52
+ })));
53
+ const run = (input, context, attempts) => retry === void 0 ? attempt(input, context, attempts) : attempt(input, context, attempts).pipe(Effect.tapError((error) => mayRetry(tool, error, retry) ? Effect.annotateCurrentSpan("neon.tool.retried_error.type", error._tag) : Effect.void), Effect.retry({
54
+ schedule: retry.schedule,
55
+ times: retry.times,
56
+ while: (error) => mayRetry(tool, error, retry)
57
+ }));
58
+ const execute = (input, context) => Ref.make(0).pipe(Effect.flatMap((attempts) => run(input, context, attempts)), Effect.map(Result.succeed), Effect.tapError((error) => Effect.annotateCurrentSpan("error.type", error._tag)), Effect.catchIf(isCallerError, (error) => Effect.succeed(Result.fail(error))), Effect.withSpan(`NeonTools.${tool.id}`, { attributes: { "neon.tool.id": tool.id } }), Effect.flatMap(Effect.fromResult));
59
+ const { execute: _promiseExecute, ...descriptor } = tool;
60
+ return {
61
+ ...descriptor,
62
+ execute
63
+ };
64
+ };
65
+ /** Run every tool of a `createNeonTools` result as an Effect. */
66
+ const toEffectTools = (tools, options = {}) => Object.fromEntries(Object.entries(tools).map(([id, tool]) => [id, toEffectTool(tool, options)]));
67
+ export { retryReadOnlyNetworkFailures, toEffectTool, toEffectTools };
@@ -38,9 +38,17 @@ export declare const collectObjectList: (neon: NeonClient<true>, input: {
38
38
  prefix: string;
39
39
  }>;
40
40
  export declare const collectPages: <T>(list: Paginated<T, true>, maxItems?: number) => Promise<T[]>;
41
- export declare const bindTool: <const InputSchema extends z.ZodType, const Id extends string, Output>(options: ToolClientOptions, tool: Omit<NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>>, "execute">, run: (neon: NeonClient<true>, input: z.output<InputSchema>, signal: AbortSignal | undefined, context: NeonToolExecutionContext) => Promise<Output>) => NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>>;
41
+ export declare const bindTool: <const InputSchema extends z.ZodType, const Id extends string, Output, OutputSchema extends z.ZodType>(options: ToolClientOptions, tool: Omit<NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>, OutputSchema>, "execute"> & {
42
+ outputSchema: OutputSchema;
43
+ }, run: (neon: NeonClient<true>, input: z.output<InputSchema>, signal: AbortSignal | undefined, context: NeonToolExecutionContext) => Promise<Output>) => NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>, OutputSchema> & {
44
+ outputSchema: OutputSchema;
45
+ };
42
46
  /** A tool that calls no Neon API and so needs no credential. */
43
- export declare const bindPublicTool: <const InputSchema extends z.ZodType, const Id extends string, Output>(tool: Omit<NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>>, "execute">, run: (input: z.output<InputSchema>, context: NeonToolExecutionContext) => Promise<Output>) => NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>>;
47
+ export declare const bindPublicTool: <const InputSchema extends z.ZodType, const Id extends string, Output, OutputSchema extends z.ZodType>(tool: Omit<NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>, OutputSchema>, "execute"> & {
48
+ outputSchema: OutputSchema;
49
+ }, run: (input: z.output<InputSchema>, context: NeonToolExecutionContext) => Promise<Output>) => NeonTool<InputSchema, Id, JsonSafe<Awaited<Output>>, OutputSchema> & {
50
+ outputSchema: OutputSchema;
51
+ };
44
52
  type GeneratedTool<G extends NeonOperationId> = ReturnType<(typeof operationFactories)[G]>;
45
53
  type GeneratedSchema<G extends NeonOperationId> = GeneratedTool<G>["inputSchema"];
46
54
  type GeneratedInput<G extends NeonOperationId> = z.output<GeneratedSchema<G>>;
@@ -52,16 +60,22 @@ type FromGeneratedMeta = {
52
60
  };
53
61
  type OmittedInput<G extends NeonOperationId, Keys extends string> = Omit<GeneratedInput<G>, Keys>;
54
62
  type OmittedArg<G extends NeonOperationId, Keys extends string> = Omit<GeneratedArg<G>, Keys>;
55
- export declare function fromGenerated<const Id extends NeonToolId, const G extends NeonOperationId, Output>(options: ToolClientOptions, spec: FromGeneratedMeta & {
63
+ export declare function fromGenerated<const Id extends NeonToolId, const G extends NeonOperationId, Output, OutputSchema extends z.ZodType>(options: ToolClientOptions, spec: FromGeneratedMeta & {
56
64
  id: Id;
57
65
  generated: G;
66
+ output: OutputSchema;
58
67
  run: (neon: NeonClient<true>, input: GeneratedInput<G>, signal?: AbortSignal) => Promise<Output>;
59
- }): NeonTool<GeneratedSchema<G>, PublishedId<Id>, JsonSafe<Awaited<Output>>>;
60
- export declare function fromGenerated<const Id extends NeonToolId, const G extends NeonOperationId, const Keys extends keyof GeneratedInput<G> & string, Output>(options: ToolClientOptions, spec: FromGeneratedMeta & {
68
+ }): NeonTool<GeneratedSchema<G>, PublishedId<Id>, JsonSafe<Awaited<Output>>, OutputSchema> & {
69
+ outputSchema: OutputSchema;
70
+ };
71
+ export declare function fromGenerated<const Id extends NeonToolId, const G extends NeonOperationId, const Keys extends keyof GeneratedInput<G> & string, Output, OutputSchema extends z.ZodType>(options: ToolClientOptions, spec: FromGeneratedMeta & {
61
72
  id: Id;
62
73
  generated: G;
63
74
  omit: readonly Keys[];
75
+ output: OutputSchema;
64
76
  run: (neon: NeonClient<true>, input: OmittedInput<G, Keys>, signal?: AbortSignal) => Promise<Output>;
65
- }): NeonTool<z.ZodType<OmittedInput<G, Keys>, OmittedArg<G, Keys>>, PublishedId<Id>, JsonSafe<Awaited<Output>>>;
77
+ }): NeonTool<z.ZodType<OmittedInput<G, Keys>, OmittedArg<G, Keys>>, PublishedId<Id>, JsonSafe<Awaited<Output>>, OutputSchema> & {
78
+ outputSchema: OutputSchema;
79
+ };
66
80
  export {};
67
81
  //# sourceMappingURL=bind.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/bind.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EACN,KAAK,eAAe,EACpB,kBAAkB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,oBAAoB,EAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IACjC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAQD,KAAK,KAAK,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,GAAG,MAAM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;IACrB,GAAG,EAAE,CACJ,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EACtB,KAAK,EAAE,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,EAC5B,MAAM,CAAC,EAAE,WAAW,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC;CACrB,GACC,QAAQ,CACV,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EACrD,WAAW,CAAC,EAAE,CAAC,EACf,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EACzB,YAAY,CACZ,GAAG;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,CAAC"}
@@ -2,8 +2,8 @@ import { toolDescriptions } from "../../descriptions.gen.js";
2
2
  import { missingBearerCredential, requireBearerCredential } from "../auth.js";
3
3
  import { toToolResult } from "../result.js";
4
4
  import { operationFactories } from "../../operations.gen.js";
5
- import { NeonClientError, createNeonClient } from "@neon/sdk";
6
5
  import * as z from "zod";
6
+ import { NeonClientError, createNeonClient } from "@neon/sdk";
7
7
  // src/lib/ergonomic/bind.ts
8
8
  const ALL_PAGES = " Returns every page. Pass limit to cap how many.";
9
9
  const inertClient = createNeonClient({ apiKey: "unused" }).client;
@@ -112,6 +112,7 @@ function fromGenerated(options, spec) {
112
112
  title: generated.title,
113
113
  description: spec.list ? `${description.trimEnd()}${ALL_PAGES}` : description,
114
114
  inputSchema,
115
+ outputSchema: spec.output,
115
116
  annotations: spec.annotations ?? generated.annotations,
116
117
  requiresApproval: spec.requiresApproval ?? generated.requiresApproval,
117
118
  metadata: generated.metadata,