task_retry
Retry a failed or crashed task in the SFTP Orchestrator by providing its task ID to resume execution.
Instructions
Relance une tâche qui a échoué ou crashé.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | L'ID de la tâche à réessayer. |
Implementation Reference
- server.js:658-680 (handler)The handler function for the 'task_retry' tool. It retrieves the failed job using queue.retryJob, creates a new job, re-executes it based on its type (sftp, ssh, or ssh_sequence) by calling the appropriate execute method, and returns success or error response.async (params) => { try { const newJob = await queue.retryJob(params.id); // Relancer selon le type if (newJob.type === 'sftp') { sftp.executeTransfer(newJob.id); } else if (newJob.type === 'ssh') { ssh.executeCommand(newJob.id); } else if (newJob.type === 'ssh_sequence') { ssh.executeCommandSequence(newJob.id); } return { content: [{ type: "text", text: `Tâche ${params.id} relancée avec le nouvel ID: ${newJob.id}` }] }; } catch (e) { const errorPayload = { toolName: "task_retry", errorCode: "TOOL_EXECUTION_ERROR", errorMessage: e.message }; return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true }; } }
- server.js:651-656 (schema)The schema definition for the 'task_retry' tool, specifying the input as an object with a required 'id' string parameter.{ title: "Réessayer une tâche échouée", description: "Relance une tâche qui a échoué ou crashé.", inputSchema: z.object({ id: z.string().describe("L'ID de la tâche à réessayer.") })
- server.js:649-681 (registration)The registration of the 'task_retry' tool using server.registerTool, including the tool name, schema, and inline handler function.server.registerTool( "task_retry", { title: "Réessayer une tâche échouée", description: "Relance une tâche qui a échoué ou crashé.", inputSchema: z.object({ id: z.string().describe("L'ID de la tâche à réessayer.") }) }, async (params) => { try { const newJob = await queue.retryJob(params.id); // Relancer selon le type if (newJob.type === 'sftp') { sftp.executeTransfer(newJob.id); } else if (newJob.type === 'ssh') { ssh.executeCommand(newJob.id); } else if (newJob.type === 'ssh_sequence') { ssh.executeCommandSequence(newJob.id); } return { content: [{ type: "text", text: `Tâche ${params.id} relancée avec le nouvel ID: ${newJob.id}` }] }; } catch (e) { const errorPayload = { toolName: "task_retry", errorCode: "TOOL_EXECUTION_ERROR", errorMessage: e.message }; return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true }; } } );