list_async_jobs
Track and filter asynchronous jobs in the CloudStack MCP Server by status or keyword to monitor pending, successful, or failed tasks for efficient cloud resource management.
Instructions
List asynchronous jobs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobstatus | No | Job status (0=pending, 1=success, 2=error) | |
| keyword | No | Keyword to search jobs |
Implementation Reference
- Executes the tool logic: calls CloudStack API, processes async jobs response, maps fields, and returns formatted text list.async handleListAsyncJobs(args: any) { const result = await this.cloudStackClient.listAsyncJobs(args); const jobs = result.listasyncjobsresponse?.asyncjobs || []; const jobList = jobs.map((job: any) => ({ jobid: job.jobid, cmd: job.cmd, jobstatus: job.jobstatus, created: job.created, userid: job.userid, instancetype: job.jobinstancetype, instanceid: job.jobinstanceid })); return { content: [ { type: 'text', text: `Found ${jobList.length} async jobs:\n\n${jobList .map((job: any) => `• Job ID: ${job.jobid}\n Command: ${job.cmd}\n Status: ${job.jobstatus}\n Created: ${job.created}\n Instance: ${job.instancetype} (${job.instanceid})\n` ) .join('\n')}` } ] }; }
- Tool definition with name, description, and input schema (jobstatus, keyword).{ name: 'list_async_jobs', description: 'List asynchronous jobs', inputSchema: { type: 'object', properties: { jobstatus: { type: 'number', description: 'Job status (0=pending, 1=success, 2=error)', }, keyword: { type: 'string', description: 'Keyword to search jobs', }, }, additionalProperties: false, }, },
- src/server.ts:172-173 (registration)Dispatches the tool call to the monitoring handler in the MCP server switch statement.case 'list_async_jobs': return await this.monitoringHandlers.handleListAsyncJobs(args);
- src/cloudstack-client.ts:234-236 (helper)CloudStack client method that makes the underlying API request for listing async jobs.async listAsyncJobs(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listAsyncJobs', params); }