@rnsk/toolkits 0.0.9 → 0.0.10

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 (132) hide show
  1. package/README.md +7 -1
  2. package/dist/index.d.ts +7 -1
  3. package/dist/index.js +13 -1
  4. package/dist/toolkits/hacker-news/icon.d.ts +5 -0
  5. package/dist/toolkits/hacker-news/icon.js +9 -0
  6. package/dist/toolkits/hacker-news/manifest.d.ts +3 -0
  7. package/dist/toolkits/hacker-news/manifest.js +25 -0
  8. package/dist/toolkits/hacker-news/tools/client.d.ts +8 -0
  9. package/dist/toolkits/hacker-news/tools/client.js +51 -0
  10. package/dist/toolkits/hacker-news/tools/index.d.ts +89 -0
  11. package/dist/toolkits/hacker-news/tools/index.js +22 -0
  12. package/dist/toolkits/hacker-news/tools/items.d.ts +42 -0
  13. package/dist/toolkits/hacker-news/tools/items.js +126 -0
  14. package/dist/toolkits/hacker-news/tools/search.d.ts +12 -0
  15. package/dist/toolkits/hacker-news/tools/search.js +40 -0
  16. package/dist/toolkits/hacker-news/tools/stories.d.ts +25 -0
  17. package/dist/toolkits/hacker-news/tools/stories.js +98 -0
  18. package/dist/toolkits/hostinger/icon.d.ts +5 -0
  19. package/dist/toolkits/hostinger/icon.js +6 -0
  20. package/dist/toolkits/hostinger/manifest.d.ts +3 -0
  21. package/dist/toolkits/hostinger/manifest.js +36 -0
  22. package/dist/toolkits/hostinger/tools/billing.d.ts +12 -0
  23. package/dist/toolkits/hostinger/tools/billing.js +35 -0
  24. package/dist/toolkits/hostinger/tools/client.d.ts +6 -0
  25. package/dist/toolkits/hostinger/tools/client.js +57 -0
  26. package/dist/toolkits/hostinger/tools/dns.d.ts +22 -0
  27. package/dist/toolkits/hostinger/tools/dns.js +47 -0
  28. package/dist/toolkits/hostinger/tools/domains.d.ts +21 -0
  29. package/dist/toolkits/hostinger/tools/domains.js +62 -0
  30. package/dist/toolkits/hostinger/tools/hosting.d.ts +17 -0
  31. package/dist/toolkits/hostinger/tools/hosting.js +38 -0
  32. package/dist/toolkits/hostinger/tools/index.d.ts +179 -0
  33. package/dist/toolkits/hostinger/tools/index.js +35 -0
  34. package/dist/toolkits/hostinger/tools/vps.d.ts +27 -0
  35. package/dist/toolkits/hostinger/tools/vps.js +77 -0
  36. package/dist/toolkits/hostinger/tools/whois.d.ts +33 -0
  37. package/dist/toolkits/hostinger/tools/whois.js +85 -0
  38. package/dist/toolkits/hugging-face/icon.d.ts +5 -0
  39. package/dist/toolkits/hugging-face/icon.js +6 -0
  40. package/dist/toolkits/hugging-face/manifest.d.ts +3 -0
  41. package/dist/toolkits/hugging-face/manifest.js +42 -0
  42. package/dist/toolkits/hugging-face/tools/client.d.ts +93 -0
  43. package/dist/toolkits/hugging-face/tools/client.js +192 -0
  44. package/dist/toolkits/hugging-face/tools/datasets-viewer.d.ts +65 -0
  45. package/dist/toolkits/hugging-face/tools/datasets-viewer.js +150 -0
  46. package/dist/toolkits/hugging-face/tools/datasets.d.ts +160 -0
  47. package/dist/toolkits/hugging-face/tools/datasets.js +383 -0
  48. package/dist/toolkits/hugging-face/tools/discussions.d.ts +68 -0
  49. package/dist/toolkits/hugging-face/tools/discussions.js +144 -0
  50. package/dist/toolkits/hugging-face/tools/index.d.ts +523 -0
  51. package/dist/toolkits/hugging-face/tools/index.js +163 -0
  52. package/dist/toolkits/hugging-face/tools/inference.d.ts +42 -0
  53. package/dist/toolkits/hugging-face/tools/inference.js +86 -0
  54. package/dist/toolkits/hugging-face/tools/models.d.ts +117 -0
  55. package/dist/toolkits/hugging-face/tools/models.js +273 -0
  56. package/dist/toolkits/hugging-face/tools/papers.d.ts +37 -0
  57. package/dist/toolkits/hugging-face/tools/papers.js +91 -0
  58. package/dist/toolkits/hugging-face/tools/repos.d.ts +96 -0
  59. package/dist/toolkits/hugging-face/tools/repos.js +201 -0
  60. package/dist/toolkits/hugging-face/tools/settings.d.ts +53 -0
  61. package/dist/toolkits/hugging-face/tools/settings.js +88 -0
  62. package/dist/toolkits/hugging-face/tools/spaces.d.ts +245 -0
  63. package/dist/toolkits/hugging-face/tools/spaces.js +468 -0
  64. package/dist/toolkits/hugging-face/tools/sql.d.ts +21 -0
  65. package/dist/toolkits/hugging-face/tools/sql.js +47 -0
  66. package/dist/toolkits/hugging-face/tools/users.d.ts +60 -0
  67. package/dist/toolkits/hugging-face/tools/users.js +132 -0
  68. package/dist/toolkits/hugging-face/tools/webhooks.d.ts +35 -0
  69. package/dist/toolkits/hugging-face/tools/webhooks.js +87 -0
  70. package/dist/toolkits/jira/icon.d.ts +5 -0
  71. package/dist/toolkits/jira/icon.js +6 -0
  72. package/dist/toolkits/jira/manifest.d.ts +3 -0
  73. package/dist/toolkits/jira/manifest.js +53 -0
  74. package/dist/toolkits/jira/tools/boards.d.ts +52 -0
  75. package/dist/toolkits/jira/tools/boards.js +104 -0
  76. package/dist/toolkits/jira/tools/client.d.ts +23 -0
  77. package/dist/toolkits/jira/tools/client.js +270 -0
  78. package/dist/toolkits/jira/tools/index.d.ts +1280 -0
  79. package/dist/toolkits/jira/tools/index.js +119 -0
  80. package/dist/toolkits/jira/tools/issue-fields.d.ts +10 -0
  81. package/dist/toolkits/jira/tools/issue-fields.js +111 -0
  82. package/dist/toolkits/jira/tools/issues.d.ts +304 -0
  83. package/dist/toolkits/jira/tools/issues.js +593 -0
  84. package/dist/toolkits/jira/tools/meta.d.ts +212 -0
  85. package/dist/toolkits/jira/tools/meta.js +369 -0
  86. package/dist/toolkits/jira/tools/projects.d.ts +130 -0
  87. package/dist/toolkits/jira/tools/projects.js +263 -0
  88. package/dist/toolkits/jira/tools/search.d.ts +90 -0
  89. package/dist/toolkits/jira/tools/search.js +181 -0
  90. package/dist/toolkits/jira/tools/users.d.ts +114 -0
  91. package/dist/toolkits/jira/tools/users.js +221 -0
  92. package/dist/toolkits/neo4j/icon.d.ts +5 -0
  93. package/dist/toolkits/neo4j/icon.js +6 -0
  94. package/dist/toolkits/neo4j/manifest.d.ts +3 -0
  95. package/dist/toolkits/neo4j/manifest.js +33 -0
  96. package/dist/toolkits/neo4j/tools/analytics.d.ts +21 -0
  97. package/dist/toolkits/neo4j/tools/analytics.js +91 -0
  98. package/dist/toolkits/neo4j/tools/client.d.ts +6 -0
  99. package/dist/toolkits/neo4j/tools/client.js +105 -0
  100. package/dist/toolkits/neo4j/tools/index.d.ts +198 -0
  101. package/dist/toolkits/neo4j/tools/index.js +30 -0
  102. package/dist/toolkits/neo4j/tools/instances.d.ts +47 -0
  103. package/dist/toolkits/neo4j/tools/instances.js +127 -0
  104. package/dist/toolkits/neo4j/tools/projects.d.ts +44 -0
  105. package/dist/toolkits/neo4j/tools/projects.js +110 -0
  106. package/dist/toolkits/neo4j/tools/snapshots.d.ts +20 -0
  107. package/dist/toolkits/neo4j/tools/snapshots.js +57 -0
  108. package/dist/toolkits/neon/icon.d.ts +5 -0
  109. package/dist/toolkits/neon/icon.js +8 -0
  110. package/dist/toolkits/neon/manifest.d.ts +3 -0
  111. package/dist/toolkits/neon/manifest.js +36 -0
  112. package/dist/toolkits/neon/tools/auth.d.ts +115 -0
  113. package/dist/toolkits/neon/tools/auth.js +286 -0
  114. package/dist/toolkits/neon/tools/branches.d.ts +189 -0
  115. package/dist/toolkits/neon/tools/branches.js +465 -0
  116. package/dist/toolkits/neon/tools/client.d.ts +10 -0
  117. package/dist/toolkits/neon/tools/client.js +69 -0
  118. package/dist/toolkits/neon/tools/dataapi.d.ts +42 -0
  119. package/dist/toolkits/neon/tools/dataapi.js +111 -0
  120. package/dist/toolkits/neon/tools/endpoints.d.ts +59 -0
  121. package/dist/toolkits/neon/tools/endpoints.js +163 -0
  122. package/dist/toolkits/neon/tools/index.d.ts +976 -0
  123. package/dist/toolkits/neon/tools/index.js +130 -0
  124. package/dist/toolkits/neon/tools/meta.d.ts +4 -0
  125. package/dist/toolkits/neon/tools/meta.js +16 -0
  126. package/dist/toolkits/neon/tools/orgs.d.ts +112 -0
  127. package/dist/toolkits/neon/tools/orgs.js +303 -0
  128. package/dist/toolkits/neon/tools/projects.d.ts +177 -0
  129. package/dist/toolkits/neon/tools/projects.js +468 -0
  130. package/dist/toolkits/neon/tools/snapshots.d.ts +24 -0
  131. package/dist/toolkits/neon/tools/snapshots.js +67 -0
  132. package/package.json +1 -1
@@ -0,0 +1,465 @@
1
+ // @ts-nocheck
2
+ import { tool } from 'ai';
3
+ import { z } from 'zod';
4
+ import { neon, setNested } from './client.js';
5
+ const tokenField = z.string().optional().describe('Injected by system; do not provide');
6
+ export const neonAddRoleToBranch = tool({
7
+ description: "Creates a new PostgreSQL role within a specific branch of a Neon project. Neon is a serverless PostgreSQL platform where roles are database-level users that can connect to the database and have specific permissions. Use this endpoint to: - Create application service accounts for database access - Set up read-only users for reporting - Create admin roles for database management The created role will have an auto-generated password returned in the response. Store this password securely as it may not be retrievable later. You can use the 'reveal_role_password' endpoint to retrieve it again if needed. Note: Role names must be valid PostgreSQL identifiers (max 63 bytes).",
8
+ inputSchema: z.object({
9
+ neonApiKey: tokenField,
10
+ branchId: z.string().describe("The branch ID where the role will be created (e.g., 'br-icy-cake-aebdped3'). Obtain this from the list branches endpoint."),
11
+ projectId: z.string().describe("The Neon project ID (e.g., 'calm-breeze-57229290'). Obtain this from the list projects endpoint."),
12
+ roleName: z.string().describe("The PostgreSQL role name to create. Must be a valid PostgreSQL identifier and cannot exceed 63 bytes in length. Common examples: 'admin', 'readonly_user', 'app_service'."),
13
+ }),
14
+ execute: async ({ neonApiKey, branchId, projectId, roleName }) => {
15
+ const queryParams = undefined;
16
+ const body = {};
17
+ if (roleName !== undefined)
18
+ setNested(body, 'role.name', roleName);
19
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles`, method: 'POST', query: queryParams, body });
20
+ },
21
+ });
22
+ export const neonCountProjectBranches = tool({
23
+ description: "Tool to get the total number of branches in a Neon project. Use when you need to count branches without retrieving full branch details. Optionally filter by branch name using the search parameter.",
24
+ inputSchema: z.object({
25
+ neonApiKey: tokenField,
26
+ search: z.string().optional().describe("Count branches matching the 'name' in search query"),
27
+ projectId: z.string().describe("The Neon project ID"),
28
+ }),
29
+ execute: async ({ neonApiKey, search, projectId }) => {
30
+ const res = await neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches`, method: 'GET', query: { search } });
31
+ if (res?.error)
32
+ return res;
33
+ const branches = Array.isArray(res?.branches) ? res.branches : [];
34
+ return { projectId, count: branches.length, branches };
35
+ },
36
+ });
37
+ export const neonCreateBranchDatabase = tool({
38
+ description: "Creates a new database within a specified project and branch in the Neon platform. This endpoint allows users to set up a new database with a custom name and assign an owner role, facilitating the organization and management of databases within the Neon ecosystem. It should be used when initializing a new database for a specific project or when branching requires a separate database instance. The endpoint is particularly useful for developers and database administrators who need to quickly set up new databases as part of their workflow or application deployment process. Note that this operation only creates the database; additional steps may be required to configure specific schemas, tables, or access permissions within the newly created database.",
39
+ inputSchema: z.object({
40
+ neonApiKey: tokenField,
41
+ branchId: z.string().describe("The branch ID where the database will be created (e.g., 'br-lucky-water-afkw1lov'). Obtain via NEON_GET_BRANCHES_FOR_PROJECT action."),
42
+ projectId: z.string().describe("The Neon project ID (e.g., 'dry-smoke-26258271'). Obtain via NEON_RETRIEVE_PROJECTS_LIST action."),
43
+ databaseName: z.string().describe("The name of the database to create. Must be a valid PostgreSQL database name (lowercase letters, numbers, underscores; max 63 characters)."),
44
+ databaseOwnerName: z.string().describe("The name of an existing role that will own the database (e.g., 'neondb_owner'). Obtain available roles via NEON_GET_BRANCH_ROLES_FOR_PROJECT action."),
45
+ }),
46
+ execute: async ({ neonApiKey, branchId, projectId, databaseName, databaseOwnerName }) => {
47
+ const queryParams = undefined;
48
+ const body = {};
49
+ if (databaseName !== undefined)
50
+ setNested(body, 'database.name', databaseName);
51
+ if (databaseOwnerName !== undefined)
52
+ setNested(body, 'database.owner_name', databaseOwnerName);
53
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/databases`, method: 'POST', query: queryParams, body });
54
+ },
55
+ });
56
+ export const neonCreateBranchesSnapshot = tool({
57
+ description: "Creates a snapshot from the specified branch at a specific point in time. Snapshots capture the state of a branch and can be used for database versioning, creating backups, or establishing checkpoints for AI agents. Use when you need to preserve the exact state of your database at a moment in time. This endpoint may initiate an asynchronous operation.",
58
+ inputSchema: z.object({
59
+ neonApiKey: tokenField,
60
+ lsn: z.string().optional().describe("Target Log Sequence Number (LSN) for the snapshot (e.g., '0/19A3328'). Cannot be used together with timestamp parameter."),
61
+ name: z.string().optional().describe("Name for the snapshot (e.g., 'test-snapshot-root-branch'). If not provided, an auto-generated name will be used."),
62
+ branchId: z.string().describe("The branch ID from which to create the snapshot (e.g., 'br-lucky-water-afkw1lov'). Obtain via NEON_GET_BRANCHES_FOR_PROJECT action."),
63
+ timestamp: z.string().optional().describe("Target timestamp for the snapshot in ISO 8601 format (e.g., '2026-02-15T12:00:00Z'). Cannot be used together with lsn parameter."),
64
+ expiresAt: z.string().optional().describe("Expiration time for the snapshot in ISO 8601 format (e.g., '2026-08-13T00:00:00Z'). After this time, the snapshot will be automatically deleted."),
65
+ projectId: z.string().describe("The Neon project ID (e.g., 'dry-smoke-26258271'). Obtain via NEON_RETRIEVE_PROJECTS_LIST action."),
66
+ }),
67
+ execute: async ({ neonApiKey, lsn, name, branchId, timestamp, expiresAt, projectId }) => {
68
+ const queryParams = undefined;
69
+ const body = {};
70
+ if (lsn !== undefined)
71
+ setNested(body, 'lsn', lsn);
72
+ if (name !== undefined)
73
+ setNested(body, 'name', name);
74
+ if (timestamp !== undefined)
75
+ setNested(body, 'timestamp', timestamp);
76
+ if (expiresAt !== undefined)
77
+ setNested(body, 'expires_at', expiresAt);
78
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/snapshot`, method: 'POST', query: queryParams, body });
79
+ },
80
+ });
81
+ export const neonCreateNewProjectBranch = tool({
82
+ description: "Creates a new branch in a Neon project. Branches are copy-on-write clones of the parent branch's data, perfect for creating development/staging environments, testing features, or previewing database changes without affecting production. The branch is created from the project's default branch unless a parent_id is specified. By default, the branch copies all data from the parent ('parent-data'). Note: A branch is created without a compute endpoint. To connect to the branch, use the 'create_compute_endpoint' action to add a read_write or read_only endpoint.",
83
+ inputSchema: z.object({
84
+ neonApiKey: tokenField,
85
+ projectId: z.string().describe("The Neon project ID. You can find this on the Settings page in the Neon Console or by listing projects. Format: 'adjective-noun-12345678' (e.g., 'autumn-disk-484331')."),
86
+ branchName: z.string().optional().describe("Name for the new branch. If not specified, an auto-generated name will be used (e.g., 'br-square-base-aehfbgdy'). Max 256 characters."),
87
+ branchParentId: z.string().optional().describe("The branch ID to use as parent for the new branch. If not specified, the project's default branch (usually 'main') is used. Format: 'br-name-id' (e.g., 'br-wispy-dew-591433')."),
88
+ branchInitSource: z.string().optional().describe("How to initialize the branch data. Options: 'parent-data' (default) copies all data from parent, 'schema-only' copies only the schema without data."),
89
+ }),
90
+ execute: async ({ neonApiKey, projectId, branchName, branchParentId, branchInitSource }) => {
91
+ const queryParams = undefined;
92
+ const body = {};
93
+ if (branchName !== undefined)
94
+ setNested(body, 'branch.name', branchName);
95
+ if (branchParentId !== undefined)
96
+ setNested(body, 'branch.parent_id', branchParentId);
97
+ if (branchInitSource !== undefined)
98
+ setNested(body, 'branch.init_source', branchInitSource);
99
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches`, method: 'POST', query: queryParams, body });
100
+ },
101
+ });
102
+ export const neonCreateProjectBranchAnonymized = tool({
103
+ description: "Creates a new branch with anonymized data using PostgreSQL Anonymizer for static masking. Use when developers need to work with masked production data in a safe development environment.",
104
+ inputSchema: z.object({
105
+ neonApiKey: tokenField,
106
+ projectId: z.string().describe("The Neon project ID where the anonymized branch will be created."),
107
+ branchCreate: z.record(z.any()).optional().describe("Configuration for creating the new branch"),
108
+ maskingRules: z.array(z.record(z.any())).optional().describe("Optional list of masking rules to apply to the branch. Each rule specifies how to anonymize a specific column using PostgreSQL Anonymizer functions."),
109
+ annotationValue: z.record(z.any()).optional().describe("Optional metadata annotations to attach to the branch."),
110
+ startAnonymization: z.boolean().optional().describe("If true, automatically starts the anonymization process after branch creation. If false or omitted, masking rules are stored but not applied until manually triggered."),
111
+ }),
112
+ execute: async ({ neonApiKey, projectId, branchCreate, maskingRules, annotationValue, startAnonymization }) => {
113
+ const queryParams = undefined;
114
+ const body = {};
115
+ if (branchCreate !== undefined)
116
+ setNested(body, 'branch_create', branchCreate);
117
+ if (maskingRules !== undefined)
118
+ setNested(body, 'masking_rules', maskingRules);
119
+ if (annotationValue !== undefined)
120
+ setNested(body, 'annotation_value', annotationValue);
121
+ if (startAnonymization !== undefined)
122
+ setNested(body, 'start_anonymization', startAnonymization);
123
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branch_anonymized`, method: 'POST', query: queryParams, body });
124
+ },
125
+ });
126
+ export const neonDeleteDatabaseFromBranch = tool({
127
+ description: "Deletes a specific database from a designated branch within a project in the Neon platform. This endpoint should be used when you need to permanently remove a database and all its associated data from a particular branch of a project. It's crucial to use this endpoint with caution as the deletion operation is irreversible. This tool is particularly useful for cleaning up unnecessary databases, managing storage, or removing test databases that are no longer needed. However, it should not be used for temporary data management; instead, consider using database suspension or archiving features if available. Note that this operation only affects the specified branch and does not impact the database in other branches or the main project.",
128
+ inputSchema: z.object({
129
+ neonApiKey: tokenField,
130
+ branchId: z.string().describe("The unique identifier for the branch within the project. Format: 'br-' prefix followed by alphanumeric characters (e.g., 'br-lucky-water-afkw1lov'). Can be obtained from the list branches API."),
131
+ projectId: z.string().describe("The unique identifier for the Neon project. Format: alphanumeric with hyphens (e.g., 'dry-smoke-26258271'). Can be found in the Neon console or via the list projects API."),
132
+ databaseName: z.string().describe("The name of the database to delete. This is the database name as it appears in PostgreSQL, not an ID. The deletion is permanent and cannot be undone."),
133
+ }),
134
+ execute: async ({ neonApiKey, branchId, projectId, databaseName }) => {
135
+ const queryParams = undefined;
136
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/databases/${encodeURIComponent(databaseName)}`, method: 'DELETE', query: queryParams });
137
+ },
138
+ });
139
+ export const neonDeleteProjectBranchById = tool({
140
+ description: "Deletes a specific branch within a project in the Neon B2B SaaS integration platform. This endpoint permanently removes the specified branch and all associated data from the project. It should be used when a branch is no longer needed, such as after merging changes or abandoning a development path. Caution should be exercised when using this endpoint, as the deletion is irreversible. It's important to ensure that any valuable data or configurations in the branch have been backed up or merged before deletion. This operation cannot be undone, so double-checking the project_id and branch_id before execution is crucial to avoid accidental deletions.",
141
+ inputSchema: z.object({
142
+ neonApiKey: tokenField,
143
+ branchId: z.string().describe("The branch ID"),
144
+ projectId: z.string().describe("The Neon project ID"),
145
+ }),
146
+ execute: async ({ neonApiKey, branchId, projectId }) => {
147
+ const queryParams = undefined;
148
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}`, method: 'DELETE', query: queryParams });
149
+ },
150
+ });
151
+ export const neonDeleteProjectBranchRole = tool({
152
+ description: "Deletes a PostgreSQL role from a specific branch within a Neon project. This permanently removes the role and its associated database permissions. Use this endpoint to: - Remove obsolete user accounts from a database branch - Clean up roles after application decommissioning - Revoke access for former team members Important notes: - This operation is permanent and cannot be undone - The deletion triggers an async 'apply_config' operation on the compute endpoint - If the role doesn't exist, returns 204 No Content (idempotent behavior) - If the role exists and is deleted, returns 200 OK with role and operation details - You cannot delete the default owner role created with the database",
153
+ inputSchema: z.object({
154
+ neonApiKey: tokenField,
155
+ branchId: z.string().describe("The unique branch identifier within the project (e.g., 'br-rough-voice-ah2lazzk'). Can be retrieved using the list project branches endpoint."),
156
+ roleName: z.string().describe("The name of the PostgreSQL role to delete from the branch (e.g., 'my_app_user'). Cannot exceed 63 bytes in length. Note: Deleting a role is permanent and cannot be undone."),
157
+ projectId: z.string().describe("The unique Neon project identifier (e.g., 'proud-meadow-87189985'). Can be retrieved using the list projects endpoint."),
158
+ }),
159
+ execute: async ({ neonApiKey, branchId, roleName, projectId }) => {
160
+ const queryParams = undefined;
161
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles/${encodeURIComponent(roleName)}`, method: 'DELETE', query: queryParams });
162
+ },
163
+ });
164
+ export const neonFetchDatabaseForBranch = tool({
165
+ description: "Retrieves a list of databases associated with a specific project and branch in the Neon platform. This endpoint allows developers to view all databases within a particular project and branch context, which is useful for managing different environments (e.g., development, staging, production) or versions of an application's database setup. It should be used when you need to inventory the databases in a specific branch or verify the existence of databases in a particular project environment. The endpoint does not provide detailed information about each database's schema or contents; it's primarily for listing purposes.",
166
+ inputSchema: z.object({
167
+ neonApiKey: tokenField,
168
+ branchId: z.string().describe("The branch ID"),
169
+ projectId: z.string().describe("The Neon project ID"),
170
+ }),
171
+ execute: async ({ neonApiKey, branchId, projectId }) => {
172
+ const queryParams = undefined;
173
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/databases`, method: 'GET', query: queryParams });
174
+ },
175
+ });
176
+ export const neonFinalizeBranchRestore = tool({
177
+ description: "Finalizes the restore operation for a branch created from a snapshot. This updates the branch to function as the original branch it replaced by: reassigning computes from the original branch (which restarts them), renaming the restored branch to the original's name, and renaming the original branch. Only applies to branches created using the restoreSnapshot endpoint.",
178
+ inputSchema: z.object({
179
+ neonApiKey: tokenField,
180
+ name: z.string().optional().describe("Used to rename the existing branch when it is replaced. If omitted, a default name is generated and used."),
181
+ branchId: z.string().describe("The ID of the branch created from a snapshot that will be finalized. Format: 'br-adjective-noun-alphanumeric' (e.g., 'br-late-voice-ahlrw52f')."),
182
+ projectId: z.string().describe("The Neon project ID. Format: 'adjective-noun-12345678' (e.g., 'proud-meadow-87189985')."),
183
+ }),
184
+ execute: async ({ neonApiKey, name, branchId, projectId }) => {
185
+ const queryParams = undefined;
186
+ const body = {};
187
+ if (name !== undefined)
188
+ setNested(body, 'name', name);
189
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/finalize_restore`, method: 'POST', query: queryParams, body });
190
+ },
191
+ });
192
+ export const neonGetBranchesAnonymizedStatus = tool({
193
+ description: "Retrieves the current status of an anonymized branch, including its state and progress information. This endpoint allows you to monitor the anonymization process from initialization through completion. Only anonymized branches will have status information available. Use this action when you need to: - Monitor the progress of an anonymization process - Check the state of an anonymized branch (created, initialized, anonymizing, anonymized, error) - View details about the most recent anonymization attempt - Identify when an anonymization operation failed Note: This endpoint is currently in Beta.",
194
+ inputSchema: z.object({
195
+ neonApiKey: tokenField,
196
+ branchId: z.string().describe("The branch ID. You can obtain the branch_id by listing the project's branches. Only anonymized branches will have status information available."),
197
+ projectId: z.string().describe("The Neon project ID. You can obtain a project_id by listing the projects for your Neon account."),
198
+ }),
199
+ execute: async ({ neonApiKey, branchId, projectId }) => {
200
+ const queryParams = undefined;
201
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/anonymized_status`, method: 'GET', query: queryParams });
202
+ },
203
+ });
204
+ export const neonGetBranchesBackupSchedule = tool({
205
+ description: "Retrieves the backup schedule configuration for a specified branch within a Neon project. This endpoint provides information about when backups are created and how long they are retained. Use this when you need to verify or audit the backup schedule settings for a branch. Note: This endpoint is currently in Beta.",
206
+ inputSchema: z.object({
207
+ neonApiKey: tokenField,
208
+ branchId: z.string().describe("The branch ID"),
209
+ projectId: z.string().describe("The Neon project ID"),
210
+ }),
211
+ execute: async ({ neonApiKey, branchId, projectId }) => {
212
+ const queryParams = undefined;
213
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/backup_schedule`, method: 'GET', query: queryParams });
214
+ },
215
+ });
216
+ export const neonGetBranchesForProject = tool({
217
+ description: "Retrieves a list of branches associated with a specific project in the Neon B2B SaaS integration platform. This endpoint should be used when you need to get an overview of all branches within a particular project, which is useful for version management and workflow control. It provides information about different versions or development stages of the project, allowing for efficient project management and collaboration. The endpoint is particularly helpful when planning merges, reviewing project history, or deciding on which branch to base new development work.",
218
+ inputSchema: z.object({
219
+ neonApiKey: tokenField,
220
+ search: z.string().optional().describe("Search by branch 'name' or 'id'. You can specify partial 'name' or 'id' values to filter results. "),
221
+ projectId: z.string().describe("The Neon project ID"),
222
+ }),
223
+ execute: async ({ neonApiKey, search, projectId }) => {
224
+ const queryParams = { search: search };
225
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches`, method: 'GET', query: queryParams });
226
+ },
227
+ });
228
+ export const neonGetBranchesMaskingRules = tool({
229
+ description: "Retrieves the masking rules for the specified anonymized branch. Masking rules define how sensitive data should be anonymized using PostgreSQL Anonymizer. Use this when you need to view the data anonymization configuration for a branch. Note: This endpoint is currently in Beta.",
230
+ inputSchema: z.object({
231
+ neonApiKey: tokenField,
232
+ branchId: z.string().describe("The branch ID. You can obtain this by listing the project's branches."),
233
+ projectId: z.string().describe("The Neon project ID. You can obtain this by listing the projects for your Neon account."),
234
+ }),
235
+ execute: async ({ neonApiKey, branchId, projectId }) => {
236
+ const queryParams = undefined;
237
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/masking_rules`, method: 'GET', query: queryParams });
238
+ },
239
+ });
240
+ export const neonGetBranchRolesForProject = tool({
241
+ description: "Retrieves the roles associated with a specific branch within a project in the Neon B2B SaaS integration platform. This endpoint is used to fetch the current role assignments for a given project and branch combination, which is essential for managing access control and permissions within the Neon ecosystem. It should be used when you need to review or audit the roles assigned to a particular branch, such as before making changes to permissions or when verifying the current access structure. The endpoint does not modify any roles; it only provides a read-only view of the existing role assignments. Keep in mind that the response will only include roles for the specified branch and does not provide information about roles in other branches or at the project level.",
242
+ inputSchema: z.object({
243
+ neonApiKey: tokenField,
244
+ branchId: z.string().describe("The branch ID"),
245
+ projectId: z.string().describe("The Neon project ID"),
246
+ }),
247
+ execute: async ({ neonApiKey, branchId, projectId }) => {
248
+ const queryParams = undefined;
249
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles`, method: 'GET', query: queryParams });
250
+ },
251
+ });
252
+ export const neonGetProjectBranches = tool({
253
+ description: "Retrieves detailed information about a specific branch within a Neon project. This endpoint allows developers to fetch the current state and configuration of a branch, including its name, creation timestamp, and other relevant metadata. It's particularly useful when you need to verify branch details, check its status, or gather information for further operations on the branch. The endpoint should be used when you require up-to-date information about a single branch in your project's context. Note that this endpoint only provides read access and does not modify any branch data.",
254
+ inputSchema: z.object({
255
+ neonApiKey: tokenField,
256
+ branchId: z.string().describe("The branch ID"),
257
+ projectId: z.string().describe("The Neon project ID"),
258
+ }),
259
+ execute: async ({ neonApiKey, branchId, projectId }) => {
260
+ const queryParams = undefined;
261
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}`, method: 'GET', query: queryParams });
262
+ },
263
+ });
264
+ export const neonGetProjectBranchRole = tool({
265
+ description: "Retrieves detailed information about a specific role within a particular branch of a Neon project. This endpoint is used to fetch the current configuration, permissions, and other relevant details associated with the specified role. It's particularly useful for auditing access controls, verifying role settings, or gathering information before making modifications to role permissions. The endpoint requires precise identification of the project, branch, and role, ensuring that the correct role information is retrieved from the appropriate context within the Neon platform's hierarchical structure.",
266
+ inputSchema: z.object({
267
+ neonApiKey: tokenField,
268
+ branchId: z.string().describe("The unique identifier of the branch within the project (e.g., 'br-lucky-water-afkw1lov'). You can obtain this from the list branches endpoint."),
269
+ roleName: z.string().describe("The name of the database role to retrieve (e.g., 'neondb_owner', 'authenticator', 'authenticated', 'anonymous'). This is the PostgreSQL role name within the branch."),
270
+ projectId: z.string().describe("The unique identifier of the Neon project (e.g., 'dry-smoke-26258271'). You can obtain this from the list projects endpoint."),
271
+ }),
272
+ execute: async ({ neonApiKey, branchId, roleName, projectId }) => {
273
+ const queryParams = undefined;
274
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles/${encodeURIComponent(roleName)}`, method: 'GET', query: queryParams });
275
+ },
276
+ });
277
+ export const neonGetProjectBranchSchemaComparison = tool({
278
+ description: "Compares the database schema of a branch with another branch's schema in a Neon project. Returns the difference as a unified diff format string. Use this when you need to understand what schema changes exist between two branches (e.g., before merging, to review migrations, or to verify schema consistency). The comparison can be done at specific points in time using LSN or timestamp parameters for both branches.",
279
+ inputSchema: z.object({
280
+ neonApiKey: tokenField,
281
+ lsn: z.string().optional().describe("Optional Log Sequence Number (LSN) for which the schema is retrieved. Format: 'X/XXXXXXXX' (e.g., '0/1F79928')."),
282
+ dbName: z.string().describe("Name of the database for which the schema is compared (e.g., 'neondb'). Can be obtained from the databases list for a branch."),
283
+ baseLsn: z.string().optional().describe("Optional Log Sequence Number (LSN) for the base branch schema. Format: 'X/XXXXXXXX'."),
284
+ branchId: z.string().describe("The branch ID to get the schema from (e.g., 'br-calm-bread-ah40d54d'). Can be obtained from the branches list for a project."),
285
+ timestamp: z.string().optional().describe("Optional ISO 8601 timestamp for the point in time for which the schema is retrieved (e.g., '2022-11-30T20:09:48Z')."),
286
+ projectId: z.string().describe("The Neon project ID (e.g., 'proud-meadow-87189985'). Can be obtained from the project list or project details."),
287
+ baseBranchId: z.string().optional().describe("Optional branch ID to compare the schema with. If not specified, compares with the parent branch."),
288
+ baseTimestamp: z.string().optional().describe("Optional ISO 8601 timestamp for the point in time for the base branch schema (e.g., '2022-11-30T20:09:48Z')."),
289
+ }),
290
+ execute: async ({ neonApiKey, lsn, dbName, baseLsn, branchId, timestamp, projectId, baseBranchId, baseTimestamp }) => {
291
+ const queryParams = { lsn: lsn, db_name: dbName, base_lsn: baseLsn, timestamp: timestamp, base_branch_id: baseBranchId, base_timestamp: baseTimestamp };
292
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/schema_comparison`, method: 'GET', query: queryParams });
293
+ },
294
+ });
295
+ export const neonGetSchemaForProjectBranch = tool({
296
+ description: "Retrieves the PostgreSQL database schema (DDL) for a specific database on a branch within a Neon project. Returns the schema as SQL statements (similar to pg_dump output), including CREATE TABLE, ALTER TABLE, CREATE INDEX, and other DDL statements. This is useful for understanding the database structure, comparing schemas between branches, or for documentation purposes. The schema can be retrieved at the current point in time or at a specific historical point using either an LSN or timestamp parameter. Note: The branch's compute endpoint must be active for this endpoint to work.",
297
+ inputSchema: z.object({
298
+ neonApiKey: tokenField,
299
+ lsn: z.string().optional().describe("Optional Log Sequence Number (LSN) to retrieve the schema at a specific point in the WAL. Format: 'X/XXXXXXXX' (e.g., '0/1F79928'). If not specified, returns the current schema."),
300
+ dbName: z.string().describe("Name of the database to retrieve schema for (e.g., 'neondb'). Can be obtained from the databases list for a branch."),
301
+ branchId: z.string().describe("The branch ID (e.g., 'br-lucky-water-afkw1lov'). Can be obtained from the branches list for a project."),
302
+ timestamp: z.string().optional().describe("Optional ISO 8601 timestamp to retrieve the schema at a specific point in time (e.g., '2025-07-26T17:44:06Z'). If not specified, returns the current schema."),
303
+ projectId: z.string().describe("The Neon project ID (e.g., 'dry-smoke-26258271'). Can be obtained from the project list or project details."),
304
+ }),
305
+ execute: async ({ neonApiKey, lsn, dbName, branchId, timestamp, projectId }) => {
306
+ const queryParams = { lsn: lsn, db_name: dbName, timestamp: timestamp };
307
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/schema`, method: 'GET', query: queryParams });
308
+ },
309
+ });
310
+ export const neonModifyBranchDetailsInProject = tool({
311
+ description: "Updates the details of a specific branch within a project in the Neon platform. This endpoint allows you to modify the name and protection status of an existing branch. It is particularly useful when you need to rename a branch or change its protection settings without creating a new branch. The endpoint uses partial updates, so you can specify only the fields you want to change. This tool should be used when managing branch configurations in a Neon project, but it cannot be used to create new branches or delete existing ones.",
312
+ inputSchema: z.object({
313
+ neonApiKey: tokenField,
314
+ branchId: z.string().describe("The unique identifier of the branch to modify. Format: 'br-<adjective>-<noun>-<alphanumeric>' (e.g., 'br-square-base-aehfbgdy'). Can be obtained from the branches list endpoint for a project."),
315
+ projectId: z.string().describe("The unique identifier of the Neon project containing the branch to modify. Format: '<adjective>-<noun>-<number>' (e.g., 'calm-breeze-57229290'). Can be obtained from the projects list endpoint."),
316
+ branchName: z.string().optional().describe("The new name for the branch. If not provided, the branch name remains unchanged. Branch names should be descriptive and follow your team's naming conventions (e.g., 'main', 'production', 'development', 'feature-xyz')."),
317
+ branchProtected: z.boolean().optional().describe("Whether the branch should be protected. Protected branches have restrictions that prevent certain destructive operations. Set to true to enable protection, false to disable it. If not provided, the protection status remains unchanged. Note: Protection features may require a paid plan."),
318
+ }),
319
+ execute: async ({ neonApiKey, branchId, projectId, branchName, branchProtected }) => {
320
+ const queryParams = undefined;
321
+ const body = {};
322
+ if (branchName !== undefined)
323
+ setNested(body, 'branch.name', branchName);
324
+ if (branchProtected !== undefined)
325
+ setNested(body, 'branch.protected', branchProtected);
326
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}`, method: 'PATCH', query: queryParams, body });
327
+ },
328
+ });
329
+ export const neonPatchBranchDatabaseInformation = tool({
330
+ description: "Updates the properties of a specific database within a project branch in the Neon platform. This endpoint allows for partial modifications of database attributes, such as changing its name or owner. It should be used when you need to rename a database or transfer ownership to a different role within the same project and branch. The update is performed using the PATCH method, allowing for selective property changes without affecting unspecified attributes. Note that this operation modifies existing database metadata and does not create new databases or alter the actual data within the database.",
331
+ inputSchema: z.object({
332
+ neonApiKey: tokenField,
333
+ branchId: z.string().describe("The branch ID where the database resides (e.g., 'br-lucky-water-afkw1lov')"),
334
+ projectId: z.string().describe("The Neon project ID (e.g., 'dry-smoke-26258271')"),
335
+ databaseName: z.string().describe("The current name of the database to update"),
336
+ newDatabaseName: z.string().optional().describe("The new name for the database. Use this to rename the database."),
337
+ databaseOwnerName: z.string().optional().describe("The name of the role to transfer database ownership to. The role must exist in the branch."),
338
+ }),
339
+ execute: async ({ neonApiKey, branchId, projectId, databaseName, newDatabaseName, databaseOwnerName }) => {
340
+ const queryParams = undefined;
341
+ const body = {};
342
+ if (newDatabaseName !== undefined)
343
+ setNested(body, 'database.name', newDatabaseName);
344
+ if (databaseOwnerName !== undefined)
345
+ setNested(body, 'database.owner_name', databaseOwnerName);
346
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/databases/${encodeURIComponent(databaseName)}`, method: 'PATCH', query: queryParams, body });
347
+ },
348
+ });
349
+ export const neonResetRolePasswordForBranch = tool({
350
+ description: "Resets the password for a PostgreSQL role on a specific Neon branch and generates a new password. Use this when credentials need to be rotated for security purposes (e.g., employee offboarding, suspected compromise, or routine security practices). The response includes the new password - store it securely as it cannot be retrieved later. The new password becomes active once the triggered 'apply_config' operation completes; the old password remains valid until then. Note: This is a destructive operation that invalidates the current password.",
351
+ inputSchema: z.object({
352
+ neonApiKey: tokenField,
353
+ branchId: z.string().describe("The branch ID where the role exists (e.g., 'br-lucky-water-afkw1lov')"),
354
+ roleName: z.string().describe("The name of the database role whose password should be reset (e.g., 'neondb_owner', 'authenticator')"),
355
+ projectId: z.string().describe("The Neon project ID (e.g., 'dry-smoke-26258271')"),
356
+ }),
357
+ execute: async ({ neonApiKey, branchId, roleName, projectId }) => {
358
+ const queryParams = undefined;
359
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles/${encodeURIComponent(roleName)}/reset_password`, method: 'POST', query: queryParams });
360
+ },
361
+ });
362
+ export const neonRestoreProjectBranch = tool({
363
+ description: "This endpoint restores a branch to a specific state or point in time. Use it to recover data, revert changes, or create new branch states based on historical data. The restoration uses either a Log Sequence Number (LSN) or timestamp from the source branch. Important: For self-restoration or branches with children, use preserve_under_name to save the current state. Note: Restoration time varies based on data volume and restoration point.",
364
+ inputSchema: z.object({
365
+ neonApiKey: tokenField,
366
+ branchId: z.string().describe("The ID of the branch to restore (the target branch that will receive the restored data)."),
367
+ projectId: z.string().describe("The Neon project ID containing the branch to restore."),
368
+ sourceLsn: z.string().optional().describe("A Log Sequence Number (LSN) on the source branch. The branch will be restored with data from this LSN. Format example: '0/19A3328'."),
369
+ sourceBranchId: z.string().describe("The branch_id of the restore source branch. If source_timestamp and source_lsn are omitted, the branch will be restored to head. If source_branch_id is equal to the branch's id (self-restoration), source_timestamp or source_lsn is required."),
370
+ sourceTimestamp: z.string().optional().describe("A timestamp identifying a point in time on the source branch. The branch will be restored with data starting from this point in time. The timestamp must be provided in ISO 8601 format; for example: '2024-02-26T12:00:00Z'."),
371
+ preserveUnderName: z.string().optional().describe("If provided, the previous state of the branch will be saved to a new branch with this name. Required if the branch has children or if source_branch_id equals the branch id (self-restoration). All existing child branches will be moved to the newly created branch under this name."),
372
+ }),
373
+ execute: async ({ neonApiKey, branchId, projectId, sourceLsn, sourceBranchId, sourceTimestamp, preserveUnderName }) => {
374
+ const queryParams = undefined;
375
+ const body = {};
376
+ if (sourceBranchId !== undefined)
377
+ setNested(body, 'source_branch_id', sourceBranchId);
378
+ if (sourceLsn !== undefined)
379
+ setNested(body, 'source_lsn', sourceLsn);
380
+ if (sourceTimestamp !== undefined)
381
+ setNested(body, 'source_timestamp', sourceTimestamp);
382
+ if (preserveUnderName !== undefined)
383
+ setNested(body, 'preserve_under_name', preserveUnderName);
384
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/restore`, method: 'POST', query: queryParams, body });
385
+ },
386
+ });
387
+ export const neonRetrieveBranchDatabaseDetails = tool({
388
+ description: "Retrieves detailed information about a specific database within a Neon project and branch. This endpoint allows developers to fetch crucial metadata and configuration details for a given database, enabling them to monitor and manage their database resources effectively. It should be used when you need to inspect the current state, settings, or properties of a particular database in your Neon environment. The endpoint provides a snapshot of the database's characteristics but does not modify any data or settings.",
389
+ inputSchema: z.object({
390
+ neonApiKey: tokenField,
391
+ branchId: z.string().describe("The branch ID"),
392
+ projectId: z.string().describe("The Neon project ID"),
393
+ databaseName: z.string().describe("The database name"),
394
+ }),
395
+ execute: async ({ neonApiKey, branchId, projectId, databaseName }) => {
396
+ const queryParams = undefined;
397
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/databases/${encodeURIComponent(databaseName)}`, method: 'GET', query: queryParams });
398
+ },
399
+ });
400
+ export const neonRetrieveBranchEndpoints = tool({
401
+ description: "Retrieves all compute endpoints associated with a specific branch in a Neon project. Compute endpoints are the connection points for accessing your PostgreSQL database - they provide the hostname and configuration needed to connect to your database. Use this action when you need to: - Get connection details (host, region) for a branch's database - Check endpoint status (active, idle, suspended) - Review autoscaling and connection pooling settings - Monitor endpoint activity and configuration Returns a list of endpoints with details like host, region, current state, autoscaling limits, and pooler configuration. Most branches have one read_write endpoint, but may have additional read-only replicas.",
402
+ inputSchema: z.object({
403
+ neonApiKey: tokenField,
404
+ branchId: z.string().describe("The unique branch ID (e.g., 'br-lucky-water-afkw1lov'). Can be obtained from the list branches API or Neon console."),
405
+ projectId: z.string().describe("The unique Neon project ID (e.g., 'dry-smoke-26258271'). Can be found in the Neon console URL or via the list projects API."),
406
+ }),
407
+ execute: async ({ neonApiKey, branchId, projectId }) => {
408
+ const queryParams = undefined;
409
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/endpoints`, method: 'GET', query: queryParams });
410
+ },
411
+ });
412
+ export const neonRevealRolePasswordInBranch = tool({
413
+ description: "Reveals the password for a specific role within a branch of a Neon project. This endpoint is used when you need to retrieve a previously hidden or encrypted password for a database role. It's particularly useful for administrators who need to access or share role credentials securely. The endpoint should be used cautiously, as it exposes sensitive information. It does not modify the password, only retrieves it. Note that frequent use of this endpoint may be logged or restricted for security purposes.",
414
+ inputSchema: z.object({
415
+ neonApiKey: tokenField,
416
+ branchId: z.string().describe("The unique identifier of the branch within the project. Format: 'br-adjective-noun-xxxxxxxx' (e.g., 'br-lucky-water-afkw1lov'). Obtain from list branches API."),
417
+ roleName: z.string().describe("The name of the database role whose password you want to reveal. Common roles include 'neondb_owner' (default owner), 'authenticator', 'authenticated', 'anonymous', or custom roles you've created."),
418
+ projectId: z.string().describe("The unique identifier of the Neon project. Format: 'adjective-noun-12345678' (e.g., 'dry-smoke-26258271'). Obtain from list projects API."),
419
+ }),
420
+ execute: async ({ neonApiKey, branchId, roleName, projectId }) => {
421
+ const queryParams = undefined;
422
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/roles/${encodeURIComponent(roleName)}/reveal_password`, method: 'POST', query: queryParams });
423
+ },
424
+ });
425
+ export const neonSetBranchAsDefault = tool({
426
+ description: "Sets a specified branch as the default branch for a given project in Neon. This endpoint allows users to designate a particular branch as the primary or main branch for a project, which can be useful for organizing workflows and setting default behaviors. The operation is performed using a POST request, indicating that it modifies the state of the project. Use this endpoint when you need to change the default branch of a project, such as after creating a new branch or deciding to switch the main development focus. It's important to note that this action may affect how other operations interact with the project, as many systems use the default branch as a reference point for various functionalities.",
427
+ inputSchema: z.object({
428
+ neonApiKey: tokenField,
429
+ branchId: z.string().describe("The branch ID"),
430
+ projectId: z.string().describe("The Neon project ID"),
431
+ }),
432
+ execute: async ({ neonApiKey, branchId, projectId }) => {
433
+ const queryParams = undefined;
434
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/set_as_default`, method: 'POST', query: queryParams });
435
+ },
436
+ });
437
+ export const neonStartBranchAnonymization = tool({
438
+ description: "Starts the anonymization process for an anonymized branch that is in the initialized, error, or anonymized state. This will apply all defined masking rules to anonymize sensitive data in the branch databases. The branch must be an anonymized branch to start anonymization. Note: This endpoint is currently in Beta.",
439
+ inputSchema: z.object({
440
+ neonApiKey: tokenField,
441
+ branchId: z.string().describe("The branch ID"),
442
+ projectId: z.string().describe("The Neon project ID"),
443
+ }),
444
+ execute: async ({ neonApiKey, branchId, projectId }) => {
445
+ const queryParams = undefined;
446
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/anonymize`, method: 'POST', query: queryParams });
447
+ },
448
+ });
449
+ export const neonUpdateBranchesMaskingRules = tool({
450
+ description: "Updates the masking rules for the specified anonymized branch. Masking rules define how sensitive data should be anonymized using PostgreSQL Anonymizer. Use this when you need to add, modify, or remove data anonymization rules for a branch. Note: This endpoint is currently in Beta.",
451
+ inputSchema: z.object({
452
+ neonApiKey: tokenField,
453
+ branchId: z.string().describe("The branch ID. You can obtain this by listing the project's branches. The branch must be an anonymized branch."),
454
+ projectId: z.string().describe("The Neon project ID. You can obtain this by listing the projects for your Neon account."),
455
+ maskingRules: z.array(z.record(z.any())).describe("List of masking rules to apply to the branch. This will replace all existing masking rules for the branch. Pass an empty array to remove all masking rules."),
456
+ }),
457
+ execute: async ({ neonApiKey, branchId, projectId, maskingRules }) => {
458
+ const queryParams = undefined;
459
+ const body = {};
460
+ if (maskingRules !== undefined)
461
+ setNested(body, 'masking_rules', maskingRules);
462
+ return neon(neonApiKey, { path: `/projects/${encodeURIComponent(projectId)}/branches/${encodeURIComponent(branchId)}/masking_rules`, method: 'PATCH', query: queryParams, body });
463
+ },
464
+ });
465
+ //# sourceMappingURL=branches.js.map
@@ -0,0 +1,10 @@
1
+ declare const NEON_API = "https://console.neon.tech/api/v2";
2
+ export declare function neon(apiKey: any, { path, method, query, body }: {
3
+ path: any;
4
+ method?: string | undefined;
5
+ query: any;
6
+ body: any;
7
+ }): Promise<any>;
8
+ export declare function setNested(obj: any, dotted: any, value: any): any;
9
+ export { NEON_API };
10
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,69 @@
1
+ // @ts-nocheck
2
+ const NEON_API = 'https://console.neon.tech/api/v2';
3
+ function withQuery(url, query = {}) {
4
+ const params = new URLSearchParams();
5
+ for (const [key, value] of Object.entries(query)) {
6
+ if (value === undefined || value === null || value === '')
7
+ continue;
8
+ if (Array.isArray(value)) {
9
+ if (value.length === 0)
10
+ continue;
11
+ params.append(key, value.join(','));
12
+ }
13
+ else {
14
+ params.append(key, String(value));
15
+ }
16
+ }
17
+ const qs = params.toString();
18
+ return qs ? `${url}?${qs}` : url;
19
+ }
20
+ async function parseBody(response) {
21
+ const text = await response.text();
22
+ if (!text)
23
+ return { success: true };
24
+ try {
25
+ return JSON.parse(text);
26
+ }
27
+ catch {
28
+ return { raw: text };
29
+ }
30
+ }
31
+ export async function neon(apiKey, { path, method = 'GET', query, body }) {
32
+ if (!apiKey)
33
+ return { error: 'Neon API key is required. Connect Neon first.' };
34
+ const url = withQuery(`${NEON_API}${path}`, query);
35
+ try {
36
+ const response = await fetch(url, {
37
+ method,
38
+ headers: {
39
+ Authorization: `Bearer ${apiKey}`,
40
+ 'Content-Type': 'application/json',
41
+ Accept: 'application/json',
42
+ },
43
+ body: body !== undefined ? JSON.stringify(body) : undefined,
44
+ });
45
+ if (!response.ok) {
46
+ const details = await parseBody(response).catch(() => ({}));
47
+ return { error: `Neon API request failed with status ${response.status}`, details };
48
+ }
49
+ if (response.status === 204)
50
+ return { success: true };
51
+ return await parseBody(response);
52
+ }
53
+ catch (error) {
54
+ return { error: 'Error calling Neon API', message: error instanceof Error ? error.message : 'Unknown error' };
55
+ }
56
+ }
57
+ export function setNested(obj, dotted, value) {
58
+ const parts = dotted.split('.');
59
+ let cur = obj;
60
+ for (let i = 0; i < parts.length - 1; i++) {
61
+ if (cur[parts[i]] === undefined || typeof cur[parts[i]] !== 'object')
62
+ cur[parts[i]] = {};
63
+ cur = cur[parts[i]];
64
+ }
65
+ cur[parts[parts.length - 1]] = value;
66
+ return obj;
67
+ }
68
+ export { NEON_API };
69
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,42 @@
1
+ export declare const neonCreateBranchesDataApi: import("ai").Tool<{
2
+ projectId: string;
3
+ branchId: string;
4
+ databaseName: string;
5
+ neonApiKey?: string | undefined;
6
+ jwksUrl?: string | undefined;
7
+ jwtAudience?: string | undefined;
8
+ providerName?: string | undefined;
9
+ authProvider?: "neon_auth" | "external" | undefined;
10
+ settings?: Record<string, any> | undefined;
11
+ skipAuthSchema?: boolean | undefined;
12
+ addDefaultGrants?: boolean | undefined;
13
+ }, any>;
14
+ export declare const neonDeleteBranchDataApi: import("ai").Tool<{
15
+ projectId: string;
16
+ branchId: string;
17
+ databaseName: string;
18
+ neonApiKey?: string | undefined;
19
+ }, any>;
20
+ export declare const neonGetBranchesDataApi: import("ai").Tool<{
21
+ projectId: string;
22
+ branchId: string;
23
+ databaseName: string;
24
+ neonApiKey?: string | undefined;
25
+ }, any>;
26
+ export declare const neonUpdateBranchesDataApi: import("ai").Tool<{
27
+ projectId: string;
28
+ branchId: string;
29
+ databaseName: string;
30
+ neonApiKey?: string | undefined;
31
+ settingsDbSchemas?: string[] | undefined;
32
+ settingsDbMaxRows?: number | undefined;
33
+ settingsOpenapiMode?: string | undefined;
34
+ settingsDbAnonRole?: string | undefined;
35
+ settingsJwtRoleClaimKey?: string | undefined;
36
+ settingsDbAggregatesEnabled?: boolean | undefined;
37
+ settingsDbExtraSearchPath?: string | undefined;
38
+ settingsServerTimingEnabled?: boolean | undefined;
39
+ settingsJwtCacheMaxLifetime?: number | undefined;
40
+ settingsServerCorsAllowedOrigins?: string | undefined;
41
+ }, any>;
42
+ //# sourceMappingURL=dataapi.d.ts.map