> ## Documentation Index
> Fetch the complete documentation index at: https://developers.clay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Give an agent access to a Clay function

> Let an agent call Clay-managed or custom functions from its normal workflow.

Use this pattern when you want Claude Code, Codex, Cursor, or another MCP-capable agent to call a Clay function for structured GTM data.

## 1. Install the Clay plugin

The Clay plugin gives agents both MCP capabilities and the Clay CLI.

<Card title="Clay plugin quickstart" href="/cli/quickstart">
  Install the plugin and configure `CLAY_API_KEY`.
</Card>

## 2. Choose a function

Use a Clay-managed function for common jobs like finding emails or enriching companies. Use a custom function when your team already has Clay logic it wants agents to call.

<Card title="Routines" href="/routines">
  Compare Clay-managed functions, custom functions, and Workflows.
</Card>

## 3. Expose the function

For custom functions:

1. Open [Functions](https://app.clay.com/functions).
2. Select the function.
3. Open **Details**.
4. Enable **MCP** if the agent should call it through MCP.
5. Enable **API** if you also want API or CLI execution.

## 4. Let the agent call it

After setup, the agent can discover and run the function from its available routines. Keep the input schema tight and the output predictable.

Good functions for agents:

* Find a person's work email.
* Enrich a company by domain.
* Score an inbound lead.
* Summarize account research.
* Route a lead to the right owner or motion.
