Skip to content

Build an agent workflow with MCP

An example conversation: an AI app finds a lead, logs the call, proposes a follow-up automation and asks to send an email for approval.

Who can do this
A connection with crm:read, crm:write and automations:draft. An Account Owner or Account Admin publishes the automation and approves the email.
On this page

This walk-through shows how the tools fit together. The AI app does the record work; a person keeps every decision that reaches a customer.

The conversation

Example (names are fictional)
You:   I just talked to Maria Lopez about a water heater. Log it and set up a follow-up.

AI:    workspace_get                 -> "Rivera Plumbing", you are an owner
       crm_contacts_search "Lopez"   -> Maria Lopez (id …)
       crm_activity_log              -> call logged on Maria's timeline (requestId …)
       crm_task_create               -> "Send water heater quote" due Friday
       automation_steps_catalog      -> triggers and steps this account offers
       automation_draft_propose      -> draft "Quote follow-up" in test mode
       automation_publish_link_get   -> nextStep: run_dry_test, portalUrl …

AI:    Done. I logged the call and added a task for Friday. I drafted
       "Quote follow-up" (wait 2 days, then email the quote template).
       Open this link to test and publish it: <portalUrl>

You:   Also send Maria the "Thanks for calling" email now.

AI:    email_template_preview        -> subject and text for Maria
       email_send_request            -> waiting for approval (expires in 72 hours)

AI:    I asked to send it. An owner or admin approves it under Approvals;
       nothing is sent until then.

Why it works this way

  • workspace_get first confirms the account and what the connection may do.
  • Searches return ids only; the app opens a record only when it needs details, which keeps it inside the read budget.
  • Each write uses a fresh requestId, so a retry never makes a second call log or task.
  • The automation is a draft in test mode; a person runs the dry test and publishes it at the portalUrl.
  • The email waits under Approvals; it needs a usable address, email consent and no unsubscribe.

Tips for agent builders

  • Use help_guides_list and help_guide_get for setup tasks: they give the exact steps and who does each.
  • Read automation_steps_catalog before drafting; using a step the account doesn't offer is refused.
  • Never paste customer text into instructions: it is marked untrusted for a reason.