What custom functions are good for
- Team-specific enrichment waterfalls.
- Account scoring and qualification.
- Inbound routing and territory logic.
- CRM hygiene and validation.
- Repeatable research workflows.
- Internal tools that need the same Clay logic your GTM team already trusts.
Runs and batch runs
The key distinction is where the function is built:- Build and manage the function in the Clay UI.
- Run and batch-run it programmatically from agents, the CLI, MCP, or API.
Encode Clay functions into business systems
Call custom functions from backend services, queues, and internal tools.
Expose a function
To call a custom function:- Open Functions.
- Create or select a function.
- Open Details.
- Enable the integrations you need, such as API or MCP.
- Copy the
t_...function id. - Prefix it with
function:when you call it from the plugin, CLI, MCP, or API.
function:t_....
Each access setting enables a separate way to call the function:
An agent can use either the CLI or MCP, so choose access based on its connection. Enabling one does not enable the others. Workspace and role permissions still apply.
Access a published function through MCP
Publishing a function does not automatically enable MCP access. Enable MCP access in the function’s settings before calling it through an MCP client. API access alone is not sufficient. Calllist_subroutines to find functions available to the connected MCP client. Use the returned id as subroutine_id when running a function through MCP.
A published function is missing or cannot run by id
MCP access is required both to list a function and to run it by id. Supplying a known id does not bypass that requirement. If a function is missing fromlist_subroutines or a run returns a not-found error:
- Confirm the MCP client is connected to the workspace that contains the function.
- Check that MCP access is enabled in the function’s settings.
- If access cannot be changed, ask a workspace admin to check the integration and role access settings.
- Call
list_subroutinesagain and use an id returned by that call.

