# Relevance AI MCP

> Relevance AI MCP Server lets your agent run complex data operations and autonomous workflows right from the chat interface. It wraps your custom agents, knowledge datasets, and API tools into a single command center for managing unstructured data and executing multi-step logic.

## Overview
- **Category:** superpower
- **Price:** Free
- **Tags:** multi-agent-systems, autonomous-agents, prompt-chaining, unstructured-data, ai-workforce, knowledge-base

## Description

This MCP Server gives your AI client a full command center for handling complex data operations and running autonomous workflows right from the chat. You're not just talking to an agent; you're controlling its entire operational stack.

To get started, you'll first need to know what's available. You can call `list_agents` to pull up a list of every custom AI worker configured in your studio, giving you their names and IDs. If you want to see the data sources you have access to, use `list_datasets` to retrieve every knowledge table currently scoped to your project. To discover all the specific functions built into your Relevance AI setup, run `list_tools`, which lists every custom tool registered in your environment. You can also check out predefined workflows by calling `list_tasks`; this returns a list of all chained prompt sequences or micro-tasks you've set up.

When it comes to managing the raw knowledge data—your vector databases—you're in charge. To read all the unstructured text entries sitting in a specific dataset, call `get_documents`. If you need to save fresh records into your persistent storage, use `insert_documents`, which accepts an array of objects and saves them instantly to a designated dataset. You can also clean up old or irrelevant data by running `delete_documents`; this permanently removes documents from a specified knowledge dataset using their IDs. Remember, that action is irreversible.

To make your agent *do* something complex, you run it through its specialized tools. For executing pre-built, multi-step worker configurations, you'll use `trigger_agent`, where you provide all necessary input parameters in JSON format to start the process. If you need to know what that agent did after it ran, call `get_agent_run` with a specific run ID; this retrieves the full status and detailed log history of that completed agent session. For running predefined, chained prompt sequences—the tasks you've built out—you execute them immediately using `trigger_task`. This bypasses the agent setup and runs the task directly.

Basically, everything your AI client needs to operate—from finding data sources (`list_datasets`), reading raw text (`get_documents`), writing new records (`insert_documents`), deleting bad data (`delete_documents`), listing available workers (`list_agents`), or kicking off a full automated process (`trigger_agent` or `trigger_task`)—it's all here. You can monitor the entire flow without having to leave your chat interface.

## Tools

### delete_documents
Permanently removes documents from a specific knowledge dataset using their IDs. This action is irreversible.

### list_tasks
Returns a list of all predefined, chained prompt sequences or micro-tasks in the studio.

### list_tools
Lists every custom tool registered within your Relevance AI environment for discovery purposes.

### trigger_agent
Starts an execution run for a specific autonomous agent by providing necessary input parameters in JSON format.

### trigger_task
Executes a specific, predefined workflow or chained prompt sequence (a task) immediately.

### get_agent_run
Retrieves the status and detailed log history for a specific, completed agent run ID.

### get_documents
Reads and returns all raw unstructured data entries currently stored in a specified knowledge dataset.

### insert_documents
Takes an array of objects and saves them as new, persistent records into a designated knowledge dataset.

### list_agents
Returns a list containing the names and IDs of all custom AI workers configured in your studio.

### list_datasets
Retrieves a list of every knowledge table (dataset) available within your current project scope.

## Prompt Examples

**Prompt:** 
```
List all available agents in my Relevance AI Studio and their IDs.
```

**Response:** 
```
I executed `list_agents` and retrieved your available agents: 1. "Sales SDR Bot" (ID: ag-3j92...), 2. "Researcher Assistant" (ID: ag-4m91...). You can trigger either one anytime by using its specific ID.
```

**Prompt:** 
```
Start a run for the 'Market Analysis' agent passing `{"company": "OpenAI"}` as the payload, then tell me the Run ID.
```

**Response:** 
```
I successfully initiated the agent using `trigger_agent`. The execution process has started. Your tracked Run ID is `rn-92f7a4`. Would you like me to ping its progress using `get_agent_run`?
```

**Prompt:** 
```
Insert this JSON array of top competitor articles into the 'competitor_docs' dataset.
```

**Response:** 
```
I invoked `insert_documents` targeting dataset 'competitor_docs' with your provided dataset rows. The array of records has been persistently saved into your Relevance AI knowledge table.
```

## Capabilities

### Run Autonomous Agents
Your agent executes pre-built, multi-step worker configurations by calling `trigger_agent`.

### Manage Knowledge Data
You control the contents of your vector databases using tools like `insert_documents`, `get_documents`, and `delete_documents`.

### Orchestrate Workflows
Your agent runs predefined, chained prompt sequences by calling `trigger_task`.

### Discover System Components
You list all available agents (`list_agents`), datasets (`list_datasets`), and custom tools registered in the system.

## Use Cases

### Researching Competitors' Market Positioning
A competitor analysis team finds raw articles online. Instead of creating a spreadsheet, they prompt their agent: 'Run the 'Market Research' agent using these article links; then, use `insert_documents` to save all key findings into our 'competitor_docs' dataset.' The agent handles the whole sequence.

### Auditing Agent Performance
An AI Engineer needs to check if a new 'Sales SDR Bot' is working correctly. They use `list_agents` first, then they prompt it to run, and finally they call `get_agent_run` with the resulting ID to read the exact reasoning steps—all for auditing purposes.

### Building a Quarterly Report Pipeline
The Operations team needs to generate a report that pulls data from three sources. They use `list_tasks` to find the 'Quarterly Summary' task, which triggers an agent run and then uses `trigger_task` to execute the full multi-step workflow automatically.

### Cleaning Up Old Knowledge Base Entries
A data manager realizes several documents are outdated. Instead of searching through files, they use `list_datasets`, identify the 'old policies' table, and then call `delete_documents` to wipe out all entries with IDs 102-105.

## Benefits

- Automate data saving: Instead of manually copy-pasting insights, prompt your agent to use `insert_documents` immediately after research. It saves the raw output directly into a designated knowledge table.
- Full visibility on processes: Need to know why an agent failed or what it did? Use `get_agent_run`. It gives you access to the full status and logging history for any specific run ID.
- Build reliable pipelines: Forget single-step prompts. You can trigger complex, multi-stage logic using `trigger_task`, which runs a predefined sequence of steps without you leaving your chat interface.
- Keep track of data sources: Use `list_datasets` to see every knowledge table in your project, ensuring the agent knows exactly where it's reading and writing information.
- Zero-friction development: AI Engineers can test chained logic by calling `trigger_agent` right from their terminal. It’s instant testing without touching the studio GUI.
- Maintain clean data: If a knowledge base item is obsolete, use `delete_documents`. You control the lifecycle of your data directly through natural language conversation.

## How It Works

The bottom line is that you write one prompt, but the agent executes a whole chain of internal API calls to solve the problem.

1. Add the Relevance AI extension to your MCP hub. You'll need three things: your Project ID, API Key, and assigned Region.
2. Prompt your agent with a multi-step instruction (e.g., 'Run Agent X for Company Y; then save output into Dataset Z').
3. The server handles the sequence: it calls `trigger_agent`, waits for results, and uses those results to execute data operations like `insert_documents`.

## Frequently Asked Questions

**How do I list all available agents in Relevance AI using `list_agents`?**
Run the `list_agents` tool directly with your agent. This returns a full inventory, giving you the names and unique IDs of every worker configured for your project.

**What is the difference between `trigger_agent` and `trigger_task`?**
`list_agents` runs an autonomous workflow based on a set of rules. `trigger_task` executes a specific, pre-defined chain of prompts that you've already built into a task.

**If I use `insert_documents`, does it overwrite old data?**
No. The `insert_documents` tool appends new records to the dataset. If you need to change existing data, you should retrieve the ID first using `get_documents` and then follow the appropriate update workflow.

**How do I check if an agent finished running correctly?**
After triggering an agent, you must capture the Run ID. Use that ID with `get_agent_run`. This tool provides the status and all log details to confirm completion.

**Can I delete documents using a simple text search?**
No. The `delete_documents` tool requires specific document IDs. You must first use `get_documents` or another method to find the exact identifiers before deletion is possible.

**Before I use `list_datasets`, what specific API keys or permissions must my AI client have?**
You need a valid Project ID, API Key, and Region defined in your Relevance AI settings. These credentials give your agent the necessary scope to access the knowledge table metadata.

**When I call `get_documents`, what specific raw fields does the API return about each record?**
The function returns structured metadata, including document content, source IDs, and timestamps. This allows your agent to process not just the text, but also when it was added.

**If I use `trigger_agent`, how do I check for execution failures or rate limits?**
Check the run logs using `get_agent_run` to pinpoint failure reasons. Failure usually means invalid input JSON, but sustained errors may indicate hitting API rate limits.

**Can the agent monitor a long-running relevance AI agent task?**
Yes. You can trigger an agent using `trigger_agent`, and because it provides a `run_id`, you can explicitly prompt your local Assistant to periodically "check in on the status using `get_agent_run` every minute until finished" or ask it to summarize the step-by-step agent logs after completion.

**What is the differences between tasks, tools, and agents in Relevance AI?**
Agents are autonomous workers capable of making step-by-step reasoning choices based on instructions and tools. Tasks are linear, pre-chained sets of commands and prompts. Tools (`list_tools`) are the individual capabilities, like a custom API integration or web scraper, that tasks and agents utilize to perform their actions.

**How do I find my specific Region and Project ID?**
These details are typically nested within the URL string when you are logged into your workspace or found globally in your developer API keys configuration pane inside your Relevance AI team dashboard. The Region is usually something like 'us-east-1' or 'v2'.