# Workflows as MCP Tools

MCP Tools in CARTO are built from Workflows. Each tool you create defines how to solve a specific spatial problem, what inputs it needs, and what results it returns.

This guide shows you how to configure a Workflow as an MCP Tool.

### Step 1: Create a Workflow

Build a Workflow that solves the specific problem you want agents to handle. For example, if you want agents to find nearby stores, create a workflow that performs that spatial query.

<figure><img src="/files/V699F5Oa2B9QnRMXRIhg" alt=""><figcaption></figcaption></figure>

### Step 2: Add an MCP Tool Output

Add the **MCP Tool Output** component to your workflow. This defines what the tool returns.

Choose the output mode:

* **Sync**: Returns results immediately (use for fast queries)
* **Async**: Returns results after processing completes (use for long-running operations)

<figure><img src="/files/vD7xIrdlqWzu0h632f6h" alt=""><figcaption></figcaption></figure>

### Step 3: Configure the tool

Click the three-dot menu in the top-right corner and select the **MCP Tool** settings.

<div align="left"><figure><img src="/files/ARgjUZcdRVOBq66NOOpW" alt="" width="212"><figcaption></figcaption></figure></div>

When the dialog opens up, write a clear description explaining what the tool does. Make sure to also. Define all input parameters with descriptive names and descriptions and enable the tool to make it available through the MCP Server.

**Example description:**\
"Finds the 5 nearest retail stores to a given location and returns their addresses and distances."

### Step 4: Sync changes

When you update a workflow, click **Sync** to propagate changes to the MCP Tool. This ensures agents always use the latest version.

<figure><img src="/files/NBKDZ3HAztAsn2pHn7QC" alt=""><figcaption></figcaption></figure>

### Step 5: Use your own tools

Once your workflow is configured as an MCP Tool, you can:

* Connect external agents (like Gemini CLI) to your CARTO MCP Server. See Using MCP Tools with CARTO.
* Give CARTO AI Agents access to the tool. See Adding MCP Tools to AI Agents.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.carto.com/agentic-gis/carto-mcp-server/workflows-as-mcp-tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
