list_backup_jobs
Retrieve recent AWS backup jobs with optional filtering by state and time window to monitor backup operations and identify issues.
Instructions
Lists recent backup jobs, optionally filtering by state (default: FAILED).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | Filter by job state (e.g., COMPLETED, FAILED, RUNNING). Default: FAILED. | |
| hours | No | Look back window in hours (default: 24). |
Implementation Reference
- src/index.ts:1274-1297 (handler)Executes the list_backup_jobs tool by calling AWS BackupClient.ListBackupJobsCommand with optional filters for state and time window, formats and returns the job list.if (name === "list_backup_jobs") { const state = (args as any)?.state || "FAILED"; const hours = (args as any)?.hours || 24; const sinceDate = new Date(Date.now() - hours * 60 * 60 * 1000); const command = new ListBackupJobsCommand({ ByState: state, ByCreatedAfter: sinceDate }); const response = await backupClient.send(command); const jobs = response.BackupJobs?.map(j => ({ BackupJobId: j.BackupJobId, State: j.State, CreationDate: j.CreationDate, BackupVaultName: j.BackupVaultName, ResourceArn: j.ResourceArn, StatusMessage: j.StatusMessage })) || []; return { content: [{ type: "text", text: JSON.stringify(jobs, null, 2) }] }; }
- src/index.ts:400-416 (schema)Input schema definition for the list_backup_jobs tool, including optional state and hours parameters.{ name: "list_backup_jobs", description: "Lists recent backup jobs, optionally filtering by state (default: FAILED).", inputSchema: { type: "object", properties: { state: { type: "string", description: "Filter by job state (e.g., COMPLETED, FAILED, RUNNING). Default: FAILED." }, hours: { type: "number", description: "Look back window in hours (default: 24)." } } } },
- src/index.ts:400-416 (registration)Tool registration in the ListTools response, defining name, description, and input schema.{ name: "list_backup_jobs", description: "Lists recent backup jobs, optionally filtering by state (default: FAILED).", inputSchema: { type: "object", properties: { state: { type: "string", description: "Filter by job state (e.g., COMPLETED, FAILED, RUNNING). Default: FAILED." }, hours: { type: "number", description: "Look back window in hours (default: 24)." } } } },
- src/index.ts:65-65 (helper)Initialization of the AWS BackupClient used by the list_backup_jobs handler.const backupClient = new BackupClient({});
- src/index.ts:31-31 (helper)Import of BackupClient and ListBackupJobsCommand required for the tool implementation.import { BackupClient, ListBackupJobsCommand } from "@aws-sdk/client-backup";