Skip to main content
Glama

terminate_workflow

Stop a workflow execution and mark it as terminated in the Conductor workflow engine. Provide the workflow ID and optional reason for termination.

Instructions

Terminate a workflow execution. This will stop the workflow and mark it as terminated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowIdYesThe workflow execution ID to terminate
reasonNoReason for termination

Implementation Reference

  • The handler implementation for the 'terminate_workflow' tool. It extracts workflowId and optional reason from arguments, sends a DELETE request to the Conductor API to terminate the workflow, and returns a success message.
    case "terminate_workflow": {
      const { workflowId, reason = "Terminated via MCP" } = args as any;
      await conductorClient.delete(`/workflow/${workflowId}`, {
        params: { reason },
      });
      
      return {
        content: [
          {
            type: "text",
            text: `Workflow ${workflowId} terminated successfully. Reason: ${reason}`,
          },
        ],
      };
    }
  • The input schema definition for the 'terminate_workflow' tool, specifying required workflowId and optional reason parameters.
      name: "terminate_workflow",
      description:
        "Terminate a workflow execution. This will stop the workflow and mark it as terminated.",
      inputSchema: {
        type: "object",
        properties: {
          workflowId: {
            type: "string",
            description: "The workflow execution ID to terminate",
          },
          reason: {
            type: "string",
            description: "Reason for termination",
          },
        },
        required: ["workflowId"],
      },
    },
  • src/index.ts:308-580 (registration)
    The 'terminate_workflow' tool is registered in the static tools array used by the ListToolsRequestHandler.
        name: "terminate_workflow",
        description:
          "Terminate a workflow execution. This will stop the workflow and mark it as terminated.",
        inputSchema: {
          type: "object",
          properties: {
            workflowId: {
              type: "string",
              description: "The workflow execution ID to terminate",
            },
            reason: {
              type: "string",
              description: "Reason for termination",
            },
          },
          required: ["workflowId"],
        },
      },
      {
        name: "restart_workflow",
        description:
          "Restart a workflow execution from the beginning. This creates a new execution with the same input.",
        inputSchema: {
          type: "object",
          properties: {
            workflowId: {
              type: "string",
              description: "The workflow execution ID to restart",
            },
            useLatestDefinition: {
              type: "boolean",
              description: "Use the latest workflow definition (default: false)",
            },
          },
          required: ["workflowId"],
        },
      },
      {
        name: "retry_workflow",
        description:
          "Retry a failed workflow execution from the last failed task.",
        inputSchema: {
          type: "object",
          properties: {
            workflowId: {
              type: "string",
              description: "The workflow execution ID to retry",
            },
            resumeSubworkflowTasks: {
              type: "boolean",
              description: "Resume subworkflow tasks (default: false)",
            },
          },
          required: ["workflowId"],
        },
      },
      {
        name: "search_workflows",
        description:
          "Advanced search for workflow executions using query syntax. Supports complex queries with multiple criteria.",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "string",
              description: "Query string (e.g., 'workflowType=MyWorkflow AND status=FAILED')",
            },
            start: {
              type: "number",
              description: "Start index for pagination (default: 0)",
            },
            size: {
              type: "number",
              description: "Number of results to return (default: 100)",
            },
            sort: {
              type: "string",
              description: "Sort field and order (e.g., 'startTime:DESC')",
            },
          },
          required: ["query"],
        },
      },
      {
        name: "get_workflow_definition",
        description:
          "Get the definition of a workflow by name and version. Returns the complete workflow definition including all tasks and configuration.",
        inputSchema: {
          type: "object",
          properties: {
            workflowName: {
              type: "string",
              description: "Name of the workflow",
            },
            version: {
              type: "number",
              description: "Version of the workflow (optional, defaults to latest)",
            },
          },
          required: ["workflowName"],
        },
      },
      {
        name: "list_workflow_definitions",
        description:
          "List all registered workflow definitions. Returns metadata about all workflows registered in Conductor.",
        inputSchema: {
          type: "object",
          properties: {
            access: {
              type: "string",
              description: "Filter by access type (READ or CREATE)",
              enum: ["READ", "CREATE"],
            },
            tagKey: {
              type: "string",
              description: "Filter by tag key",
            },
            tagValue: {
              type: "string",
              description: "Filter by tag value",
            },
          },
        },
      },
      {
        name: "create_workflow_definition",
        description:
          "Create or update a workflow definition. If the workflow already exists, it will be updated.",
        inputSchema: {
          type: "object",
          properties: {
            definition: {
              type: "object",
              description: "Complete workflow definition as a JSON object",
            },
            overwrite: {
              type: "boolean",
              description: "Overwrite existing definition (default: true)",
            },
          },
          required: ["definition"],
        },
      },
      {
        name: "get_task_details",
        description:
          "Get details of a specific task execution by task ID. Returns task status, input/output, and execution details.",
        inputSchema: {
          type: "object",
          properties: {
            taskId: {
              type: "string",
              description: "The unique task execution ID",
            },
          },
          required: ["taskId"],
        },
      },
      {
        name: "get_task_logs",
        description:
          "Get execution logs for a specific task. Returns log entries generated during task execution.",
        inputSchema: {
          type: "object",
          properties: {
            taskId: {
              type: "string",
              description: "The unique task execution ID",
            },
          },
          required: ["taskId"],
        },
      },
      {
        name: "update_task_status",
        description:
          "Update the status of a task execution. This is typically used by workers to update task status.",
        inputSchema: {
          type: "object",
          properties: {
            taskId: {
              type: "string",
              description: "The unique task execution ID",
            },
            workflowInstanceId: {
              type: "string",
              description: "The workflow instance ID",
            },
            status: {
              type: "string",
              description: "New task status",
              enum: ["IN_PROGRESS", "FAILED", "FAILED_WITH_TERMINAL_ERROR", "COMPLETED"],
            },
            output: {
              type: "object",
              description: "Task output data",
            },
            logs: {
              type: "array",
              description: "Task execution logs",
              items: {
                type: "object",
              },
            },
          },
          required: ["taskId", "workflowInstanceId", "status"],
        },
      },
      {
        name: "get_task_definition",
        description:
          "Get the definition of a task by name. Returns the task definition including configuration and metadata.",
        inputSchema: {
          type: "object",
          properties: {
            taskName: {
              type: "string",
              description: "Name of the task",
            },
          },
          required: ["taskName"],
        },
      },
      {
        name: "list_task_definitions",
        description:
          "List all registered task definitions. Returns metadata about all tasks registered in Conductor.",
        inputSchema: {
          type: "object",
          properties: {
            access: {
              type: "string",
              description: "Filter by access type (READ or CREATE)",
              enum: ["READ", "CREATE"],
            },
          },
        },
      },
      {
        name: "create_task_definition",
        description:
          "Create or update a task definition. If the task already exists, it will be updated.",
        inputSchema: {
          type: "object",
          properties: {
            definition: {
              type: "object",
              description: "Complete task definition as a JSON object",
            },
          },
          required: ["definition"],
        },
      },
      {
        name: "get_event_handlers",
        description:
          "Get all event handlers or filter by event and active status. Event handlers define how Conductor responds to external events.",
        inputSchema: {
          type: "object",
          properties: {
            event: {
              type: "string",
              description: "Filter by event name",
            },
            activeOnly: {
              type: "boolean",
              description: "Return only active event handlers (default: true)",
            },
          },
        },
      },
    ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/opensensor/conductor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server