pg_maintenance
Monitor, schedule, and track database maintenance tasks. Check status, view activities, and plan operations for Heroku MCP server-managed databases.
Instructions
Monitor database maintenance status and operations. Use this tool when you need to: 1) Check current maintenance windows, 2) View scheduled maintenance activities, 3) Track maintenance operation progress, 4) Plan database maintenance tasks. The tool provides visibility into database maintenance state and scheduling.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Show current maintenance information for the app. | |
| database | No | 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. |
Implementation Reference
- src/tools/data.ts:348-358 (handler)The handler function for the 'pg_maintenance' tool. It constructs a CommandBuilder for 'pg:maintenance', adds app flag and database positional arg, executes via herokuRepl, and returns handled CLI output.async (options: PgMaintenanceOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_MAINTENANCE) .addFlags({ app: options.app }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); }
- src/tools/data.ts:116-122 (schema)Zod schema defining input parameters for the pg_maintenance tool: required 'app' and optional 'database'.export const pgMaintenanceOptionsSchema = z.object({ app: z.string().describe('Target app name'), database: z .string() .optional() .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL') });
- src/tools/data.ts:343-360 (registration)Function that registers the 'pg_maintenance' tool on the MCP server, including name, description, schema, and handler.export const registerPgMaintenanceTool = (server: McpServer, herokuRepl: HerokuREPL): void => { server.tool( 'pg_maintenance', 'Track maintenance: windows, schedules, progress, planning', pgMaintenanceOptionsSchema.shape, async (options: PgMaintenanceOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_MAINTENANCE) .addFlags({ app: options.app }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); } ); };
- src/index.ts:83-83 (registration)Invocation of the registerPgMaintenanceTool function during server initialization.data.registerPgMaintenanceTool(server, herokuRepl);
- src/utils/tool-commands.ts:38-38 (helper)Constant mapping for the PG_MAINTENANCE command string used in the handler's CommandBuilder.PG_MAINTENANCE: 'pg:maintenance',