startJob
Initiate an RPA job by specifying a robot UUID, optional account or group, timeout settings, and parameters for automated execution.
Instructions
该接口用于启动RPA应用JOB。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| robotUuid | Yes | RPA应用uuid,必填 | |
| accountName | No | RPA机器人账号名称,要求机器人的状态为idle,和robotClientGroupUuid互斥,二选一即可 | |
| robotClientGroupUuid | No | RPA机器人组uuid,和accountName互斥,二选一即可 | |
| waitTimeoutSeconds | No | 等待超时时间(秒) | |
| runTimeout | No | 运行超时时间(秒) | |
| params | No | 运行参数 |
Implementation Reference
- src/baseServer.ts:102-121 (handler)The MCP tool handler for 'startJob'. It registers the tool with the MCP server, transforms the 'params' object from Record<string,any> into an array of {name, value, type} objects, and delegates to this.openApiService?.startJob().
this.server.tool('startJob', i18n.t('tool.startJob.description'), startJobSchema, async ({ robotUuid, accountName,params }) => { try { // Transform params from Record<string, any> to the expected array format const transformedParams = params ? Object.entries(params).map(([name, value]) => ({ name, value: String(value), // Convert value to string type: 'string' // Default type as string })) : undefined; const result = await this.openApiService?.startJob({ robotUuid, accountName, params: transformedParams }); return { content: [{ type: 'text', text: JSON.stringify(result) }]}; } catch (error) { console.error(error); throw new Error(i18n.t('tool.startJob.error')); } }); - src/schema/openApi.ts:60-72 (schema)Input schema for the startJob tool using Zod validation. Defines robotUuid (required string), accountName, robotClientGroupUuid, waitTimeoutSeconds, runTimeout, and params (optional record of any).
export const startJobSchema = { robotUuid: z.string().describe(i18n.t('schema.startJob.robotUuid')), accountName: z.string().optional().describe(i18n.t('schema.startJob.accountName')), robotClientGroupUuid: z.string().optional().describe(i18n.t('schema.startJob.robotClientGroupUuid')), waitTimeoutSeconds: z.number() .optional() .describe(i18n.t('schema.startJob.waitTimeoutSeconds')), runTimeout: z.number() .optional() .describe(i18n.t('schema.startJob.runTimeout')), params: z.record(z.any()).optional() .describe(i18n.t('schema.startJob.params')) } as const; - src/baseServer.ts:5-5 (registration)Import of the startJobSchema from schema/openApi.ts. The actual registration is on line 102 via this.server.tool('startJob', ...) which binds the schema and handler.
import { querySchema, robotParamSchema, uploadFileSchema, startJobSchema, queryJobSchema, clientListSchema } from './schema/openApi.js'; - src/yingdao/openApiService.ts:95-110 (helper)The OpenApiService.startJob() method that makes the actual HTTP POST request to '/dispatch/v2/job/start'. Validates robotUuid is present, calls the API, and handles errors.
async startJob(params: JobStartRequest): Promise<JobStartResponse> { // Validate required parameters if (!params.robotUuid) { throw new Error(i18n.t('rpaService.error.robotUuidRequired')); } try { const response = await this.client.post<JobStartResponse>('/dispatch/v2/job/start', params); console.log("response",response.data); if (!response.data.success || response.data.code !== 200) { throw new Error(response.data.msg || i18n.t('rpaService.error.startJobFailed')); } return response.data; } catch (error: any) { throw new Error(`${i18n.t('rpaService.error.startJobFailed')}: ${error.message}`); } } - src/types/yingdao.d.ts:44-59 (schema)TypeScript interface for JobStartRequest, defining the shape of parameters sent to the startJob API endpoint, including robotUuid, accountName, robotClientGroupUuid, waitTimeout, runTimeout, and params array.
interface JobStartRequest { accountName?: string; robotClientGroupUuid?: string; robotUuid: string; idempotentUuid?: string; waitTimeout?: string; waitTimeoutSeconds?: number; runTimeout?: number; priority?: string; executeScope?: string; params?: Array<{ name: string; value: string; type: string; }>; }