Get workflow execution status
workflow_statusRetrieve the current status and result of a workflow execution, polling until completion if needed.
Instructions
Get the current state and result of a workflow execution.
Statuses: RUNNING | COMPLETED | FAILED | CANCELED | TERMINATED | CONTINUED_AS_NEW | TIMED_OUT | RETRYING_AFTER_ERROR
Poll until status is COMPLETED (or terminal) when waitForResult was false.
result is populated once the workflow reaches a terminal state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| executionId | Yes | Execution ID from workflow_execute. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_name | Yes | ||
| execution_id | Yes | ||
| root_execution_id | Yes | ||
| status | Yes | ||
| result | No | ||
| start_time | Yes | ||
| end_time | Yes | ||
| total_duration_ms | No |
Implementation Reference
- src/tools-workflows.ts:209-239 (handler)The async handler function for the workflow_status tool. Calls mistral.workflows.executions.getWorkflowExecution with the executionId, then returns a structured response with workflow_name, execution_id, status, result, and timing info.
async (input) => { try { const res = await mistral.workflows.executions.getWorkflowExecution({ executionId: input.executionId, }); const structured = { workflow_name: res.workflowName, execution_id: res.executionId, root_execution_id: res.rootExecutionId, status: res.status, result: res.result, start_time: res.startTime instanceof Date ? res.startTime.toISOString() : String(res.startTime), end_time: res.endTime instanceof Date ? res.endTime.toISOString() : res.endTime ? String(res.endTime) : null, total_duration_ms: res.totalDurationMs ?? null, }; return { content: [toTextBlock(`${res.workflowName} [${res.executionId}] — ${res.status ?? "UNKNOWN"}.`)], structuredContent: structured, }; } catch (err) { return errorResult("workflow_status", err); } } - src/tools-workflows.ts:35-45 (schema)WorkflowStatusOutputShape and WorkflowStatusOutputSchema defining the output fields: workflow_name, execution_id, root_execution_id, status, result, start_time, end_time, total_duration_ms.
export const WorkflowStatusOutputShape = { workflow_name: z.string(), execution_id: z.string(), root_execution_id: z.string(), status: z.string().nullable(), result: z.unknown().nullable(), start_time: z.string(), end_time: z.string().nullable(), total_duration_ms: z.number().nullable().optional(), }; export const WorkflowStatusOutputSchema = z.object(WorkflowStatusOutputShape); - src/tools-workflows.ts:183-240 (registration)Registration of the 'workflow_status' tool via server.registerTool with title, description, inputSchema (executionId), outputSchema (WorkflowStatusOutputShape), annotations, and the async handler.
// ========== workflow_status ========== server.registerTool( "workflow_status", { title: "Get workflow execution status", description: [ "Get the current state and result of a workflow execution.", "", "Statuses: RUNNING | COMPLETED | FAILED | CANCELED | TERMINATED |", " CONTINUED_AS_NEW | TIMED_OUT | RETRYING_AFTER_ERROR", "", "Poll until status is COMPLETED (or terminal) when waitForResult was false.", "`result` is populated once the workflow reaches a terminal state.", ].join("\n"), inputSchema: { executionId: z.string().min(1).describe("Execution ID from workflow_execute."), }, outputSchema: WorkflowStatusOutputShape, annotations: { title: "Workflow execution status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async (input) => { try { const res = await mistral.workflows.executions.getWorkflowExecution({ executionId: input.executionId, }); const structured = { workflow_name: res.workflowName, execution_id: res.executionId, root_execution_id: res.rootExecutionId, status: res.status, result: res.result, start_time: res.startTime instanceof Date ? res.startTime.toISOString() : String(res.startTime), end_time: res.endTime instanceof Date ? res.endTime.toISOString() : res.endTime ? String(res.endTime) : null, total_duration_ms: res.totalDurationMs ?? null, }; return { content: [toTextBlock(`${res.workflowName} [${res.executionId}] — ${res.status ?? "UNKNOWN"}.`)], structuredContent: structured, }; } catch (err) { return errorResult("workflow_status", err); } } ); - src/index.ts:59-83 (registration)The registerWorkflowTools function is called in index.ts to register all workflow tools (including workflow_status) on the MCP server.
const server = new McpServer({ name: "mistral-mcp", version: "0.7.1", }); registerMistralTools(server, mistral, profile); registerFunctionTools(server, mistral, profile); if (profile !== "workflows") { // core, admin and metier-docs all get vision/OCR tools registerVisionTools(server, mistral); } registerAudioTools(server, mistral, profile); if (profile === "admin") { registerAgentTools(server, mistral); registerFileTools(server, mistral); registerBatchTools(server, mistral); registerSamplingTools(server); } // workflow tools are present in every profile registerWorkflowTools(server, mistral); - src/shared.ts:90-95 (helper)Helper functions toTextBlock and errorResult used by the workflow_status handler for formatting response content and error results.
export function toTextBlock(payload: unknown) { return { type: "text" as const, text: typeof payload === "string" ? payload : JSON.stringify(payload), }; }