# Relay Workflow Automation MCP

> Relay Workflow Automation connects your AI client directly to a no-code process platform, letting you programmatically manage business workflows. Use this server to list available automations via `list_workflows`, trigger complex processes with custom inputs using `run_workflow`, and monitor the run status or history through tools like `get_run_status` and `list_runs`. You're managing entire operational pipelines—not just data points.

## Overview
- **Category:** growth-engine
- **Price:** Free
- **Tags:** workflow-automation, no-code, api-integration, task-scheduling, process-optimization, event-driven

## Description

You're connecting your AI client straight into Relay's no-code process platform. This MCP Server lets you treat entire business operations as if they were a function call—you manage the full lifecycle of complex automations, not just simple data points. You gotta run whole pipelines here. 

**Discovering What’s Available**

To see what's running in your account, use `list_workflows`. This tool dumps every single automation workflow configured in Relay. It gives you a list of all the available processes, so you know exactly which ones you can trigger or check on. If you need more details about one specific process—like its input requirements or internal logic—you run `get_workflow` and pass it the unique workflow ID to retrieve that detailed metadata.

**Kicking Off a Workflow Run**

The core action here is triggering a job. You use `run_workflow` to start an automated business process. When you call this tool, you gotta provide specific input variables structured as JSON data. These inputs are required by the workflow—think customer email addresses, invoice IDs, or specific product SKUs—and they fuel the entire run. Once that payload hits Relay, a new execution job starts immediately.

**Tracking and Controlling Jobs**

Once you kick off a run, you need to know what's happening. You call `get_run_status`, passing in the unique run ID from the initial execution. This tool tells you the current state: is it running right now? Did it fail already? Or did it finish up clean?

If you need to see a history of these runs—the good, the bad, and the canceled—you use `list_runs`. This gives you a list of recent run IDs along with basic status data, letting you quickly check on past jobs. And if something goes sideways, if that job just hangs in purgatory, you can hit the brakes. You use `cancel_run` and pass it the specific run ID to forcefully halt an automation that's still kicking.

**Operational Flow Example**

Imagine your agent needs to process a batch of customer records. First, it calls `list_workflows` just to confirm the 'Customer Onboarding' process exists. Next, it uses `get_workflow` on the returned ID to validate that the workflow expects an array of email addresses in its JSON payload. It then constructs that payload and fires off the run using `run_workflow`. The moment the job is created, it captures the new Run ID. With that ID, your agent immediately calls `get_run_status` every minute until the status flips to 'completed' or 'failed.' If, after ten minutes, the status still reads 'running,' you know what to do: grab that same run ID and execute `cancel_run`. You manage the whole sequence—discovery, execution, monitoring, and termination—all through these direct tool calls. It’s a full-stack operational control layer for your business processes.

## Tools

### list_workflows
Displays all the automation workflows defined in your account so you can see what's available to run.

### get_run_status
Checks the current status (running, failed, etc.) of a specific workflow execution.

### get_workflow
Retrieves detailed metadata and configuration for a single defined workflow.

### list_runs
Provides a list of recent, completed, or failed workflow run IDs and basic status information.

### run_workflow
Starts a workflow execution, requiring you to pass specific input variables as JSON data.

## Prompt Examples

**Prompt:** 
```
List all my workflows.
```

**Response:** 
```
Found 4 workflows: 1. Customer Onboarding. 2. Invoice Processing. 3. Lead Qualification. 4. Weekly Report.
```

**Prompt:** 
```
Run the 'Customer Onboarding' workflow with inputs {email: 'john@example.com', name: 'John Doe'}.
```

**Response:** 
```
Workflow run started! Run ID: run_abc123. Status: running.
```

**Prompt:** 
```
Check the status of run run_abc123.
```

**Response:** 
```
Run run_abc123: Status: completed. Output: Account created successfully.
```

## Capabilities

### Triggering workflows
Start an automated business process by providing a specific JSON payload of required variables using the `run_workflow` tool.

### Checking run status
Determine if an active workflow job is running, pending, or complete by calling `get_run_status` with a run ID.

### Discovering automations
List every configured and available automation in your Relay account using the `list_workflows` tool.

### Reviewing history
Fetch a list of recent workflow runs, including their status and IDs, by calling `list_runs`.

### Stopping jobs
Forcefully halt an automation run that is still in progress using the `cancel_run` tool.

## Use Cases

### Automating Customer Onboarding
A support agent needs to onboard a new client. Instead of clicking through forms, the agent asks their AI client to 'Run Customer Onboarding.' The client calls `run_workflow` with `{email: 'user@corp.com', name: 'Jane Doe'}`, which triggers the entire process (account creation, welcome email, etc.) in one step.

### Debugging Failed Invoices
An operations engineer notices a scheduled invoice run failed. They ask their agent to check the status using `get_run_status` and then use `list_runs` to pull up the specific run ID, allowing them to diagnose if the failure was temporary or due to bad input.

### Running a Scheduled Report
The marketing team needs the weekly performance report. They ask their agent to 'Generate Weekly Report.' The client calls `run_workflow` with only a date range, and the server handles the entire multi-step process of data aggregation and document creation.

### Stopping Bad Automations
A developer accidentally triggers a workflow that starts processing thousands of records. Before it causes load issues, they ask their agent to call `cancel_run` using the returned Run ID. The process stops immediately, saving compute time.

## Benefits

- Trigger specific processes with `run_workflow`. You don't just send a command; you pass structured inputs (JSON) that the workflow needs, like an account ID or email address. This ensures the automation has everything it needs to start.
- See history and audit trails using `list_runs`. Instead of digging through dashboards for old job results, your agent pulls up a list of recent runs, giving you quick access to IDs and final status codes.
- Control running jobs with `cancel_run`. If an automation gets stuck or is triggered by mistake, you can tell the agent to call this tool immediately. It stops resource waste.
- Understand the rules before starting with `list_workflows`. You don't have to guess what processes exist; your agent first calls this tool so it knows exactly which workflows are available in your account.
- Pinpoint failures instantly using `get_run_status`. Instead of just knowing a job failed, you check its status and get real-time feedback on whether it's stuck or finished.

## How It Works

The bottom line is: Your AI client handles the multi-step process—discovery, execution, and monitoring—using these specific tools.

1. First, your agent calls `list_workflows` to retrieve a list of available process names and their requirements.
2. Next, you tell the agent which workflow to run and provide all necessary inputs (e.g., `{customer_id: 'XYZ'}`) via `run_workflow`. This starts the job and returns a Run ID.
3. Finally, if you need an update, your agent uses that Run ID with `get_run_status` to check the current progress.

## Frequently Asked Questions

**How do I get my Relay API Key?**
Log in to your Relay account, navigate to Settings > API Keys, and generate a new key.

**Can I pass inputs to a workflow?**
Yes! Use the run_workflow action with a JSON object of input variables that match your workflow's input schema.

**Can I cancel an active workflow run?**
Yes! Use the cancel_run action with the run ID. This only works on runs that are currently in progress.

**Can I view the required inputs for a specific workflow?**
Yes! Use the get_workflow action to see its required input schema before running it.

**How do I use `list_runs` to view my recent workflow history?**
It lists all completed and failed runs for you. You get a list of run IDs, timestamps, and final statuses in one go. This lets you quickly audit past automations without manually checking every single job.

**What is the function of `list_workflows`?**
This tool shows every available automation configured in your Relay account. You use it to discover and see all named workflows and their basic descriptions before you ever try running them.

**After I run a workflow, how do I access its output data?**
You check the status using `get_run_status`. Successful runs provide the structured JSON or text result that the automation generated. This is where you find the actual outcome of the process.

**If a workflow fails, what information does `get_run_status` give me?**
It tells you the current status and often provides an error message or failure reason. This detail helps pinpoint exactly where the automation broke down, making debugging much faster.