@heroku/mcp-server 1.0.0 → 1.0.2

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 (83) hide show
  1. package/README.md +81 -16
  2. package/dist/index.js +0 -1
  3. package/dist/repl/heroku-cli-repl.js +0 -1
  4. package/dist/repl/heroku-cli-repl.spec.js +0 -1
  5. package/dist/services/app-service.js +0 -1
  6. package/dist/services/app-setup-service.js +0 -1
  7. package/dist/services/build-service.js +0 -1
  8. package/dist/services/dyno-service.js +0 -1
  9. package/dist/services/rendezvous.js +0 -1
  10. package/dist/services/source-service.js +0 -1
  11. package/dist/tools/addons.js +18 -119
  12. package/dist/tools/addons.spec.js +2 -40
  13. package/dist/tools/apps.js +39 -129
  14. package/dist/tools/apps.spec.js +1 -12
  15. package/dist/tools/data.js +39 -80
  16. package/dist/tools/data.spec.js +0 -1
  17. package/dist/tools/deploy-to-heroku.js +40 -71
  18. package/dist/tools/deploy-to-heroku.spec.js +0 -1
  19. package/dist/tools/logs.js +9 -38
  20. package/dist/tools/logs.spec.js +0 -1
  21. package/dist/tools/maintenance.js +3 -12
  22. package/dist/tools/maintenance.spec.js +0 -1
  23. package/dist/tools/pipelines.js +15 -33
  24. package/dist/tools/pipelines.spec.js +0 -1
  25. package/dist/tools/ps.js +10 -23
  26. package/dist/tools/ps.spec.js +0 -1
  27. package/dist/tools/spaces.js +2 -11
  28. package/dist/tools/spaces.spec.js +0 -1
  29. package/dist/tools/teams.js +2 -8
  30. package/dist/tools/teams.spec.js +0 -1
  31. package/dist/utils/command-builder.js +0 -1
  32. package/dist/utils/command-builder.spec.js +0 -1
  33. package/dist/utils/generate-request-init.js +0 -1
  34. package/dist/utils/handle-cli-output.js +0 -1
  35. package/dist/utils/handle-cli-output.spec.js +0 -1
  36. package/dist/utils/mcp-tool-response.js +0 -1
  37. package/dist/utils/read-app-json.js +0 -1
  38. package/dist/utils/read-app-json.spec.js +0 -1
  39. package/dist/utils/tarball.js +0 -1
  40. package/dist/utils/tarball.spec.js +0 -1
  41. package/dist/utils/tool-commands.js +0 -1
  42. package/package.json +3 -3
  43. package/dist/index.js.map +0 -1
  44. package/dist/repl/heroku-cli-repl.js.map +0 -1
  45. package/dist/repl/heroku-cli-repl.spec.js.map +0 -1
  46. package/dist/services/app-service.js.map +0 -1
  47. package/dist/services/app-setup-service.js.map +0 -1
  48. package/dist/services/build-service.js.map +0 -1
  49. package/dist/services/config-var-service.js +0 -101
  50. package/dist/services/dyno-service.js.map +0 -1
  51. package/dist/services/rendezvous.js.map +0 -1
  52. package/dist/services/source-service.js.map +0 -1
  53. package/dist/tools/addons.js.map +0 -1
  54. package/dist/tools/addons.spec.js.map +0 -1
  55. package/dist/tools/apps.js.map +0 -1
  56. package/dist/tools/apps.spec.js.map +0 -1
  57. package/dist/tools/data.js.map +0 -1
  58. package/dist/tools/data.spec.js.map +0 -1
  59. package/dist/tools/deploy-to-heroku.js.map +0 -1
  60. package/dist/tools/deploy-to-heroku.spec.js.map +0 -1
  61. package/dist/tools/logs.js.map +0 -1
  62. package/dist/tools/logs.spec.js.map +0 -1
  63. package/dist/tools/maintenance.js.map +0 -1
  64. package/dist/tools/maintenance.spec.js.map +0 -1
  65. package/dist/tools/pipelines.js.map +0 -1
  66. package/dist/tools/pipelines.spec.js.map +0 -1
  67. package/dist/tools/ps.js.map +0 -1
  68. package/dist/tools/ps.spec.js.map +0 -1
  69. package/dist/tools/spaces.js.map +0 -1
  70. package/dist/tools/spaces.spec.js.map +0 -1
  71. package/dist/tools/teams.js.map +0 -1
  72. package/dist/tools/teams.spec.js.map +0 -1
  73. package/dist/utils/command-builder.js.map +0 -1
  74. package/dist/utils/command-builder.spec.js.map +0 -1
  75. package/dist/utils/generate-request-init.js.map +0 -1
  76. package/dist/utils/handle-cli-output.js.map +0 -1
  77. package/dist/utils/handle-cli-output.spec.js.map +0 -1
  78. package/dist/utils/mcp-tool-response.js.map +0 -1
  79. package/dist/utils/read-app-json.js.map +0 -1
  80. package/dist/utils/read-app-json.spec.js.map +0 -1
  81. package/dist/utils/tarball.js.map +0 -1
  82. package/dist/utils/tarball.spec.js.map +0 -1
  83. package/dist/utils/tool-commands.js.map +0 -1
@@ -3,56 +3,25 @@ import { handleCliOutput } from '../utils/handle-cli-output.js';
3
3
  import { CommandBuilder } from '../utils/command-builder.js';
4
4
  import { TOOL_COMMAND_MAP } from '../utils/tool-commands.js';
5
5
  /**
6
- * Schema for listing Heroku applications with filtering and output format options.
7
- * This schema defines the structure and validation rules for the list apps operation.
6
+ * Schema for listing Heroku apps with filters
8
7
  */
9
8
  export const listAppsOptionsSchema = z.object({
10
- all: z
11
- .boolean()
12
- .optional()
13
- .describe('When true, displays a comprehensive list including: (1) apps owned by the user and (2) apps where the user ' +
14
- 'is a collaborator through direct access or team membership. When false or omitted, shows only owned apps.'),
15
- json: z
16
- .boolean()
17
- .optional()
18
- .describe('Controls the output format. When true, returns a detailed JSON response containing app metadata such as ' +
19
- 'generation, buildpacks, owner information, and region. When false or omitted, returns a simplified text ' +
20
- 'format.'),
21
- personal: z
22
- .boolean()
23
- .optional()
24
- .describe('Forces the tool to list applications from your personal account, even when you have a default team configured. ' +
25
- 'When true, overrides any default team setting and shows only apps owned by your personal account. ' +
26
- 'This is particularly useful when you work with multiple teams but need to specifically view your personal apps. ' +
27
- 'When false or omitted, follows the default behavior of using the default team if one is set.'),
28
- space: z
29
- .string()
30
- .optional()
31
- .describe('Filters the results to show only apps within a specific private space. Provide the private space name to ' +
32
- 'filter. This parameter is mutually exclusive with the team parameter.'),
33
- team: z
34
- .string()
35
- .optional()
36
- .describe('Filters the results to show only apps belonging to a specific team. Provide the team name to filter. ' +
37
- 'This parameter is mutually exclusive with the space parameter.')
9
+ all: z.boolean().optional().describe('Show owned apps and collaborator access. Default: owned only'),
10
+ personal: z.boolean().optional().describe('List personal account apps only, ignoring default team'),
11
+ space: z.string().optional().describe('Filter by private space name. Excludes team param'),
12
+ team: z.string().optional().describe('Filter by team name. Excludes space param')
38
13
  });
39
14
  /**
40
- * Registers the list_apps tool with the MCP server.
41
- * This tool allows users to list Heroku applications with various filtering options
42
- * and output formats.
15
+ * Register list_apps tool
43
16
  *
44
- * @param server - The MCP server instance to register the tool with
45
- * @param herokuRepl - The Heroku REPL instance for executing commands
17
+ * @param server MCP server instance
18
+ * @param herokuRepl Heroku REPL instance
46
19
  */
47
20
  export const registerListAppsTool = (server, herokuRepl) => {
48
- server.tool('list_apps', 'List Heroku applications with flexible filtering options. Use this tool when you need to: ' +
49
- '1) Show all apps owned by the user, 2) Show apps where the user is a collaborator (use all=true), ' +
50
- '3) Filter apps by team or private space. Note: For checking app name availability, prefer using get_app_info ' +
51
- 'as it returns a more focused dataset. The response includes app names, regions, and ownership information.', listAppsOptionsSchema.shape, async (options) => {
21
+ server.tool('list_apps', 'List Heroku apps: owned, collaborator access, team/space filtering', listAppsOptionsSchema.shape, async (options) => {
52
22
  const command = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS)
53
23
  .addFlags({
54
24
  all: options.all,
55
- json: options.json,
56
25
  personal: options.personal,
57
26
  space: options.space,
58
27
  team: options.team
@@ -63,34 +32,20 @@ export const registerListAppsTool = (server, herokuRepl) => {
63
32
  });
64
33
  };
65
34
  /**
66
- * Schema for getting information about a Heroku application.
67
- * This schema defines the structure and validation rules for the get app info operation.
35
+ * Schema for app info retrieval
68
36
  */
69
37
  export const getAppInfoOptionsSchema = z.object({
70
- app: z
71
- .string()
72
- .describe('The name of the Heroku app to get information about. This must be an existing app that you have access to.'),
73
- json: z
74
- .boolean()
75
- .optional()
76
- .describe('Controls the output format. When true, returns a detailed JSON response containing app metadata such as ' +
77
- 'add-ons, dynos, buildpack configurations, collaborators, and domain information. When false or omitted, ' +
78
- 'returns a simplified text format.')
38
+ app: z.string().describe('Target app name. Requires access permissions'),
39
+ json: z.boolean().optional().describe('JSON output with full metadata. Default: text format')
79
40
  });
80
41
  /**
81
- * Registers the get_app_info tool with the MCP server.
82
- * This tool provides detailed information about a specific Heroku application,
83
- * including configuration, dynos, add-ons, and more.
42
+ * Register get_app_info tool
84
43
  *
85
- * @param server - The MCP server instance to register the tool with
86
- * @param herokuRepl - The Heroku REPL instance for executing commands
44
+ * @param server MCP server instance
45
+ * @param herokuRepl Heroku REPL instance
87
46
  */
88
47
  export const registerGetAppInfoTool = (server, herokuRepl) => {
89
- server.tool('get_app_info', 'Get comprehensive information about a Heroku application. Use this tool when you need to: ' +
90
- '1) View app configuration and settings, 2) Check dyno formation and scaling, ' +
91
- '3) List add-ons and buildpacks, 4) View collaborators and access details, ' +
92
- '5) Check domains and certificates. Accepts app name and optional JSON format. ' +
93
- 'Returns detailed app status and configuration.', getAppInfoOptionsSchema.shape, async (options) => {
48
+ server.tool('get_app_info', 'Get app details: config, dynos, addons, access, domains', getAppInfoOptionsSchema.shape, async (options) => {
94
49
  const command = new CommandBuilder(TOOL_COMMAND_MAP.GET_APP_INFO)
95
50
  .addFlags({
96
51
  app: options.app,
@@ -102,45 +57,22 @@ export const registerGetAppInfoTool = (server, herokuRepl) => {
102
57
  });
103
58
  };
104
59
  /**
105
- * Schema for creating a new Heroku application.
106
- * This schema defines the structure and validation rules for the create app operation.
60
+ * Schema for app creation
107
61
  */
108
62
  export const createAppOptionsSchema = z.object({
109
- app: z
110
- .string()
111
- .optional()
112
- .describe('Specifies the desired name for the new Heroku app. If omitted, Heroku will auto-generate a random name. ' +
113
- "Best practice: Provide a meaningful, unique name that reflects your application's purpose."),
114
- region: z
115
- .enum(['us', 'eu'])
116
- .optional()
117
- .describe('Determines the geographical region where your app will run. Options: "us" (United States) or "eu" (Europe). ' +
118
- 'Defaults to "us" if not specified. Note: Cannot be used with space parameter.'),
119
- space: z
120
- .string()
121
- .optional()
122
- .describe('Places the app in a specific private space, which provides enhanced security and networking features. ' +
123
- 'Specify the private space name. Note: When used, the app inherits the region from the private space and ' +
124
- 'the region parameter cannot be used.'),
125
- team: z
126
- .string()
127
- .optional()
128
- .describe('Associates the app with a specific team for collaborative development and management. Provide the team name ' +
129
- "to set ownership. The app will be created under the team's account rather than your personal account.")
63
+ app: z.string().optional().describe('App name. Auto-generated if omitted'),
64
+ region: z.enum(['us', 'eu']).optional().describe('Region: us/eu. Default: us. Excludes space param'),
65
+ space: z.string().optional().describe('Private space name. Inherits region. Excludes region param'),
66
+ team: z.string().optional().describe('Team name for ownership')
130
67
  });
131
68
  /**
132
- * Registers the create_app tool with the MCP server.
133
- * This tool enables creation of new Heroku applications with customizable settings
134
- * for region, team ownership, and private space placement.
69
+ * Register create_app tool
135
70
  *
136
- * @param server - The MCP server instance to register the tool with
137
- * @param herokuRepl - The Heroku REPL instance for executing commands
71
+ * @param server MCP server instance
72
+ * @param herokuRepl Heroku REPL instance
138
73
  */
139
74
  export const registerCreateAppTool = (server, herokuRepl) => {
140
- server.tool('create_app', 'Create a new Heroku application with customizable settings. Use this tool when a user wants to: ' +
141
- '1) Create a new app with a specific name, 2) Create an app in a particular region (US/EU), ' +
142
- '3) Create an app within a team, or 4) Create an app in a private space. ' +
143
- "The tool handles name generation if not specified and returns the new app's details.", createAppOptionsSchema.shape, async (options) => {
75
+ server.tool('create_app', 'Create app: custom name, region (US/EU), team, private space', createAppOptionsSchema.shape, async (options) => {
144
76
  const command = new CommandBuilder(TOOL_COMMAND_MAP.CREATE_APP)
145
77
  .addPositionalArguments({ app: options.app })
146
78
  .addFlags({
@@ -154,28 +86,20 @@ export const registerCreateAppTool = (server, herokuRepl) => {
154
86
  });
155
87
  };
156
88
  /**
157
- * Schema for renaming a Heroku application.
158
- * This schema defines the structure and validation rules for the rename app operation.
89
+ * Schema for app rename
159
90
  */
160
91
  export const renameAppOptionsSchema = z.object({
161
- app: z
162
- .string()
163
- .describe('The current name of the Heroku app you want to rename. This must be an existing app that you have access to.'),
164
- newName: z.string().describe('The new name you want to give to the app. Must be unique across all Heroku apps.')
92
+ app: z.string().describe('Current app name. Requires access'),
93
+ newName: z.string().describe('New unique app name')
165
94
  });
166
95
  /**
167
- * Registers the rename_app tool with the MCP server.
168
- * This tool allows renaming of existing Heroku applications while ensuring
169
- * name availability and access permissions.
96
+ * Register rename_app tool
170
97
  *
171
- * @param server - The MCP server instance to register the tool with
172
- * @param herokuRepl - The Heroku REPL instance for executing commands
98
+ * @param server MCP server instance
99
+ * @param herokuRepl Heroku REPL instance
173
100
  */
174
101
  export const registerRenameAppTool = (server, herokuRepl) => {
175
- server.tool('rename_app', 'Rename an existing Heroku application. Use this tool when a user needs to: ' +
176
- "1) Change an app's name, or 2) Resolve naming conflicts. " +
177
- 'Requires both current app name and desired new name. ' +
178
- 'The tool validates name availability and handles the rename process.', renameAppOptionsSchema.shape, async (options) => {
102
+ server.tool('rename_app', 'Rename app: validate and update app name', renameAppOptionsSchema.shape, async (options) => {
179
103
  const command = new CommandBuilder(TOOL_COMMAND_MAP.RENAME_APP)
180
104
  .addFlags({ app: options.app })
181
105
  .addPositionalArguments({ newName: options.newName })
@@ -185,33 +109,20 @@ export const registerRenameAppTool = (server, herokuRepl) => {
185
109
  });
186
110
  };
187
111
  /**
188
- * Schema for transferring ownership of a Heroku application.
189
- * This schema defines the structure and validation rules for the transfer app operation.
112
+ * Schema for app ownership transfer
190
113
  */
191
114
  export const transferAppOptionsSchema = z.object({
192
- app: z
193
- .string()
194
- .describe('The name of the Heroku app you want to transfer ownership of. You must be the current owner of this app or ' +
195
- 'a team admin to transfer it.'),
196
- recipient: z
197
- .string()
198
- .describe('The email address of the user or the name of the team who will receive ownership of the app. The recipient ' +
199
- 'must have a Heroku account.')
115
+ app: z.string().describe('App to transfer. Requires owner/admin access'),
116
+ recipient: z.string().describe('Target user email or team name')
200
117
  });
201
118
  /**
202
- * Registers the transfer_app tool with the MCP server.
203
- * This tool facilitates ownership transfer of Heroku applications between users
204
- * or to teams, with appropriate permission checks.
119
+ * Register transfer_app tool
205
120
  *
206
- * @param server - The MCP server instance to register the tool with
207
- * @param herokuRepl - The Heroku REPL instance for executing commands
121
+ * @param server MCP server instance
122
+ * @param herokuRepl Heroku REPL instance
208
123
  */
209
124
  export const registerTransferAppTool = (server, herokuRepl) => {
210
- server.tool('transfer_app', 'Transfer ownership of a Heroku application. Use this tool when a user wants to: ' +
211
- "1) Transfer an app to another user's account, 2) Move an app to a team, " +
212
- '3) Change app ownership for organizational purposes. ' +
213
- 'Requires the app name and recipient (email for users, name for teams). ' +
214
- 'The current user must be the app owner or a team admin to perform the transfer.', transferAppOptionsSchema.shape, async (options) => {
125
+ server.tool('transfer_app', 'Transfer app ownership to user/team', transferAppOptionsSchema.shape, async (options) => {
215
126
  const command = new CommandBuilder(TOOL_COMMAND_MAP.TRANSFER_APP)
216
127
  .addFlags({ app: options.app })
217
128
  .addPositionalArguments({ recipient: options.recipient })
@@ -220,4 +131,3 @@ export const registerTransferAppTool = (server, herokuRepl) => {
220
131
  return handleCliOutput(output);
221
132
  });
222
133
  };
223
- //# sourceMappingURL=apps.js.map
@@ -41,17 +41,7 @@ describe('apps topic tools', () => {
41
41
  content: [{ type: 'text', text: expectedOutput }]
42
42
  });
43
43
  });
44
- it('executes command successfully with json flag', async () => {
45
- const expectedOutput = '[{"name": "test-app", "team": {"name": "test-team"}, "space": {"name": "test-space"}}]';
46
- const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ json: true }).build();
47
- herokuRepl.executeCommand.resolves(expectedOutput);
48
- const result = await toolCallback({ json: true }, {});
49
- expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
50
- expect(result).to.deep.equal({
51
- content: [{ type: 'text', text: expectedOutput }]
52
- });
53
- });
54
- it('executes command successfully without json flag', async () => {
44
+ it('executes command successfully', async () => {
55
45
  const expectedOutput = '=== user@example.com Apps\n\n' + 'test-app';
56
46
  const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ json: false }).build();
57
47
  herokuRepl.executeCommand.resolves(expectedOutput);
@@ -330,4 +320,3 @@ describe('apps topic tools', () => {
330
320
  });
331
321
  });
332
322
  });
333
- //# sourceMappingURL=apps.spec.js.map
@@ -4,121 +4,111 @@ import { CommandBuilder } from '../utils/command-builder.js';
4
4
  import { TOOL_COMMAND_MAP } from '../utils/tool-commands.js';
5
5
  /**
6
6
  * Schema for executing PostgreSQL queries.
7
- * This schema defines the structure and validation rules for running SQL queries.
8
7
  */
9
8
  export const pgPsqlOptionsSchema = z.object({
10
- command: z
11
- .string()
12
- .optional()
13
- .describe('SQL command to run; file is ignored if provided; must be single line; must supply either command or file'),
14
- file: z
15
- .string()
16
- .optional()
17
- .describe('SQL file to run; command is ignored if provided; must be an absolute path; must supply either command or file'),
9
+ command: z.string().optional().describe('SQL command. Single line. Ignored if file provided'),
10
+ file: z.string().optional().describe('SQL file path. Ignored if command provided'),
18
11
  credential: z.string().optional().describe('credential to use'),
19
12
  app: z.string().describe('app to run command against'),
20
13
  database: z
21
14
  .string()
22
15
  .optional()
23
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
16
+ .describe('Database identifier: config var, name, ID, alias. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
24
17
  });
25
18
  /**
26
19
  * Schema for getting database information.
27
20
  */
28
21
  export const pgInfoOptionsSchema = z.object({
29
- app: z.string().describe('The name of the Heroku app whose database to inspect.'),
22
+ app: z.string().describe('Target app name'),
30
23
  database: z
31
24
  .string()
32
25
  .optional()
33
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, all databases are shown.")
26
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: all databases')
34
27
  });
35
28
  /**
36
29
  * Schema for viewing active queries.
37
30
  */
38
31
  export const pgPsOptionsSchema = z.object({
39
- app: z.string().describe('The name of the Heroku app whose database processes to view.'),
40
- verbose: z
41
- .boolean()
42
- .optional()
43
- .describe('When true, shows additional query details including query plan and memory usage.'),
32
+ app: z.string().describe('Target app name'),
33
+ verbose: z.boolean().optional().describe('Show query plan and memory usage'),
44
34
  database: z
45
35
  .string()
46
36
  .optional()
47
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
37
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
48
38
  });
49
39
  /**
50
40
  * Schema for viewing database locks.
51
41
  */
52
42
  export const pgLocksOptionsSchema = z.object({
53
- app: z.string().describe('The name of the Heroku app whose database locks to view.'),
54
- truncate: z.boolean().optional().describe('When true, truncates queries to 40 characters.'),
43
+ app: z.string().describe('Target app name'),
44
+ truncate: z.boolean().optional().describe('Truncate queries to 40 chars'),
55
45
  database: z
56
46
  .string()
57
47
  .optional()
58
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
48
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
59
49
  });
60
50
  /**
61
51
  * Schema for viewing query statistics.
62
52
  */
63
53
  export const pgOutliersOptionsSchema = z.object({
64
- app: z.string().describe('The name of the Heroku app whose query statistics to analyze.'),
65
- num: z.number().optional().describe('The number of queries to display. Defaults to 10.'),
66
- reset: z.boolean().optional().describe('When true, resets statistics gathered by pg_stat_statements.'),
67
- truncate: z.boolean().optional().describe('When true, truncates queries to 40 characters.'),
54
+ app: z.string().describe('Target app name'),
55
+ num: z.number().optional().describe('Number of queries to show. Default: 10'),
56
+ reset: z.boolean().optional().describe('Reset pg_stat_statements stats'),
57
+ truncate: z.boolean().optional().describe('Truncate queries to 40 chars'),
68
58
  database: z
69
59
  .string()
70
60
  .optional()
71
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
61
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
72
62
  });
73
63
  /**
74
64
  * Schema for viewing database credentials.
75
65
  */
76
66
  export const pgCredentialsOptionsSchema = z.object({
77
- app: z.string().describe('The name of the Heroku app whose database credentials to view.'),
67
+ app: z.string().describe('Target app name'),
78
68
  database: z
79
69
  .string()
80
70
  .optional()
81
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
71
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
82
72
  });
83
73
  /**
84
74
  * Schema for terminating database processes.
85
75
  */
86
76
  export const pgKillOptionsSchema = z.object({
87
- app: z.string().describe('The name of the Heroku app whose database process to terminate.'),
88
- pid: z.number().describe('The process ID to terminate, as shown by pg_ps.'),
89
- force: z.boolean().optional().describe('When true, forces immediate termination instead of graceful shutdown.'),
77
+ app: z.string().describe('Target app name'),
78
+ pid: z.number().describe('Process ID to terminate'),
79
+ force: z.boolean().optional().describe('Force immediate termination'),
90
80
  database: z
91
81
  .string()
92
82
  .optional()
93
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
83
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
94
84
  });
95
85
  /**
96
86
  * Schema for managing database maintenance.
97
87
  */
98
88
  export const pgMaintenanceOptionsSchema = z.object({
99
- app: z.string().describe('Show current maintenance information for the app.'),
89
+ app: z.string().describe('Target app name'),
100
90
  database: z
101
91
  .string()
102
92
  .optional()
103
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
93
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
104
94
  });
105
95
  /**
106
96
  * Schema for managing database backups.
107
97
  */
108
98
  export const pgBackupsOptionsSchema = z.object({
109
- app: z.string().describe('The name of the Heroku app whose backups to manage.')
99
+ app: z.string().describe('Target app name')
110
100
  });
111
101
  /**
112
102
  * Schema for upgrading database version.
113
103
  */
114
104
  export const pgUpgradeOptionsSchema = z.object({
115
- app: z.string().describe('The name of the Heroku app whose database to upgrade.'),
116
- version: z.string().optional().describe('PostgreSQL version to upgrade to'),
117
- confirm: z.string().optional().describe('Confirmation string required for this potentially destructive operation.'),
105
+ app: z.string().describe('Target app name'),
106
+ version: z.string().optional().describe('PostgreSQL version target'),
107
+ confirm: z.string().optional().describe('Confirmation for destructive operation'),
118
108
  database: z
119
109
  .string()
120
110
  .optional()
121
- .describe("Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.")
111
+ .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL')
122
112
  });
123
113
  /**
124
114
  * Registers the pg:psql tool with the MCP server.
@@ -127,10 +117,7 @@ export const pgUpgradeOptionsSchema = z.object({
127
117
  * @param herokuRepl - The Heroku REPL instance for executing commands
128
118
  */
129
119
  export const registerPgPsqlTool = (server, herokuRepl) => {
130
- server.tool('pg_psql', 'Execute SQL queries against Heroku PostgreSQL databases. Use this tool when you need to: ' +
131
- '1) Run SQL queries for database analysis, 2) Investigate database locks and performance, ' +
132
- '3) Make schema modifications or updates, 4) Execute complex database operations. ' +
133
- 'The tool provides direct SQL access with support for file-based queries and credential management.', pgPsqlOptionsSchema.shape, async (options) => {
120
+ server.tool('pg_psql', 'Execute SQL queries: analyze, debug, modify schema, manage data', pgPsqlOptionsSchema.shape, async (options) => {
134
121
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_PSQL)
135
122
  .addFlags({
136
123
  app: options.app,
@@ -151,10 +138,7 @@ export const registerPgPsqlTool = (server, herokuRepl) => {
151
138
  * @param herokuRepl - The Heroku REPL instance for executing commands
152
139
  */
153
140
  export const registerPgInfoTool = (server, herokuRepl) => {
154
- server.tool('pg_info', 'Display detailed information about Heroku PostgreSQL databases. Use this tool when you need to: ' +
155
- '1) View comprehensive database configuration and status, 2) Monitor database performance metrics, ' +
156
- '3) Check connection and resource utilization, 4) Assess database health and capacity. ' +
157
- 'The tool provides detailed insights into database operations and configuration.', pgInfoOptionsSchema.shape, async (options) => {
141
+ server.tool('pg_info', 'View database status: config, metrics, resources, health', pgInfoOptionsSchema.shape, async (options) => {
158
142
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_INFO)
159
143
  .addFlags({
160
144
  app: options.app
@@ -172,10 +156,7 @@ export const registerPgInfoTool = (server, herokuRepl) => {
172
156
  * @param herokuRepl - The Heroku REPL instance for executing commands
173
157
  */
174
158
  export const registerPgPsTool = (server, herokuRepl) => {
175
- server.tool('pg_ps', 'Monitor active database queries and processes. Use this tool when you need to: ' +
176
- '1) View currently executing queries, 2) Track query progress and resource usage, ' +
177
- '3) Identify long-running or blocked queries, 4) Debug performance issues in real-time. ' +
178
- 'The tool provides detailed visibility into database activity with optional verbose output.', pgPsOptionsSchema.shape, async (options) => {
159
+ server.tool('pg_ps', 'Monitor active queries: progress, resources, performance', pgPsOptionsSchema.shape, async (options) => {
179
160
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_PS)
180
161
  .addFlags({
181
162
  app: options.app,
@@ -194,10 +175,7 @@ export const registerPgPsTool = (server, herokuRepl) => {
194
175
  * @param herokuRepl - The Heroku REPL instance for executing commands
195
176
  */
196
177
  export const registerPgLocksTool = (server, herokuRepl) => {
197
- server.tool('pg_locks', 'Analyze database locks and blocking transactions. Use this tool when you need to: ' +
198
- '1) Identify blocked queries and lock chains, 2) Investigate deadlock situations, ' +
199
- '3) Monitor transaction lock states, 4) Resolve blocking issues affecting performance. ' +
200
- 'The tool helps diagnose and resolve database concurrency problems.', pgLocksOptionsSchema.shape, async (options) => {
178
+ server.tool('pg_locks', 'Analyze locks: blocked queries, deadlocks, concurrency', pgLocksOptionsSchema.shape, async (options) => {
201
179
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_LOCKS)
202
180
  .addFlags({
203
181
  app: options.app,
@@ -216,10 +194,7 @@ export const registerPgLocksTool = (server, herokuRepl) => {
216
194
  * @param herokuRepl - The Heroku REPL instance for executing commands
217
195
  */
218
196
  export const registerPgOutliersTool = (server, herokuRepl) => {
219
- server.tool('pg_outliers', 'Identify resource-intensive database operations. Use this tool when you need to: ' +
220
- '1) Find slow or expensive queries, 2) Analyze query performance patterns, ' +
221
- '3) Optimize database workload, 4) Track query statistics over time. ' +
222
- 'The tool helps identify opportunities for performance optimization.', pgOutliersOptionsSchema.shape, async (options) => {
197
+ server.tool('pg_outliers', 'Find resource-heavy queries: performance, patterns, optimization', pgOutliersOptionsSchema.shape, async (options) => {
223
198
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_OUTLIERS)
224
199
  .addFlags({
225
200
  app: options.app,
@@ -240,10 +215,7 @@ export const registerPgOutliersTool = (server, herokuRepl) => {
240
215
  * @param herokuRepl - The Heroku REPL instance for executing commands
241
216
  */
242
217
  export const registerPgCredentialsTool = (server, herokuRepl) => {
243
- server.tool('pg_credentials', 'Manage database access credentials and security. Use this tool when you need to: ' +
244
- '1) View current database credentials, 2) Configure database access permissions, ' +
245
- '3) Rotate credentials for security compliance, 4) Set up monitoring access. ' +
246
- 'The tool helps maintain secure database access and credential management.', pgCredentialsOptionsSchema.shape, async (options) => {
218
+ server.tool('pg_credentials', 'Manage access: credentials, permissions, security, monitoring', pgCredentialsOptionsSchema.shape, async (options) => {
247
219
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_CREDENTIALS)
248
220
  .addFlags({
249
221
  app: options.app
@@ -261,10 +233,7 @@ export const registerPgCredentialsTool = (server, herokuRepl) => {
261
233
  * @param herokuRepl - The Heroku REPL instance for executing commands
262
234
  */
263
235
  export const registerPgKillTool = (server, herokuRepl) => {
264
- server.tool('pg_kill', 'Terminate specific database processes. Use this tool when you need to: ' +
265
- '1) Stop problematic or stuck queries, 2) Clear blocking transactions, ' +
266
- '3) Manage resource-intensive operations, 4) Handle runaway processes safely. ' +
267
- 'The tool provides controlled process termination with optional force mode.', pgKillOptionsSchema.shape, async (options) => {
236
+ server.tool('pg_kill', 'Stop processes: stuck queries, blocking transactions, runaway operations', pgKillOptionsSchema.shape, async (options) => {
268
237
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_KILL)
269
238
  .addFlags({
270
239
  app: options.app,
@@ -286,10 +255,7 @@ export const registerPgKillTool = (server, herokuRepl) => {
286
255
  * @param herokuRepl - The Heroku REPL instance for executing commands
287
256
  */
288
257
  export const registerPgMaintenanceTool = (server, herokuRepl) => {
289
- server.tool('pg_maintenance', 'Monitor database maintenance status and operations. Use this tool when you need to: ' +
290
- '1) Check current maintenance windows, 2) View scheduled maintenance activities, ' +
291
- '3) Track maintenance operation progress, 4) Plan database maintenance tasks. ' +
292
- 'The tool provides visibility into database maintenance state and scheduling.', pgMaintenanceOptionsSchema.shape, async (options) => {
258
+ server.tool('pg_maintenance', 'Track maintenance: windows, schedules, progress, planning', pgMaintenanceOptionsSchema.shape, async (options) => {
293
259
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_MAINTENANCE)
294
260
  .addFlags({
295
261
  app: options.app
@@ -307,10 +273,7 @@ export const registerPgMaintenanceTool = (server, herokuRepl) => {
307
273
  * @param herokuRepl - The Heroku REPL instance for executing commands
308
274
  */
309
275
  export const registerPgBackupsTool = (server, herokuRepl) => {
310
- server.tool('pg_backups', 'Manage database backup operations and schedules. Use this tool when you need to: ' +
311
- '1) View existing database backups, 2) Monitor backup schedules and status, ' +
312
- '3) Track backup operation progress, 4) Verify backup availability. ' +
313
- 'The tool helps maintain database backup operations and disaster recovery readiness.', pgBackupsOptionsSchema.shape, async (options) => {
276
+ server.tool('pg_backups', 'Manage backups: schedules, status, verification, recovery', pgBackupsOptionsSchema.shape, async (options) => {
314
277
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_BACKUPS)
315
278
  .addFlags({
316
279
  app: options.app
@@ -327,10 +290,7 @@ export const registerPgBackupsTool = (server, herokuRepl) => {
327
290
  * @param herokuRepl - The Heroku REPL instance for executing commands
328
291
  */
329
292
  export const registerPgUpgradeTool = (server, herokuRepl) => {
330
- server.tool('pg_upgrade', 'Upgrade PostgreSQL database version. Use this tool when you need to: ' +
331
- '1) Migrate to a newer PostgreSQL version, 2) Plan version upgrade paths, ' +
332
- '3) Execute controlled version migrations, 4) Verify upgrade compatibility. ' +
333
- 'The tool manages safe database version upgrades with confirmation protection.', pgUpgradeOptionsSchema.shape, async (options) => {
293
+ server.tool('pg_upgrade', 'Upgrade PostgreSQL: version migration, compatibility, safety', pgUpgradeOptionsSchema.shape, async (options) => {
334
294
  const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_UPGRADE)
335
295
  .addFlags({
336
296
  app: options.app,
@@ -343,4 +303,3 @@ export const registerPgUpgradeTool = (server, herokuRepl) => {
343
303
  return handleCliOutput(output);
344
304
  });
345
305
  };
346
- //# sourceMappingURL=data.js.map
@@ -298,4 +298,3 @@ describe('PostgreSQL Tools', () => {
298
298
  });
299
299
  });
300
300
  });
301
- //# sourceMappingURL=data.spec.js.map