@neon/tools 2.17.3 → 2.19.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
@@ -124,15 +124,15 @@ Custom tools combine several requests into one call, or call Postgres or neon.co
124
124
  | `sql.explain` | `explain_sql` | The `EXPLAIN (FORMAT JSON)` rows. `analyze: true` executes the statement. |
125
125
  | `schema.listTables` | `list_tables_schema` | `{ table_schema, table_name, table_type }` for every table outside `pg_catalog` and `information_schema`. |
126
126
  | `schema.describeTable` | `describe_table_schema` | `{ raw, formatted }`: columns, indexes, constraints, and sizes. A missing table, or a name that matches two tables, throws `NeonClientError`. |
127
- | `branches.describe` | `describe_branches` | `{ branch, console_url, text, database_structure }`, where `database_structure` is `[[], rows]`: one `{ tree_structure }` row per database, then the connected database's schemas and objects, read from the system catalogs in a `READ ONLY` transaction. When that query fails it is `null` and `database_structure_error` says why. |
128
- | `queries.listSlow` | `list_slow_queries` | `{ slow_queries, total_queries_found }` from `pg_stat_statements`, slowest mean time first. Without the extension it throws `NeonClientError`. |
127
+ | `branches.describe` | `describe_branches` | `{ branch, console_url, text, database_structure }`, where `database_structure` is `[[], rows]`: one `{ tree_structure }` row per database except Neon's reserved `postgres`, which the other SQL tools reject, then the connected database's schemas and objects, read from the system catalogs in a `READ ONLY` transaction. When that query fails it is `null` and `database_structure_error` says why. |
128
+ | `queries.listSlow` | `list_slow_queries` | `{ slow_queries, total_queries_found }` from `pg_stat_statements`, slowest mean time first. Without the extension it throws `NeonClientError` with the same message `database.inspect` gives: ask the user, then run the `CREATE EXTENSION` statement it names. |
129
129
  | `database.inspect` | `inspect_database` | One `neon inspect db` check: `{ check, describe, projectId, branchId, databases, fields, totalRowCount, rows, truncated, note? }`. |
130
130
  | `migrations.prepare` | `prepare_migrations` | Runs `migration_sql` on a new temporary branch and returns `{ complete, temporary_branch, migration_result }`. `complete` holds exactly the fields `migrations.complete` takes (`migration_id`, `migration_sql`, `database_name`, `project_id`, `temporary_branch_id`, `parent_branch_id`); `temporary_branch` is `{ id, name, parent_id }`; `migration_result` holds each statement's rows. |
131
131
  | `migrations.complete` | `complete_migrations` | Applies the migration to the parent unless `apply_changes` is false, deletes the temporary branch, and returns `{ applied, deletedBranchId?, cleanupError?, migrationResult? }`. |
132
132
  | `queryTuning.prepare` | `prepare_query_tuning` | Runs `EXPLAIN ANALYZE` on a new temporary branch and returns `{ complete, execution_plan, table_schemas, sql, baseline_metrics }`. `complete` holds `tuning_id`, `database_name`, `project_id`, `temporary_branch_id`, and `role_name` when one was passed; `baseline_metrics` holds time, cost, rows, and buffer counters of the root plan node. |
133
133
  | `queryTuning.complete` | `complete_query_tuning` | Applies `suggested_sql_statements` when `apply_changes` is true, deletes the temporary branch unless `should_delete_temporary_branch` is false, and returns `{ appliedChanges?, results?, deletedBranches?, message }`. |
134
134
  | `docs.search` | `search_docs` | `{ hits: [{ title, url, slug, category, breadcrumb, heading, excerpt }] }` from neon.com site search. |
135
- | `docs.get` | `get_docs` | `{ url, markdown }` for one neon.com page slug. |
135
+ | `docs.get` | `get_docs` | `{ url, markdown }` for one neon.com page slug, without the agent skills note and feedback footer neon.com adds for agents that browse the site. |
136
136
  | `feedback.send` | `send_feedback` | Posts `{ feedback, source }` to the Neon feedback service. |
137
137
 
138
138
  ```ts
@@ -227,7 +227,7 @@ await tools["sql.run"].execute(
227
227
 
228
228
  | Field | Effect |
229
229
  | --- | --- |
230
- | `readOnly` | A tool whose `metadata.readOnlySafe` is `false` throws `NeonClientError` without a request (see [Read-only](#read-only)). `sql.run` and `sql.explain` run the statement in a `READ ONLY` transaction, so Postgres rejects writes. `sql.runTransaction`, `migrations.*`, and `queryTuning.*` are not read-only safe, because a caller statement such as `COMMIT` or `SET TRANSACTION READ WRITE` can leave a read-only transaction. `schema.*` and `queries.listSlow` behave like `sql.run`; `branches.describe` and `database.inspect` always use a `READ ONLY` transaction. |
230
+ | `readOnly` | A tool whose `metadata.readOnlySafe` is `false` throws `NeonClientError` without a request (see [Read-only](#read-only)). `sql.run` and `sql.explain` run the statement in a `READ ONLY` transaction, so Postgres rejects writes. `sql.runTransaction`, `migrations.*`, and `queryTuning.*` are not read-only safe, because a caller statement such as `COMMIT` or `SET TRANSACTION READ WRITE` can leave a read-only transaction. `schema.*` behave like `sql.run`; `branches.describe`, `queries.listSlow`, and `database.inspect` always use a `READ ONLY` transaction. |
231
231
  | `postgresRole` | Every SQL connection logs in as this role, and `postgres.connectionString` returns a URI for it. A `role_name` that differs throws `NeonClientError`. |
232
232
  | `caller` | Sent with `docs.search` as `x-caller-source`, `x-caller-user-agent`, and `x-caller-client`. Without it, or when `source` cannot be a header value, `x-caller-source` is `neon_tools`. The search service records `website`, `cli`, `mcp`, and `monitor` by name and counts any other source as `rest`. |
233
233
 
@@ -375,7 +375,7 @@ An abort `signal` on `execute` or a wait timeout stops the poll, not the create:
375
375
 
376
376
  `metadata.method` and `metadata.path` name the first request; extra readiness GETs are not listed there.
377
377
 
378
- These public client methods are not tools: `operations.waitFor`, `postgres.roles.password`, `storage.objects.get`, `credentials.reveal`, `logs.loki.labels`, and `logs.loki.labelValues`. Waiting is what the write tools already do. Loki labels are the log fields, so `logs.fields` and `logs.fieldValues` are the discovery tools for both `logs.query` and `logs.loki.queryRange`; the latter returns Loki's response, with lines grouped by stream labels, and nanosecond timestamp strings. `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.
378
+ These public client methods are not tools: `operations.waitFor`, `postgres.roles.password`, `storage.objects.get`, `credentials.reveal`, `logs.loki.labels`, and `logs.loki.labelValues`. Waiting is what the write tools already do. Loki labels are the log fields, so `logs.fields` and `logs.fieldValues` are the discovery tools for both `logs.query` and `logs.loki.queryRange`; the latter returns Loki's response, with lines grouped by stream labels, and nanosecond timestamp strings. `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. `postgres.dataApi.get` returns `{ enabled: false }` for a database without a Data API, where the SDK method throws `NeonNotFoundError`, and adds `enabled: true` to a configured one; a missing branch or database still throws. `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.
379
379
 
380
380
  ## Roles
381
381
 
@@ -411,7 +411,7 @@ const tools = createNeonTools({
411
411
  "postgres.connectionString":
412
412
  "Get a connection string. Call it after {{projects.create}}.",
413
413
  delete_projects:
414
- "Delete a Neon project and all its data. NEVER run autonomously; always ask the user first.",
414
+ "Delete a Neon project and all its data. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first.",
415
415
  },
416
416
  });
417
417
  tools["projects.create"].description;
@@ -698,7 +698,7 @@ The span records every failure's tag as `error.type` and fails only for the serv
698
698
 
699
699
  Anything else a tool throws becomes a defect. `toNeonToolError` is the mapping, for promise code you wrap yourself.
700
700
 
701
- Retries are off unless you pass `retry`. The SDK already retries 423, 429, and 503 responses and honours `Retry-After`. `retryReadOnlyNetworkFailures` retries a read-only tool that got no response, twice with jittered exponential backoff from 200 ms; mutations are never retried, since one may have reached the API. A retry runs the whole tool again, including `onExecute` hooks and every page of a list. Pass your own `NeonToolRetryPolicy` (`schedule`, `times`, `shouldRetry`) for a different policy. Whatever it says, the adapter only retries read-only tools and never a 423, 429, or 503 response.
701
+ Retries are off unless you pass `retry`. The SDK already retries 423, 429, and 503 responses and honours `Retry-After`, and its ergonomic client resends a `GET` whose connection dropped before a response. `retryReadOnlyNetworkFailures` retries a read-only tool that got no response, twice with jittered exponential backoff from 200 ms; mutations are never retried, since one may have reached the API. A retry runs the whole tool again, including `onExecute` hooks and every page of a list. Pass your own `NeonToolRetryPolicy` (`schedule`, `times`, `shouldRetry`) for a different policy. Whatever it says, the adapter only retries read-only tools and never a 423, 429, or 503 response.
702
702
 
703
703
  ## Safety and binary data
704
704
 
@@ -5,7 +5,7 @@ const toolDescriptions = {
5
5
  "projects.count": "Counts an organization's active projects without listing them; ones being created or deleted are not counted.",
6
6
  "projects.get": "Gets a project's settings, owner, and usage. For branches, use {{branches.list}}.",
7
7
  "projects.update": "Updates a project's name, settings, default compute settings, or history retention.",
8
- "projects.delete": "Deletes a project with all its branches, computes, databases, and roles. NEVER run autonomously; always ask the user first. {{projects.recover}} undoes it within 7 days. For one branch, use {{branches.delete}}.",
8
+ "projects.delete": "Deletes a project with all its branches, computes, databases, and roles. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. {{projects.recover}} undoes it within 7 days. For one branch, use {{branches.delete}}.",
9
9
  "projects.recover": "Recovers a project deleted in the last 7 days; {{projects.list}} with recoverable true finds them. Some integrations need setting up again.",
10
10
  "projects.transfer": "Moves projects from one organization to another. The API key needs access to both organizations.",
11
11
  "projects.transferFromUser": "Deprecated: personal accounts are now organizations. Use {{projects.transfer}}.",
@@ -18,9 +18,9 @@ const toolDescriptions = {
18
18
  "branches.list": "Lists a project's branches with id (br-...), name, parent, and default flag; search finds a branch's id by name.",
19
19
  "branches.get": "Gets a branch record: name, parent, state, protection, size, and timestamps. For its databases and tables, use {{branches.describe}}.",
20
20
  "branches.update": "Renames a branch, protects or unprotects it, or sets when it expires.",
21
- "branches.delete": "Deletes a branch with all its data and disconnects its clients. NEVER run autonomously; always ask the user first. The root, the default, and a branch with children cannot be deleted. For the whole project, use {{projects.delete}}.",
21
+ "branches.delete": "Deletes a branch with all its data and disconnects its clients. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. The root, the default, and a branch with children cannot be deleted. Returns the deleted branch, or null when the project has no branch with that id. For the whole project, use {{projects.delete}}.",
22
22
  "branches.setDefault": "Makes a branch the project's default; the previous default loses the flag.",
23
- "branches.finalizeRestore": "Finalizes a branch restored with finalize false: moves the original branch's computes onto it, restarting them, and takes over its name. NEVER run autonomously; always ask the user first.",
23
+ "branches.finalizeRestore": "Finalizes a branch restored with finalize false: moves the original branch's computes onto it, restarting them, and takes over its name. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first.",
24
24
  "postgres.endpoints.list": "Lists the compute endpoints of every branch in a project. For one branch, use {{postgres.endpoints.listByBranch}}.",
25
25
  "postgres.endpoints.listByBranch": "Lists a branch's compute endpoints. For every branch in the project, use {{postgres.endpoints.list}}.",
26
26
  "postgres.endpoints.get": "Gets a compute endpoint (ep-...), including its host and state.",
@@ -39,7 +39,7 @@ const toolDescriptions = {
39
39
  "postgres.databases.create": "Creates a database on a branch, owned by owner_name.",
40
40
  "postgres.databases.update": "Renames a database or changes its owner.",
41
41
  "postgres.databases.delete": "Deletes a database and its data from a branch.",
42
- "postgres.dataApi.get": "Gets the Neon Data API configuration for one database on a branch.",
42
+ "postgres.dataApi.get": "Gets the Neon Data API configuration for one database on a branch. Returns enabled false when the database has no Data API; {{postgres.dataApi.create}} enables it.",
43
43
  "postgres.dataApi.create": "Creates the Neon Data API, a REST interface over database_name, on a branch.",
44
44
  "postgres.dataApi.update": "Updates the Neon Data API settings for a database and refreshes its schema cache.",
45
45
  "postgres.dataApi.delete": "Deletes the Neon Data API for a database; requests to its endpoint start failing.",
@@ -70,10 +70,10 @@ const toolDescriptions = {
70
70
  "credentials.rotate": "Replaces a scoped credential's secrets in place and returns them once; token_id stays. Not idempotent: if the response is lost, create a new credential ({{credentials.create}}) and revoke this one instead of retrying.",
71
71
  "aiGateway.get": "Gets a branch's AI Gateway host; a 404 says why it is unavailable.",
72
72
  "realtime.get": "Gets a branch's Realtime state, URL, and allowed origins; the secret comes from {{realtime.secret}}.",
73
- "realtime.enable": "Enables Realtime on a branch, or changes its allowed origins, and waits until it is applied. Enabling turns on logical replication for the whole project, which cannot be turned off, and suspends every compute in the project, dropping active connections. NEVER run autonomously; always ask the user first.",
73
+ "realtime.enable": "Enables Realtime on a branch, or changes its allowed origins, and waits until it is applied. Enabling turns on logical replication for the whole project, which cannot be turned off, and suspends every compute in the project, dropping active connections. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first.",
74
74
  "realtime.disable": "Disables Realtime on a branch, discarding its secret, and waits until it is applied.",
75
75
  "realtime.secret": "Gets the secret the application backend issues Realtime tokens with; 404 until {{realtime.enable}} has run.",
76
- "realtime.rotateSecret": "Replaces a branch's Realtime secret and waits until the old one stops working. NEVER run autonomously; always ask the user first. Then update the application backend from {{realtime.secret}}.",
76
+ "realtime.rotateSecret": "Replaces a branch's Realtime secret and waits until the old one stops working. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. Then update the application backend from {{realtime.secret}}.",
77
77
  "logs.query": "Returns a branch's log records. Filters combine with AND; pass logql or structured filters, not both. Pass since or start_time, not both; default last hour, max seven days. Private beta: a branch without logs returns 404 telemetry_not_enabled. Stream labels: {{logs.loki.queryRange}}.",
78
78
  "logs.fields": "Lists the low-cardinality log fields seen on a branch, for {{logs.fieldValues}}.",
79
79
  "logs.fieldValues": "Lists the distinct values of one log field; a field the branch never emitted returns unknown_field. Pass since or start_time, not both; default last six hours, max seven days.",
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/lib/custom/docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3E,eAAO,MAAM,uBAAuB,8FACwD,CAAC;AAC7F,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAGxD,eAAO,MAAM,m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D,CAAC;AAiBF,eAAO,MAAM,UAAU,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;CA2CpD,CAAC"}
@@ -120,6 +120,9 @@ const searchDocsTool = (options) => {
120
120
  return parsed.data;
121
121
  });
122
122
  };
123
+ const AGENT_SKILLS_NOTE = /^(> Full Neon documentation index: [^\n]*\n)>\n> Agent skills: [^\n]*\n/m;
124
+ const FEEDBACK_NOTE = /\n---\n\nNote for AI assistants [^\n]*\s*$/;
125
+ const stripAgentNotes = (markdown) => markdown.replace(AGENT_SKILLS_NOTE, "$1").replace(FEEDBACK_NOTE, "");
123
126
  const getDocOutputSchema = z.looseObject({
124
127
  url: z.string(),
125
128
  markdown: z.string().describe("The page as markdown.")
@@ -153,7 +156,7 @@ const getDocTool = (options) => {
153
156
  if (!response.ok) throw new Error(`Failed to fetch doc page "${mdSlug}": ${response.status} ${response.statusText}`);
154
157
  return {
155
158
  url,
156
- markdown: await response.text()
159
+ markdown: stripAgentNotes(await response.text())
157
160
  };
158
161
  });
159
162
  };
@@ -26,7 +26,11 @@ export interface ConnectionTarget {
26
26
  export interface ResolvedConnection {
27
27
  uri: string;
28
28
  projectId: string;
29
- branchId: string;
29
+ /**
30
+ * Absent when the database and role were given without a branch: the
31
+ * connection URI API then picks the default branch.
32
+ */
33
+ branchId?: string;
30
34
  databaseName: string;
31
35
  roleName: string;
32
36
  computeId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,KAAK,EACX,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,cAAc,OAAO,KAAG,qBAOlD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AM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC5C,SAAS,WAAW,0CAgBpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC7B,YAAY,UAAU,CAAC,IAAI,CAAC,EAC5B,QAAQ,gBAAgB,EACxB,SAAS,wBAAwB,EACjC,SAAS,WAAW,KAClB,OAAO,CAAC,kBAAkB,CA2D5B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,SAAS,WAAW,uEACS,CAAC"}
@@ -42,31 +42,34 @@ const resolveConnection = async (neonClient, target, context, signal) => {
42
42
  if (roleName !== void 0 && roleName !== pinnedRole) throw new NeonToolCallerError(`This connection is pinned to Postgres role "${pinnedRole}"; role_name "${roleName}" is not allowed.`);
43
43
  roleName = pinnedRole;
44
44
  }
45
- const branchId = target.branch_id ?? (await neonClient.branches.getDefault({ projectId }, { signal })).id;
45
+ let branchId = target.branch_id;
46
46
  let databaseName = target.database_name;
47
- if (databaseName === void 0) {
48
- const database = await defaultDatabase(neonClient, {
47
+ if (databaseName === void 0 || roleName === void 0) {
48
+ branchId ??= (await neonClient.branches.getDefault({ projectId }, { signal })).id;
49
+ if (databaseName === void 0) {
50
+ const database = await defaultDatabase(neonClient, {
51
+ projectId,
52
+ branchId
53
+ }, signal);
54
+ databaseName = database.name;
55
+ roleName ??= database.owner_name;
56
+ } else roleName = (await neonClient.postgres.databases.get({
49
57
  projectId,
50
- branchId
51
- }, signal);
52
- databaseName = database.name;
53
- roleName ??= database.owner_name;
54
- } else if (roleName === void 0) roleName = (await neonClient.postgres.databases.get({
55
- projectId,
56
- branchId,
57
- databaseName
58
- }, { signal })).owner_name;
58
+ branchId,
59
+ databaseName
60
+ }, { signal })).owner_name;
61
+ }
59
62
  return {
60
63
  uri: await neonClient.postgres.connectionString({
61
64
  projectId,
62
- branchId,
65
+ ...branchId === void 0 ? {} : { branchId },
63
66
  databaseName,
64
67
  roleName,
65
68
  ...target.compute_id === void 0 ? {} : { endpointId: target.compute_id },
66
69
  ...target.pooled === void 0 ? {} : { pooled: target.pooled }
67
70
  }, { signal }),
68
71
  projectId,
69
- branchId,
72
+ ...branchId === void 0 ? {} : { branchId },
70
73
  databaseName,
71
74
  roleName,
72
75
  ...target.compute_id === void 0 ? {} : { computeId: target.compute_id }
@@ -1 +1 @@
1
- {"version":3,"file":"describe-branch.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/describe-branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AASnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,eAAO,MAAM,yBAAyB;;;;kBAIpC,CAAC;AAkFH,eAAO,MAAM,gBAAgB,GAC5B,YAAY,MAAM,EAClB,WAAW,MAAM,EACjB,UAAU,MAAM,WAKJ,CAAC;AAoBd,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,kBAAkB,EAAE,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,GAC1B,YAAY,UAAU,CAAC,IAAI,CAAC,EAC5B,OAAO;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,EACxE,SAAS,wBAAwB,EACjC,YAAY,MAAM,EAClB,SAAS,WAAW,KAClB,OAAO,CAAC,iBAAiB,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AAwB,EACjC,YAAY,MAAM,EAClB,SAAS,WAAW,KAClB,OAAO,CAAC,iBAAiB,CA6C3B,CAAC;AAaF,eAAO,MAAM,kBAAkB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA3E/C,MAAM;UAEb,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FZ,CAAC"}
@@ -63,7 +63,7 @@ WITH RECURSIVE
63
63
  SELECT tree_structure FROM (
64
64
  SELECT 0 AS part, NULL::text AS path, ':file_folder: ' || datname || ' (DATABASE)' AS tree_structure
65
65
  FROM pg_database
66
- WHERE datistemplate = false
66
+ WHERE datistemplate = false AND datname != 'postgres'
67
67
 
68
68
  UNION ALL
69
69
 
@@ -0,0 +1,18 @@
1
+ import type { NeonQueryPromise } from "@neondatabase/serverless";
2
+ import type { sqlClient } from "./connection.js";
3
+ type SqlClient = ReturnType<typeof sqlClient>;
4
+ type ExtensionPrerequisite = {
5
+ extension: string;
6
+ /** Subject of the missing-extension error, such as `The "outliers" check`. */
7
+ needs: string;
8
+ databaseName: string;
9
+ };
10
+ /**
11
+ * Runs `statement` in a READ ONLY transaction whose `search_path` is only the
12
+ * extension's schema. Extensions can live in a schema that is not on the
13
+ * role's path, and a user object on that path could otherwise shadow the
14
+ * extension's; `pg_catalog` is always searched.
15
+ */
16
+ export declare const readWithExtension: (sql: SqlClient, input: ExtensionPrerequisite, statement: NeonQueryPromise<false, false>) => Promise<Record<string, unknown>[]>;
17
+ export {};
18
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/extensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAE9C,KAAK,qBAAqB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AA2BF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC7B,KAAK,SAAS,EACd,OAAO,qBAAqB,EAC5B,WAAW,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,KACvC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAanC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { NeonToolCallerError } from "../../caller-error.js";
2
+ import { NeonClientError } from "@neon/sdk";
3
+ // src/lib/custom/sql/extensions.ts
4
+ const extensionSchema = async (sql, input) => {
5
+ const [row] = await sql.query(`SELECT /* neon inspect */ n.nspname AS schema
6
+ FROM pg_catalog.pg_extension e
7
+ JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace
8
+ WHERE e.extname = $1`, [input.extension]);
9
+ if (row === void 0) throw new NeonToolCallerError(`${input.needs} needs the "${input.extension}" extension, which is not installed on database "${input.databaseName}". Installing it writes to the user's database, so ask the user first, then run \`CREATE EXTENSION IF NOT EXISTS ${input.extension};\`.`);
10
+ const schema = row.schema;
11
+ if (typeof schema !== "string") throw new NeonClientError(`pg_extension returned no schema name for ${input.extension}.`);
12
+ return schema;
13
+ };
14
+ /**
15
+ * Runs `statement` in a READ ONLY transaction whose `search_path` is only the
16
+ * extension's schema. Extensions can live in a schema that is not on the
17
+ * role's path, and a user object on that path could otherwise shadow the
18
+ * extension's; `pg_catalog` is always searched.
19
+ */
20
+ const readWithExtension = async (sql, input, statement) => {
21
+ const schema = await extensionSchema(sql, input);
22
+ const [, rows] = await sql.transaction([sql.query("SELECT /* neon inspect */ pg_catalog.set_config('search_path', pg_catalog.quote_ident($1), true)", [schema]), statement], { readOnly: true });
23
+ return rows;
24
+ };
25
+ export { readWithExtension };
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../../../src/lib/custom/sql/inspect/inspect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,cAAc,CAAC;AAItB;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO;CAKhE;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;kBAsBrC,CAAC;AAuFH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G5D,CAAC"}
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../../../src/lib/custom/sql/inspect/inspect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,4BAA4B,CAAC;AAWpC,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,cAAc,CAAC;AAItB;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO;CAKhE;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;kBAsBrC,CAAC;AAoFH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G5D,CAAC"}
@@ -3,6 +3,7 @@ import { INSPECT_CHECKS, INSPECT_MAX_LIMIT, INSPECT_QUERIES } from "./queries.js
3
3
  import { assembleInspectReport } from "./report.js";
4
4
  import { bindTool, publishedId } from "../../../ergonomic/bind.js";
5
5
  import { branchIdField, computeIdField, projectIdField, resolveConnection, sqlClient, sqlMetadata } from "../connection.js";
6
+ import { readWithExtension } from "../extensions.js";
6
7
  import { sqlReadAnnotations } from "../schema.js";
7
8
  import { formatInspectQueryError, selectInspectTargets } from "./targets.js";
8
9
  import { NeonDbError } from "@neondatabase/serverless";
@@ -47,12 +48,16 @@ const runDiagnostic = async (check, run) => {
47
48
  const runInspectOnDatabase = async (check, uri, databaseName, signal) => {
48
49
  const query = INSPECT_QUERIES[check];
49
50
  const sql = sqlClient(uri, signal);
50
- if (query.requiresExtension) {
51
- const extension = query.requiresExtension;
52
- if ((await runDiagnostic(check, () => sql.query("SELECT 1 FROM pg_extension WHERE extname = $1", [extension]))).length === 0) throw new NeonToolCallerError(`The "${check}" check needs the "${extension}" extension, which is not installed on database "${databaseName}". Installing it writes to the user's database, so ask the user first, then run \`CREATE EXTENSION IF NOT EXISTS ${extension};\`.`);
51
+ const extension = query.requiresExtension;
52
+ if (extension === void 0) {
53
+ const [rows] = await runDiagnostic(check, () => sql.transaction([sql.query(query.sql)], { readOnly: true }));
54
+ return rows;
53
55
  }
54
- const [rows] = await runDiagnostic(check, () => sql.transaction([sql.query(query.sql)], { readOnly: true }));
55
- return rows;
56
+ return runDiagnostic(check, () => readWithExtension(sql, {
57
+ extension,
58
+ needs: `The "${check}" check`,
59
+ databaseName
60
+ }, sql.query(query.sql)));
56
61
  };
57
62
  /**
58
63
  * Puts which database failed into the message of the original error, so its
@@ -38,7 +38,9 @@ export type InspectQuery = {
38
38
  sqlLimit?: number;
39
39
  /**
40
40
  * Postgres extension the query needs (e.g. `pg_stat_statements`). When set,
41
- * the handler verifies the extension is installed before running the query.
41
+ * the handler verifies the extension is installed, then runs the query with
42
+ * `search_path` set to only the extension's schema, so anything outside
43
+ * `pg_catalog` and the extension must be schema-qualified.
42
44
  */
43
45
  requiresExtension?: string;
44
46
  /**
@@ -47,6 +49,20 @@ export type InspectQuery = {
47
49
  */
48
50
  scope: InspectQueryScope;
49
51
  };
52
+ /**
53
+ * Drops `pg_stat_statements` rows (alias `s`) that the user's workload did not
54
+ * run: Neon's compute manager runs its setup as `cloud_admin`; Neon's proxy
55
+ * resets each pooled session it serves HTTP queries on with the listed
56
+ * statements, as the user's role; and every diagnostic here, including
57
+ * `queries.listSlow`, carries the `neon inspect` comment. The comment has to
58
+ * follow the statement's first keyword: Postgres drops a leading comment from
59
+ * the text it stores.
60
+ *
61
+ * The role is matched by name because `neon inspect db --db-url` runs the same
62
+ * SQL against any Postgres, where an app may well log in as a superuser.
63
+ * `query` is NULL when Postgres cannot read its stored text, hence `COALESCE`.
64
+ */
65
+ export declare const WORKLOAD_STATEMENTS_FILTER = "\n NOT EXISTS (\n SELECT 1 FROM pg_roles r\n WHERE r.oid = s.userid AND r.rolname = 'cloud_admin'\n )\n AND COALESCE(s.query, '') NOT IN (\n 'CLOSE ALL', 'SET SESSION AUTHORIZATION DEFAULT', 'RESET ALL',\n 'DEALLOCATE ALL', 'UNLISTEN *', 'SELECT pg_advisory_unlock_all()',\n 'DISCARD TEMP', 'DISCARD SEQUENCES'\n )\n AND COALESCE(s.query, '') NOT LIKE '%/* neon inspect */%'";
50
66
  /**
51
67
  * Typed as an exact `Record` so adding a check to `INSPECT_CHECKS` without
52
68
  * writing its query is a compile error.
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../../src/lib/custom/sql/inspect/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OA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,wCAAwC;IACxC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,KAAK,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,2cAU2B,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,YAAY,EAAE,YAAY,CA2d9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,OAAO,CAAC"}
@@ -22,6 +22,30 @@ const INSPECT_CHECKS = [
22
22
  "subscriptions"
23
23
  ];
24
24
  /**
25
+ * Drops `pg_stat_statements` rows (alias `s`) that the user's workload did not
26
+ * run: Neon's compute manager runs its setup as `cloud_admin`; Neon's proxy
27
+ * resets each pooled session it serves HTTP queries on with the listed
28
+ * statements, as the user's role; and every diagnostic here, including
29
+ * `queries.listSlow`, carries the `neon inspect` comment. The comment has to
30
+ * follow the statement's first keyword: Postgres drops a leading comment from
31
+ * the text it stores.
32
+ *
33
+ * The role is matched by name because `neon inspect db --db-url` runs the same
34
+ * SQL against any Postgres, where an app may well log in as a superuser.
35
+ * `query` is NULL when Postgres cannot read its stored text, hence `COALESCE`.
36
+ */
37
+ const WORKLOAD_STATEMENTS_FILTER = `
38
+ NOT EXISTS (
39
+ SELECT 1 FROM pg_roles r
40
+ WHERE r.oid = s.userid AND r.rolname = 'cloud_admin'
41
+ )
42
+ AND COALESCE(s.query, '') NOT IN (
43
+ 'CLOSE ALL', 'SET SESSION AUTHORIZATION DEFAULT', 'RESET ALL',
44
+ 'DEALLOCATE ALL', 'UNLISTEN *', 'SELECT pg_advisory_unlock_all()',
45
+ 'DISCARD TEMP', 'DISCARD SEQUENCES'
46
+ )
47
+ AND COALESCE(s.query, '') NOT LIKE '%/* neon inspect */%'`;
48
+ /**
25
49
  * Typed as an exact `Record` so adding a check to `INSPECT_CHECKS` without
26
50
  * writing its query is a compile error.
27
51
  */
@@ -36,7 +60,7 @@ const INSPECT_QUERIES = {
36
60
  ],
37
61
  emptyMessage: "No user tables found.",
38
62
  sql: `
39
- SELECT
63
+ SELECT /* neon inspect */
40
64
  n.nspname AS schema,
41
65
  c.relname AS name,
42
66
  pg_size_pretty(pg_table_size(c.oid)) AS size
@@ -58,7 +82,7 @@ const INSPECT_QUERIES = {
58
82
  ],
59
83
  emptyMessage: "No indexes found.",
60
84
  sql: `
61
- SELECT
85
+ SELECT /* neon inspect */
62
86
  n.nspname AS schema,
63
87
  c.relname AS name,
64
88
  pg_size_pretty(pg_relation_size(c.oid)) AS size
@@ -81,7 +105,7 @@ const INSPECT_QUERIES = {
81
105
  ],
82
106
  emptyMessage: "No unused indexes detected.",
83
107
  sql: `
84
- SELECT
108
+ SELECT /* neon inspect */
85
109
  s.schemaname || '.' || s.relname AS "table",
86
110
  s.indexrelname AS index,
87
111
  pg_size_pretty(pg_relation_size(s.indexrelid)) AS index_size,
@@ -104,7 +128,7 @@ const INSPECT_QUERIES = {
104
128
  ],
105
129
  emptyMessage: "No user tables found.",
106
130
  sql: `
107
- SELECT
131
+ SELECT /* neon inspect */
108
132
  schemaname AS schema,
109
133
  relname AS name,
110
134
  seq_scan AS count
@@ -124,7 +148,7 @@ const INSPECT_QUERIES = {
124
148
  emptyMessage: "No long-running queries in this database.",
125
149
  emptyMessageAll: "No long-running queries in any database.",
126
150
  sql: `
127
- SELECT
151
+ SELECT /* neon inspect */
128
152
  pid,
129
153
  (now() - query_start)::text AS duration,
130
154
  state,
@@ -160,7 +184,7 @@ const INSPECT_QUERIES = {
160
184
  ],
161
185
  emptyMessage: "No active queries running longer than 30 seconds on this compute.",
162
186
  sql: `
163
- WITH activity AS MATERIALIZED (
187
+ WITH /* neon inspect */ activity AS MATERIALIZED (
164
188
  SELECT *
165
189
  FROM pg_stat_activity
166
190
  WHERE state = 'active'
@@ -216,7 +240,7 @@ const INSPECT_QUERIES = {
216
240
  emptyMessage: "No locks held in this database.",
217
241
  emptyMessageAll: "No locks held in any database.",
218
242
  sql: `
219
- SELECT
243
+ SELECT /* neon inspect */
220
244
  a.pid,
221
245
  c.relname,
222
246
  l.mode,
@@ -234,7 +258,7 @@ const INSPECT_QUERIES = {
234
258
  `
235
259
  },
236
260
  outliers: {
237
- describe: "The 25 queries with the highest cumulative execution time since statistics were last reset (needs pg_stat_statements)",
261
+ describe: "The 25 queries with the highest cumulative execution time since statistics were last reset, leaving out Neon's own setup and session-reset statements and these diagnostics (needs pg_stat_statements)",
238
262
  scope: "database",
239
263
  fields: [
240
264
  "total_exec_time",
@@ -246,7 +270,7 @@ const INSPECT_QUERIES = {
246
270
  sqlLimit: 25,
247
271
  requiresExtension: "pg_stat_statements",
248
272
  sql: `
249
- SELECT
273
+ SELECT /* neon inspect */
250
274
  (interval '1 millisecond' * total_exec_time)::text AS total_exec_time,
251
275
  to_char(
252
276
  (total_exec_time / nullif(sum(total_exec_time) OVER (), 0)) * 100,
@@ -257,12 +281,13 @@ const INSPECT_QUERIES = {
257
281
  FROM pg_stat_statements s
258
282
  JOIN pg_database d ON d.oid = s.dbid
259
283
  WHERE d.datname = current_database()
284
+ AND ${WORKLOAD_STATEMENTS_FILTER}
260
285
  ORDER BY s.total_exec_time DESC
261
286
  LIMIT 25;
262
287
  `
263
288
  },
264
289
  calls: {
265
- describe: "The 25 most frequently executed queries since statistics were last reset (needs pg_stat_statements)",
290
+ describe: "The 25 most frequently executed queries since statistics were last reset, leaving out Neon's own setup and session-reset statements and these diagnostics (needs pg_stat_statements)",
266
291
  scope: "database",
267
292
  fields: [
268
293
  "ncalls",
@@ -274,7 +299,7 @@ const INSPECT_QUERIES = {
274
299
  sqlLimit: 25,
275
300
  requiresExtension: "pg_stat_statements",
276
301
  sql: `
277
- SELECT
302
+ SELECT /* neon inspect */
278
303
  calls AS ncalls,
279
304
  (interval '1 millisecond' * total_exec_time)::text AS total_exec_time,
280
305
  to_char(
@@ -285,6 +310,7 @@ const INSPECT_QUERIES = {
285
310
  FROM pg_stat_statements s
286
311
  JOIN pg_database d ON d.oid = s.dbid
287
312
  WHERE d.datname = current_database()
313
+ AND ${WORKLOAD_STATEMENTS_FILTER}
288
314
  ORDER BY calls DESC
289
315
  LIMIT 25;
290
316
  `
@@ -296,7 +322,7 @@ const INSPECT_QUERIES = {
296
322
  emptyMessage: "No LFC stats available.",
297
323
  requiresExtension: "neon",
298
324
  sql: `
299
- WITH lfc AS (
325
+ WITH /* neon inspect */ lfc AS (
300
326
  SELECT lfc_key AS k, lfc_value AS v
301
327
  FROM neon_get_lfc_stats() t(lfc_key text, lfc_value bigint)
302
328
  )
@@ -323,7 +349,7 @@ const INSPECT_QUERIES = {
323
349
  emptyMessage: "No working-set estimate available.",
324
350
  requiresExtension: "neon",
325
351
  sql: `
326
- SELECT
352
+ SELECT /* neon inspect */
327
353
  w.window,
328
354
  pg_size_pretty(w.working_set_bytes) AS working_set,
329
355
  pg_size_pretty(pg_size_bytes(current_setting('neon.file_cache_size_limit'))) AS lfc_size,
@@ -357,7 +383,7 @@ const INSPECT_QUERIES = {
357
383
  ],
358
384
  emptyMessage: "No user tables found.",
359
385
  sql: `
360
- SELECT
386
+ SELECT /* neon inspect */
361
387
  n.nspname AS schema,
362
388
  c.relname AS "table",
363
389
  to_char(psut.last_vacuum, 'YYYY-MM-DD HH24:MI') AS last_vacuum,
@@ -391,7 +417,7 @@ const INSPECT_QUERIES = {
391
417
  emptyMessage: "No bloat estimate available.",
392
418
  sqlLimit: 25,
393
419
  sql: `
394
- WITH constants AS (
420
+ WITH /* neon inspect */ constants AS (
395
421
  SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 8 AS ma
396
422
  ),
397
423
  bloat_info AS (
@@ -456,7 +482,7 @@ const INSPECT_QUERIES = {
456
482
  ],
457
483
  emptyMessage: "No replication slots found.",
458
484
  sql: `
459
- SELECT
485
+ SELECT /* neon inspect */
460
486
  s.slot_name,
461
487
  s.slot_type,
462
488
  CASE
@@ -499,7 +525,7 @@ const INSPECT_QUERIES = {
499
525
  emptyMessage: "No subscriptions found on this database.",
500
526
  emptyMessageAll: "No subscriptions found on any database.",
501
527
  sql: `
502
- SELECT
528
+ SELECT /* neon inspect */
503
529
  sub.subname AS subscription,
504
530
  sr.srrelid::regclass::text AS table_name,
505
531
  CASE sr.srsubstate
@@ -525,4 +551,4 @@ const INSPECT_QUERIES = {
525
551
  const INSPECT_DEFAULT_LIMIT = 50;
526
552
  /** Ceiling on `limit`, so a diagnostic can never return an unbounded response. */
527
553
  const INSPECT_MAX_LIMIT = 1e3;
528
- export { INSPECT_CHECKS, INSPECT_DEFAULT_LIMIT, INSPECT_MAX_LIMIT, INSPECT_QUERIES };
554
+ export { INSPECT_CHECKS, INSPECT_DEFAULT_LIMIT, INSPECT_MAX_LIMIT, INSPECT_QUERIES, WORKLOAD_STATEMENTS_FILTER };
@@ -83,7 +83,7 @@ const prepareMigrationTool = (options) => bindTool(options, {
83
83
  operationId: "migrations.prepare",
84
84
  id: publishedId("migrations.prepare"),
85
85
  title: "Prepare Database Migration",
86
- description: "Applies a schema change on a new temporary branch and returns a migration_id. Test it there with {{sql.run}}, ask the user, then always call {{migrations.complete}} with the response's complete object so the branch is deleted.",
86
+ description: "Applies a schema change on a new temporary branch and returns a migration_id. Test it there with {{sql.run}}, then always call {{migrations.complete}} with the response's complete object so the branch is deleted.",
87
87
  inputSchema: prepareMigrationInputSchema,
88
88
  outputSchema: prepareMigrationOutputSchema,
89
89
  annotations: {
@@ -136,7 +136,7 @@ const completeMigrationTool = (options) => bindTool(options, {
136
136
  operationId: "migrations.complete",
137
137
  id: publishedId("migrations.complete"),
138
138
  title: "Complete Database Migration",
139
- description: "Applies or discards a prepared migration and deletes the temporary branch. NEVER run autonomously; always ask the user first. Pass the complete object from {{migrations.prepare}}; apply_changes false discards.",
139
+ description: "Applies or discards a prepared migration and deletes the temporary branch. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. Pass the complete object from {{migrations.prepare}}; apply_changes false discards.",
140
140
  inputSchema: completeMigrationInputSchema,
141
141
  outputSchema: completeMigrationOutputSchema,
142
142
  annotations: sqlWriteAnnotations,
@@ -65,7 +65,7 @@ const runSqlTool = (options) => bindTool(options, {
65
65
  operationId: "sql.run",
66
66
  id: publishedId("sql.run"),
67
67
  title: "Run SQL",
68
- description: "Runs one SQL statement on a branch's database and returns its rows. After a prepare step, pass its temporary branch_id. NEVER run destructive SQL autonomously; always ask the user first.",
68
+ description: "Runs one SQL statement on a branch's database and returns its rows. For several statements, send one per call or use {{sql.runTransaction}}. After a prepare step, pass its temporary branch_id. NEVER run destructive SQL autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first.",
69
69
  inputSchema: runSqlInputSchema,
70
70
  outputSchema: sqlResultOutputSchema,
71
71
  annotations: sqlWriteAnnotations,
@@ -76,7 +76,7 @@ const runSqlTransactionTool = (options) => bindTool(options, {
76
76
  operationId: "sql.runTransaction",
77
77
  id: publishedId("sql.runTransaction"),
78
78
  title: "Run SQL Transaction",
79
- description: "Runs several SQL statements in one transaction and returns each one's rows. After a prepare step, pass its temporary branch_id. NEVER run destructive SQL autonomously; always ask the user first.",
79
+ description: "Runs several SQL statements in one transaction and returns each one's rows. After a prepare step, pass its temporary branch_id. NEVER run destructive SQL autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first.",
80
80
  inputSchema: runSqlTransactionInputSchema,
81
81
  outputSchema: z.array(sqlResultOutputSchema),
82
82
  annotations: sqlWriteAnnotations,
@@ -1 +1 @@
1
- {"version":3,"file":"slow-queries.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/slow-queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,yBAAyB,CAAC;AAWjC,eAAO,MAAM,0BAA0B;;;;;;;kBAarC,CAAC;AAwCH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE5D,CAAC"}
1
+ {"version":3,"file":"slow-queries.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/sql/slow-queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,MAAM,yBAAyB,CAAC;AAajC,eAAO,MAAM,0BAA0B;;;;;;;kBAarC,CAAC;AAmCH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgE5D,CAAC"}
@@ -1,8 +1,8 @@
1
- import { NeonToolCallerError } from "../../caller-error.js";
1
+ import { WORKLOAD_STATEMENTS_FILTER } from "./inspect/queries.js";
2
2
  import { bindTool, publishedId } from "../../ergonomic/bind.js";
3
3
  import { branchIdField, computeIdField, databaseNameField, projectIdField, resolveConnection, sqlClient, sqlMetadata } from "./connection.js";
4
+ import { readWithExtension } from "./extensions.js";
4
5
  import * as z from "zod";
5
- import { NeonClientError } from "@neon/sdk";
6
6
  // src/lib/custom/sql/slow-queries.ts
7
7
  const listSlowQueriesInputSchema = z.strictObject({
8
8
  project_id: projectIdField,
@@ -12,13 +12,8 @@ const listSlowQueriesInputSchema = z.strictObject({
12
12
  limit: z.number().default(10).describe("Maximum number of queries to return."),
13
13
  min_execution_time: z.number().default(1e3).describe("Ignored; results are not filtered by time.")
14
14
  });
15
- const EXTENSION_CHECK_SQL = `
16
- SELECT EXISTS (
17
- SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements'
18
- ) as extension_exists;
19
- `;
20
15
  const SLOW_QUERIES_SQL = `
21
- SELECT
16
+ SELECT /* neon inspect */
22
17
  query,
23
18
  calls,
24
19
  total_exec_time,
@@ -33,9 +28,10 @@ const SLOW_QUERIES_SQL = `
33
28
  wal_records,
34
29
  wal_fpi,
35
30
  wal_bytes
36
- FROM pg_stat_statements
31
+ FROM pg_stat_statements s
37
32
  WHERE query NOT LIKE '%pg_stat_statements%'
38
33
  AND query NOT LIKE '%EXPLAIN%'
34
+ AND ${WORKLOAD_STATEMENTS_FILTER}
39
35
  ORDER BY mean_exec_time DESC
40
36
  LIMIT $1;
41
37
  `;
@@ -50,7 +46,7 @@ const listSlowQueriesTool = (options) => bindTool(options, {
50
46
  operationId: "queries.listSlow",
51
47
  id: publishedId("queries.listSlow"),
52
48
  title: "List Slow Queries",
53
- description: "Lists queries from pg_stat_statements, slowest mean execution time first. For sizes, indexes, locks, cache, bloat, or replication, use {{database.inspect}}.",
49
+ description: "Lists queries from pg_stat_statements, slowest mean execution time first, leaving out Neon's own setup and session-reset statements. For sizes, indexes, locks, cache, bloat, or replication, use {{database.inspect}}.",
54
50
  inputSchema: listSlowQueriesInputSchema,
55
51
  outputSchema: listSlowQueriesOutputSchema,
56
52
  annotations: {
@@ -64,13 +60,11 @@ const listSlowQueriesTool = (options) => bindTool(options, {
64
60
  }, async (neonClient, input, signal, context) => {
65
61
  const connection = await resolveConnection(neonClient, input, context, signal);
66
62
  const sql = sqlClient(connection.uri, signal);
67
- const [extension] = await sql.query(EXTENSION_CHECK_SQL);
68
- const installed = extension?.extension_exists;
69
- if (installed !== true) {
70
- const message = "pg_stat_statements extension is not installed on the database. Please install it using the following command: CREATE EXTENSION pg_stat_statements;";
71
- throw installed === false ? new NeonToolCallerError(message) : new NeonClientError(message);
72
- }
73
- const formatted = (await sql.query(SLOW_QUERIES_SQL, [input.limit])).map((query) => ({
63
+ const formatted = (await readWithExtension(sql, {
64
+ extension: "pg_stat_statements",
65
+ needs: "Listing slow queries",
66
+ databaseName: connection.databaseName
67
+ }, sql.query(SLOW_QUERIES_SQL, [input.limit]))).map((query) => ({
74
68
  query: query.query,
75
69
  calls: query.calls,
76
70
  total_exec_time_ms: query.total_exec_time,
@@ -20,9 +20,10 @@ export type NeonEffectTools<Tools extends Readonly<Record<string, ExecutableNeon
20
20
  };
21
21
  /**
22
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`.
23
+ * read-only tools: the adapter never resends a mutation, and leaves 423, 429,
24
+ * and 503 responses to the SDK, which retries them and honours `Retry-After`.
25
+ * A `NeonNetworkError` can arrive after the SDK already resent a `GET` whose
26
+ * connection dropped.
26
27
  */
27
28
  export interface NeonToolRetryPolicy {
28
29
  readonly schedule: Schedule.Schedule<unknown, NeonToolError>;
@@ -1 +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;AAElE,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,CAA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BAAmB,CAAC;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,mBAI1C,CAAC;AAoDF;;;;;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"}
@@ -2779,8 +2779,134 @@ export declare const toolFactories: {
2779
2779
  "branches.delete": (options: ToolClientOptions) => NeonTool<z.ZodObject<{
2780
2780
  project_id: z.ZodString;
2781
2781
  branch_id: z.ZodString;
2782
- }, z.core.$strict>, "delete_branches", null, z.ZodNull> & {
2783
- outputSchema: z.ZodNull;
2782
+ }, z.core.$strict>, "delete_branches", {
2783
+ id: string;
2784
+ project_id: string;
2785
+ parent_id?: string | null | undefined;
2786
+ parent_lsn?: string | null | undefined;
2787
+ parent_timestamp?: string | null | undefined;
2788
+ name: string;
2789
+ current_state: import("@neon/sdk").BranchState;
2790
+ pending_state?: string | null | undefined;
2791
+ state_changed_at: string;
2792
+ logical_size?: number | null | undefined;
2793
+ creation_source: string;
2794
+ primary?: boolean | null | undefined;
2795
+ default: boolean;
2796
+ protected: boolean;
2797
+ cpu_used_sec: number;
2798
+ compute_time_seconds: number;
2799
+ active_time_seconds: number;
2800
+ written_data_bytes: number;
2801
+ data_transfer_bytes: number;
2802
+ created_at: string;
2803
+ updated_at: string;
2804
+ ttl_interval_seconds?: number | null | undefined;
2805
+ expires_at?: string | null | undefined;
2806
+ last_reset_at?: string | null | undefined;
2807
+ created_by?: {
2808
+ name?: string | null | undefined;
2809
+ image?: string | null | undefined;
2810
+ } | null | undefined;
2811
+ init_source?: string | null | undefined;
2812
+ restore_status?: string | null | undefined;
2813
+ restored_from?: string | null | undefined;
2814
+ restored_as?: string | null | undefined;
2815
+ restricted_actions?: {
2816
+ name: string;
2817
+ reason: string;
2818
+ }[] | null | undefined;
2819
+ recovery?: {
2820
+ deleted_at: string;
2821
+ recoverable_until: string;
2822
+ deletion_method: "user" | "ttl";
2823
+ } | null | undefined;
2824
+ } | null, z.ZodNullable<z.ZodObject<{
2825
+ id: z.ZodString;
2826
+ project_id: z.ZodString;
2827
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2828
+ parent_lsn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2829
+ parent_timestamp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2830
+ name: z.ZodString;
2831
+ current_state: z.ZodString;
2832
+ pending_state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2833
+ state_changed_at: z.ZodString;
2834
+ logical_size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2835
+ creation_source: z.ZodString;
2836
+ primary: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2837
+ default: z.ZodBoolean;
2838
+ protected: z.ZodBoolean;
2839
+ cpu_used_sec: z.ZodNumber;
2840
+ compute_time_seconds: z.ZodNumber;
2841
+ active_time_seconds: z.ZodNumber;
2842
+ written_data_bytes: z.ZodNumber;
2843
+ data_transfer_bytes: z.ZodNumber;
2844
+ created_at: z.ZodString;
2845
+ updated_at: z.ZodString;
2846
+ ttl_interval_seconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2847
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2848
+ last_reset_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2849
+ created_by: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2850
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2851
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2852
+ }, z.core.$loose>>>;
2853
+ init_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2854
+ restore_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2855
+ restored_from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2856
+ restored_as: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2857
+ restricted_actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
2858
+ name: z.ZodString;
2859
+ reason: z.ZodString;
2860
+ }, z.core.$loose>>>>;
2861
+ recovery: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2862
+ deleted_at: z.ZodString;
2863
+ recoverable_until: z.ZodString;
2864
+ deletion_method: z.ZodString;
2865
+ }, z.core.$loose>>>;
2866
+ }, z.core.$loose>>> & {
2867
+ outputSchema: z.ZodNullable<z.ZodObject<{
2868
+ id: z.ZodString;
2869
+ project_id: z.ZodString;
2870
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2871
+ parent_lsn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2872
+ parent_timestamp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2873
+ name: z.ZodString;
2874
+ current_state: z.ZodString;
2875
+ pending_state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2876
+ state_changed_at: z.ZodString;
2877
+ logical_size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2878
+ creation_source: z.ZodString;
2879
+ primary: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2880
+ default: z.ZodBoolean;
2881
+ protected: z.ZodBoolean;
2882
+ cpu_used_sec: z.ZodNumber;
2883
+ compute_time_seconds: z.ZodNumber;
2884
+ active_time_seconds: z.ZodNumber;
2885
+ written_data_bytes: z.ZodNumber;
2886
+ data_transfer_bytes: z.ZodNumber;
2887
+ created_at: z.ZodString;
2888
+ updated_at: z.ZodString;
2889
+ ttl_interval_seconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2890
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2891
+ last_reset_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2892
+ created_by: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2893
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2894
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2895
+ }, z.core.$loose>>>;
2896
+ init_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2897
+ restore_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2898
+ restored_from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2899
+ restored_as: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2900
+ restricted_actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
2901
+ name: z.ZodString;
2902
+ reason: z.ZodString;
2903
+ }, z.core.$loose>>>>;
2904
+ recovery: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2905
+ deleted_at: z.ZodString;
2906
+ recoverable_until: z.ZodString;
2907
+ deletion_method: z.ZodString;
2908
+ }, z.core.$loose>>>;
2909
+ }, z.core.$loose>>;
2784
2910
  };
2785
2911
  "branches.getDefault": (options: ToolClientOptions) => NeonTool<z.ZodObject<{
2786
2912
  project_id: z.ZodString;
@@ -4422,6 +4548,7 @@ export declare const toolFactories: {
4422
4548
  branch_id: z.ZodString;
4423
4549
  database_name: z.ZodString;
4424
4550
  }, z.core.$strict>, "get_postgres_data_api", {
4551
+ enabled: true;
4425
4552
  url: string;
4426
4553
  status: string;
4427
4554
  settings?: {
@@ -4442,7 +4569,9 @@ export declare const toolFactories: {
4442
4569
  jwks_url?: string | null | undefined;
4443
4570
  provider_name?: string | null | undefined;
4444
4571
  jwt_audience?: string | null | undefined;
4445
- }, z.ZodObject<{
4572
+ } | {
4573
+ enabled: false;
4574
+ }, z.ZodUnion<readonly [z.ZodObject<{
4446
4575
  url: z.ZodString;
4447
4576
  status: z.ZodString;
4448
4577
  settings: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodObject<{
@@ -4463,8 +4592,11 @@ export declare const toolFactories: {
4463
4592
  jwks_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4464
4593
  provider_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4465
4594
  jwt_audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4466
- }, z.core.$loose>> & {
4467
- outputSchema: z.ZodObject<{
4595
+ enabled: z.ZodLiteral<true>;
4596
+ }, z.core.$loose>, z.ZodObject<{
4597
+ enabled: z.ZodLiteral<false>;
4598
+ }, z.core.$loose>]>> & {
4599
+ outputSchema: z.ZodUnion<readonly [z.ZodObject<{
4468
4600
  url: z.ZodString;
4469
4601
  status: z.ZodString;
4470
4602
  settings: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodObject<{
@@ -4485,7 +4617,10 @@ export declare const toolFactories: {
4485
4617
  jwks_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4486
4618
  provider_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4487
4619
  jwt_audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4488
- }, z.core.$loose>;
4620
+ enabled: z.ZodLiteral<true>;
4621
+ }, z.core.$loose>, z.ZodObject<{
4622
+ enabled: z.ZodLiteral<false>;
4623
+ }, z.core.$loose>]>;
4489
4624
  };
4490
4625
  "postgres.dataApi.create": (options: ToolClientOptions) => NeonTool<z.ZodObject<{
4491
4626
  project_id: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/lib/ergonomic/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA0BzB,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAE7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,WAAW,CAAC;AAenB,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqvEK,CAAC"}
@@ -18,7 +18,7 @@ import { completeQueryTuningTool, prepareQueryTuningTool } from "../custom/sql/q
18
18
  import { listSlowQueriesTool } from "../custom/sql/slow-queries.js";
19
19
  import { compareSchemaTool, connectionStringTool, createBranchAndConnectTool, createBranchTool, createProjectAndConnectTool, createProjectTool, createRoleTool, getDefaultTool, lokiQueryRangeTool, resetFromParentTool, restoreSnapshotTool, setScheduleTool } from "./composed.js";
20
20
  import * as z from "zod";
21
- import { NEON_STATUS_API_URL, listNeonIncidents } from "@neon/sdk";
21
+ import { NEON_STATUS_API_URL, NeonNotFoundError, listNeonIncidents } from "@neon/sdk";
22
22
  // src/lib/ergonomic/catalog.ts
23
23
  const logReadAnnotations = {
24
24
  readOnlyHint: true,
@@ -29,7 +29,7 @@ const logReadAnnotations = {
29
29
  const listIncidentsInputSchema = z.strictObject({});
30
30
  const listIncidentsOutputSchema = z.looseObject({
31
31
  status: z.string().describe("Overall status: operational, degraded, or outage."),
32
- updated_at: z.string(),
32
+ updated_at: z.string().describe("When neonstatus.com last updated the overall status, not when this call fetched it."),
33
33
  status_page_url: z.string(),
34
34
  incidents: z.array(z.looseObject({
35
35
  id: z.string(),
@@ -64,7 +64,7 @@ const listIncidentsTool = (options) => ({
64
64
  operationId: "incidents.list",
65
65
  id: publishedId("incidents.list"),
66
66
  title: "List Neon incidents",
67
- description: "Lists open Neon incidents and maintenance from neonstatus.com and the affected components and regions. Needs no credentials. Call it when Neon requests fail unexpectedly or the user asks whether Neon is down.",
67
+ description: "Lists open Neon incidents and maintenance from neonstatus.com and the affected components and regions. Needs no credentials. Fetches the page on every call; updated_at is when neonstatus.com last updated the overall status, not when this call fetched it. Call it when Neon requests fail unexpectedly or the user asks whether Neon is down.",
68
68
  inputSchema: listIncidentsInputSchema,
69
69
  outputSchema: listIncidentsOutputSchema,
70
70
  annotations: {
@@ -259,7 +259,7 @@ const toolFactories = {
259
259
  "branches.delete": (options) => fromGenerated(options, {
260
260
  id: "branches.delete",
261
261
  generated: "deleteProjectBranch",
262
- output: z.null(),
262
+ output: Branch.nullable(),
263
263
  run: (neon, input, signal) => neon.branches.delete({
264
264
  projectId: input.project_id,
265
265
  branchId: input.branch_id
@@ -497,12 +497,22 @@ const toolFactories = {
497
497
  "postgres.dataApi.get": (options) => fromGenerated(options, {
498
498
  id: "postgres.dataApi.get",
499
499
  generated: "getProjectBranchDataAPI",
500
- output: DataAPIReponse,
501
- run: (neon, input, signal) => neon.postgres.dataApi.get({
502
- projectId: input.project_id,
503
- branchId: input.branch_id,
504
- databaseName: input.database_name
505
- }, { signal })
500
+ output: z.union([DataAPIReponse.extend({ enabled: z.literal(true) }), z.looseObject({ enabled: z.literal(false) })]),
501
+ run: async (neon, input, signal) => {
502
+ try {
503
+ return {
504
+ ...await neon.postgres.dataApi.get({
505
+ projectId: input.project_id,
506
+ branchId: input.branch_id,
507
+ databaseName: input.database_name
508
+ }, { signal }),
509
+ enabled: true
510
+ };
511
+ } catch (error) {
512
+ if (error instanceof NeonNotFoundError && /^data api not found$/i.test(error.message)) return { enabled: false };
513
+ throw error;
514
+ }
515
+ }
506
516
  }),
507
517
  "postgres.dataApi.create": (options) => fromGenerated(options, {
508
518
  id: "postgres.dataApi.create",
@@ -303,7 +303,7 @@ const resetFromParentTool = (options) => bindTool(options, {
303
303
  operationId: "branches.resetFromParent",
304
304
  id: publishedId("branches.resetFromParent"),
305
305
  title: "Reset branch from parent",
306
- 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}}.",
306
+ description: "Resets a branch to its parent's current state, discarding the branch's own changes. NEVER run autonomously: run it only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. preserve_under_name first saves the current state as a new branch. To restore a snapshot, use {{snapshots.restore}}.",
307
307
  inputSchema: resetFromParentInputSchema,
308
308
  outputSchema: Branch,
309
309
  annotations: writeAnnotations,
@@ -418,7 +418,7 @@ const restoreSnapshotTool = (options) => bindTool(options, {
418
418
  operationId: "snapshots.restore",
419
419
  id: publishedId("snapshots.restore"),
420
420
  title: "Restore snapshot",
421
- 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}}.",
421
+ 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: finalize only when the user's own message asks for it and unambiguously identifies its target; otherwise ask first. Swap in later with {{branches.finalizeRestore}}.",
422
422
  inputSchema: restoreSnapshotInputSchema,
423
423
  outputSchema: Branch,
424
424
  annotations: writeAnnotations,
@@ -1099,7 +1099,7 @@ const operationFactories = {
1099
1099
  "jwks_url": zCreateProjectBranchDataApiBody.shape.jwks_url.optional(),
1100
1100
  "provider_name": zCreateProjectBranchDataApiBody.shape.provider_name.optional(),
1101
1101
  "jwt_audience": zCreateProjectBranchDataApiBody.shape.jwt_audience.optional(),
1102
- "add_default_grants": zCreateProjectBranchDataApiBody.shape.add_default_grants.optional(),
1102
+ "add_default_grants": zCreateProjectBranchDataApiBody.shape.add_default_grants.describe("Grants the authenticated role read and write access to public-schema tables, including tables the database owner creates later. Without it, the Data API can read no table until you GRANT access. Never grants anonymous.").optional(),
1103
1103
  "skip_auth_schema": zCreateProjectBranchDataApiBody.shape.skip_auth_schema.optional(),
1104
1104
  "settings": zCreateProjectBranchDataApiBody.shape.settings.optional()
1105
1105
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon/tools",
3
- "version": "2.17.3",
3
+ "version": "2.19.0",
4
4
  "description": "Agent tools for the Neon SDK ergonomic client, compatible with MCP, Eve, and Mastra.",
5
5
  "keywords": [
6
6
  "neon",
@@ -75,10 +75,10 @@
75
75
  "dependencies": {
76
76
  "@neondatabase/serverless": "1.0.0",
77
77
  "zod": "^4.5.4",
78
- "@neon/sdk": "7.14.2"
78
+ "@neon/sdk": "7.15.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@neon/effect": "^0.5.5",
81
+ "@neon/effect": "^0.5.7",
82
82
  "effect": "^4.1.2"
83
83
  },
84
84
  "peerDependenciesMeta": {
@@ -104,7 +104,7 @@
104
104
  "typescript": "^5.9.0",
105
105
  "vitest": "^3.0.9",
106
106
  "@neon/e2e-harness": "0.0.0",
107
- "@neon/effect": "0.5.5"
107
+ "@neon/effect": "0.5.7"
108
108
  },
109
109
  "engines": {
110
110
  "node": ">=20.19.0"