@neon/tools 2.5.1 → 2.6.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 CHANGED
@@ -116,6 +116,23 @@ An abort `signal` on `execute` or a wait timeout stops the poll, not the create:
116
116
 
117
117
  These public client methods are not tools: `operations.waitFor`, `postgres.roles.password`, `storage.objects.get`, and `credentials.reveal`. Waiting is what the write tools already do. `realtime.secret` is a GET that requires approval: it returns the branch's Realtime secret, which an application backend seals queries with. After `realtime.rotateSecret`, it returns the new value once `pending` is `false`. `projects.create` and `branches.create` return the created resource without a connection string; `createAndConnect` returns a URI. `triggers.create` and `triggers.update` take the OpenAPI discriminator as a nested `body` field. `credentials.rotate` requires approval and is not idempotent: a lost success already replaced the secret; create a replacement and revoke the rotated credential.
118
118
 
119
+ ## Roles
120
+
121
+ `postgres.roles.create` (`create_postgres_roles`) defaults to `access: "admin"`, which joins `neon_superuser`. Pass `read_only` or `read_write` for a least-privilege credential. Scoped roles are created with SQL as the database owner; see [`@neon/sdk`'s `neon.postgres.roles`](../sdk/README.md#neonpostgresroles) for the grants and limits.
122
+
123
+ ```ts
124
+ const tools = createNeonTools({ apiKey, tools: ["postgres.roles.create"] });
125
+ const { data: role } = await tools["postgres.roles.create"].execute({
126
+ project_id: "project-id",
127
+ branch_id: "br-main",
128
+ name: "app_reader",
129
+ access: "read_only",
130
+ database_name: "neondb",
131
+ schemas: ["public"],
132
+ });
133
+ // role.password is the generated password
134
+ ```
135
+
119
136
  ## Optional host add-ons
120
137
 
121
138
  ### Descriptions
@@ -1719,6 +1719,13 @@ export declare const toolFactories: {
1719
1719
  branch_id: z.ZodString;
1720
1720
  name: z.ZodString;
1721
1721
  no_login: z.ZodOptional<z.ZodBoolean>;
1722
+ access: z.ZodOptional<z.ZodEnum<{
1723
+ admin: "admin";
1724
+ read_only: "read_only";
1725
+ read_write: "read_write";
1726
+ }>>;
1727
+ database_name: z.ZodOptional<z.ZodString>;
1728
+ schemas: z.ZodOptional<z.ZodArray<z.ZodString>>;
1722
1729
  }, z.core.$strict>, "create_postgres_roles", {
1723
1730
  branch_id: string;
1724
1731
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,WAAW,CAAC;AAanB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;AAE7D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ypD6C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { decodeBase64 } from "../binary.js";
2
2
  import { bindTool, collectObjectList, collectPages, fromGenerated, publishedId } from "./bind.js";
3
- import { compareSchemaTool, connectionStringTool, createBranchAndConnectTool, createBranchTool, createProjectAndConnectTool, createProjectTool, getDefaultTool, resetFromParentTool, restoreSnapshotTool, setScheduleTool } from "./composed.js";
3
+ import { compareSchemaTool, connectionStringTool, createBranchAndConnectTool, createBranchTool, createProjectAndConnectTool, createProjectTool, createRoleTool, getDefaultTool, resetFromParentTool, restoreSnapshotTool, setScheduleTool } from "./composed.js";
4
4
  import * as z from "zod";
5
5
  // src/lib/ergonomic/catalog.ts
6
6
  const logReadAnnotations = {
@@ -296,16 +296,7 @@ const toolFactories = {
296
296
  roleName: input.role_name
297
297
  }, { signal })
298
298
  }),
299
- "postgres.roles.create": (options) => fromGenerated(options, {
300
- id: "postgres.roles.create",
301
- generated: "createProjectBranchRole",
302
- run: (neon, input, signal) => neon.postgres.roles.create({
303
- projectId: input.project_id,
304
- branchId: input.branch_id,
305
- name: input.name,
306
- no_login: input.no_login
307
- }, { signal })
308
- }),
299
+ "postgres.roles.create": createRoleTool,
309
300
  "postgres.roles.delete": (options) => fromGenerated(options, {
310
301
  id: "postgres.roles.delete",
311
302
  generated: "deleteProjectBranchRole",
@@ -165,6 +165,19 @@ export declare const connectionStringInputSchema: z.ZodObject<{
165
165
  role_name: z.ZodString;
166
166
  pooled: z.ZodOptional<z.ZodBoolean>;
167
167
  }, z.core.$strict>;
168
+ export declare const createRoleInputSchema: z.ZodObject<{
169
+ project_id: z.ZodString;
170
+ branch_id: z.ZodString;
171
+ name: z.ZodString;
172
+ no_login: z.ZodOptional<z.ZodBoolean>;
173
+ access: z.ZodOptional<z.ZodEnum<{
174
+ admin: "admin";
175
+ read_only: "read_only";
176
+ read_write: "read_write";
177
+ }>>;
178
+ database_name: z.ZodOptional<z.ZodString>;
179
+ schemas: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
+ }, z.core.$strict>;
168
181
  export declare const restoreSnapshotInputSchema: z.ZodObject<{
169
182
  project_id: z.ZodString;
170
183
  snapshot_id: z.ZodString;
@@ -719,6 +732,27 @@ export declare const connectionStringTool: (options: ToolClientOptions) => impor
719
732
  role_name: z.ZodString;
720
733
  pooled: z.ZodOptional<z.ZodBoolean>;
721
734
  }, z.core.$strict>, "connection_string_postgres", string>;
735
+ export declare const createRoleTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
736
+ project_id: z.ZodString;
737
+ branch_id: z.ZodString;
738
+ name: z.ZodString;
739
+ no_login: z.ZodOptional<z.ZodBoolean>;
740
+ access: z.ZodOptional<z.ZodEnum<{
741
+ admin: "admin";
742
+ read_only: "read_only";
743
+ read_write: "read_write";
744
+ }>>;
745
+ database_name: z.ZodOptional<z.ZodString>;
746
+ schemas: z.ZodOptional<z.ZodArray<z.ZodString>>;
747
+ }, z.core.$strict>, "create_postgres_roles", {
748
+ branch_id: string;
749
+ name: string;
750
+ password?: string | null | undefined;
751
+ protected?: boolean | null | undefined;
752
+ authentication_method?: string | null | undefined;
753
+ created_at: string;
754
+ updated_at: string;
755
+ }>;
722
756
  export declare const restoreSnapshotTool: (options: ToolClientOptions) => import("../operation.js").NeonTool<z.ZodObject<{
723
757
  project_id: z.ZodString;
724
758
  snapshot_id: z.ZodString;
@@ -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;AAEzB,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAmD1E,eAAO,MAAM,uBAAuB;;;;;;;;;;kBAqBjC,CAAC;AAEJ,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAM5C,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,MAAM,cAAc,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;EA8CvD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B5D,CAAC;AAEH,eAAO,MAAM,eAAe,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;mDA6BxD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { zBackupScheduleItem, zBranchCreateRequest, zBranchRestoreRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zGetConnectionUriPath, zGetConnectionUriQuery, zGetProjectBranchSchemaComparisonPath, zGetProjectBranchSchemaComparisonQuery, zListProjectBranchesPath, zRestoreProjectBranchPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
1
+ import { zBackupScheduleItem, zBranchCreateRequest, zBranchRestoreRequest, zComputeUnit, zCreateProjectBody, zCreateProjectBranchPath, zCreateProjectBranchRoleBody, zCreateProjectBranchRolePath, zGetConnectionUriPath, zGetConnectionUriQuery, zGetProjectBranchSchemaComparisonPath, zGetProjectBranchSchemaComparisonQuery, zListProjectBranchesPath, zRestoreProjectBranchPath, zRestoreSnapshotBody, zRestoreSnapshotPath, zSetSnapshotSchedulePath, zSuspendTimeoutSeconds } from "../../generated/zod.gen.js";
2
2
  import { bindTool, publishedId } from "./bind.js";
3
3
  import * as z from "zod";
4
4
  // src/lib/ergonomic/composed.ts
@@ -75,6 +75,27 @@ const connectionStringInputSchema = z.strictObject({
75
75
  role_name: zGetConnectionUriQuery.shape.role_name,
76
76
  pooled: pooledField
77
77
  });
78
+ const roleCreateFields = zCreateProjectBranchRoleBody.shape.role.shape;
79
+ const ACCESS_FIELDS_NEED_SCOPED_ACCESS = "database_name and schemas apply only to access read_only or read_write.";
80
+ const createRoleInputSchema = z.strictObject({
81
+ project_id: zCreateProjectBranchRolePath.shape.project_id,
82
+ branch_id: zCreateProjectBranchRolePath.shape.branch_id,
83
+ name: roleCreateFields.name,
84
+ no_login: roleCreateFields.no_login,
85
+ access: z.enum([
86
+ "admin",
87
+ "read_only",
88
+ "read_write"
89
+ ]).describe("What the role may do. Default admin: the role joins neon_superuser. read_only: SELECT. read_write: SELECT, INSERT, UPDATE, DELETE and sequence use. Scoped roles get these grants on top of whatever PUBLIC already has in the database.").optional(),
90
+ database_name: z.string().min(1).describe("Database a read_only or read_write role is scoped to. Optional when the branch has exactly one database.").optional(),
91
+ schemas: z.array(z.string().min(1)).min(1).describe("Schemas a read_only or read_write role can use. Default [\"public\"].").optional()
92
+ }).superRefine((value, ctx) => {
93
+ if (!(value.access === "read_only" || value.access === "read_write") && (value.database_name !== void 0 || value.schemas !== void 0)) ctx.addIssue({
94
+ code: "custom",
95
+ message: ACCESS_FIELDS_NEED_SCOPED_ACCESS,
96
+ path: [value.database_name === void 0 ? "schemas" : "database_name"]
97
+ });
98
+ });
78
99
  const restoreSnapshotInputSchema = z.strictObject({
79
100
  project_id: zRestoreSnapshotPath.shape.project_id,
80
101
  snapshot_id: zRestoreSnapshotPath.shape.snapshot_id,
@@ -262,6 +283,36 @@ const connectionStringTool = (options) => bindTool(options, {
262
283
  ...input.role_name === void 0 ? {} : { roleName: input.role_name },
263
284
  ...input.pooled === void 0 ? {} : { pooled: input.pooled }
264
285
  }, { signal }));
286
+ const createRoleTool = (options) => bindTool(options, {
287
+ operationId: "postgres.roles.create",
288
+ id: publishedId("postgres.roles.create"),
289
+ title: "Create role",
290
+ description: "Create a Postgres role on a branch and return it with its password. access defaults to admin: the role joins neon_superuser, so it can read and write every database, create databases and roles, and bypass row-level security, and it cannot be narrowed later. For a least-privilege credential pass access read_only or read_write, scoped to database_name and schemas. Scoped roles are created with SQL as the database owner and cover tables that owner owns, now and later.",
291
+ inputSchema: createRoleInputSchema,
292
+ annotations: writeAnnotations,
293
+ requiresApproval: true,
294
+ metadata: {
295
+ method: "POST",
296
+ path: "/projects/{project_id}/branches/{branch_id}/roles",
297
+ stability: "stable",
298
+ deprecated: false,
299
+ tags: ["Branch"]
300
+ }
301
+ }, (neon, input, signal) => {
302
+ const role = {
303
+ projectId: input.project_id,
304
+ branchId: input.branch_id,
305
+ name: input.name,
306
+ ...input.no_login === void 0 ? {} : { no_login: input.no_login }
307
+ };
308
+ if (input.access === "read_only" || input.access === "read_write") return neon.postgres.roles.create({
309
+ ...role,
310
+ access: input.access,
311
+ ...input.database_name === void 0 ? {} : { databaseName: input.database_name },
312
+ ...input.schemas === void 0 ? {} : { schemas: input.schemas }
313
+ }, { signal });
314
+ return neon.postgres.roles.create(role, { signal });
315
+ });
265
316
  const restoreSnapshotTool = (options) => bindTool(options, {
266
317
  operationId: "snapshots.restore",
267
318
  id: publishedId("snapshots.restore"),
@@ -304,4 +355,4 @@ const setScheduleTool = (options) => bindTool(options, {
304
355
  branchId: input.branch_id,
305
356
  schedule: input.schedule
306
357
  }, { signal }));
307
- export { compareSchemaInputSchema, compareSchemaTool, connectionStringInputSchema, connectionStringTool, createBranchAndConnectInputSchema, createBranchAndConnectTool, createBranchInputSchema, createBranchTool, createProjectAndConnectInputSchema, createProjectAndConnectTool, createProjectInputSchema, createProjectTool, getDefaultInputSchema, getDefaultTool, resetFromParentInputSchema, resetFromParentTool, restoreSnapshotInputSchema, restoreSnapshotTool, setScheduleInputSchema, setScheduleTool };
358
+ export { compareSchemaInputSchema, compareSchemaTool, connectionStringInputSchema, connectionStringTool, createBranchAndConnectInputSchema, createBranchAndConnectTool, createBranchInputSchema, createBranchTool, createProjectAndConnectInputSchema, createProjectAndConnectTool, createProjectInputSchema, createProjectTool, createRoleInputSchema, createRoleTool, getDefaultInputSchema, getDefaultTool, resetFromParentInputSchema, resetFromParentTool, restoreSnapshotInputSchema, restoreSnapshotTool, setScheduleInputSchema, setScheduleTool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon/tools",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Agent tools for the Neon SDK ergonomic client, compatible with MCP, Eve, and Mastra.",
5
5
  "keywords": [
6
6
  "neon",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "zod": "^4.5.4",
72
- "@neon/sdk": "7.6.1"
72
+ "@neon/sdk": "7.8.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@hey-api/openapi-ts": "0.98.2",