Real-estate investment, multi-sub-account CRM operations
An AI-Callable Tool Layer Over GoHighLevel: GHL + MCP Automation
All doors are live and in daily use. Hardening, an allow-list on the write door and a read-only database credential, is identified but not yet implemented.
- Our role
- Automation architect; designed and built the capability layer
- Timeline
- Built incrementally while the main pipeline was in production
- Sector
- Real-estate investment, multi-sub-account CRM operations
What was breaking
GoHighLevel exposes custom fields, pipelines, and stages by internal ID. A property's asking price is not 'asking price' to the API. It is a random-looking string, different in every sub-account. When a build spans three sub-accounts and roughly thirty fields per record, you need an accurate map of several hundred identifiers before you can write a single line of integration logic.
The obvious ways to get that map are all bad. Clicking through the interface and copying IDs out of URLs is slow and error-prone, and it has to be redone every time someone adds a field. Building a throwaway automation per question means a graveyard of one-off scenarios nobody dares delete. Writing a script means the client cannot run it, so every future question comes back to me.
There was a second, related problem. Once the main pipeline was live, operational questions kept arriving that were not worth building automation for: set do-not-contact on this contact, patch a mis-typed field on these records, check what the CRM actually holds for this property, pull these rows out of the reporting database. Each one is thirty seconds of work and an hour of overhead if it needs a new scenario built, reviewed, and run.
Discovery was the bottleneck, not the build
Mapping several hundred opaque field IDs across three sub-accounts took longer than writing the automation that used them.
Every ad-hoc question needed a developer
Small operational fixes could not be done by the team, so they queued behind whoever had API access.
One-off scenarios accumulated
Throwaway automations built to answer single questions never got deleted, because nobody could be certain they were unused.
No single audited path to the CRM
Writes happened from wherever was convenient, which makes 'what changed this record?' an unanswerable question.
What we built
The design is deliberately boring: each tool is three steps, accept arguments, make exactly one API call, return the result. No branching, no transformation, no business rules. A read tool takes a path and performs an authorised GET. A write tool takes a path, an HTTP method, and a JSON body, and performs that mutation. The spreadsheet tool takes a path relative to the Sheets API. The database tool takes SQL.
That thinness is the whole point. Because a tool contains no logic, it cannot be wrong about the business. It can only pass a request through or fail. It needs no maintenance when the business process changes, it is trivially reviewable, and it stays useful indefinitely. All the logic lives in separate, named automations that are inspected and versioned on their own terms.
One tool exists per credential boundary rather than one generic tool with a target argument. There are three CRM sub-accounts, so there are three read doors, each holding exactly one sub-account's credential. This means a tool physically cannot reach a sub-account it was not built for; the isolation is enforced by which credential the tool holds, not by a parameter that could be passed wrongly.
The database tool is the only one with any machinery, and for a specific reason: a SQL query returning many rows would otherwise emit one output per row, forcing every caller to handle iteration. An aggregation step collapses the result set into a single payload, so a caller gets one JSON response regardless of whether the query matched no rows or hundreds. That is the difference between a tool a language model can use reliably and one it cannot.
Which brings us to the unplanned outcome. Because each tool takes structured arguments and returns structured results, they work as tool definitions for an AI agent. The agent gets a described capability ('read from this CRM', 'run SQL against the reporting database') rather than raw API credentials, and every call it makes passes through a surface I defined. Giving a model a narrow, named door is a fundamentally better posture than giving it an API key and hoping.
A tool is a door, not a workflow
Three steps: arguments in, one call, result out. Any tool that starts acquiring conditions has stopped being a tool and should be promoted to a named automation.
One credential per tool
Isolation between sub-accounts comes from each tool holding exactly one credential, so cross-account access is structurally impossible rather than merely unintended.
Read and write are separate tools
Splitting them means read access can be handed out freely while mutation stays deliberately narrow, and an agent given only the read tool cannot change anything.
Shape the response for the caller
Aggregating multi-row results into one payload is what makes the database tool safe for a model to call. Tools that return a variable number of outputs are a reliability problem.
The arguments are the documentation
Each argument carries a description with a worked example, so the tool is self-describing to a human operator and to a model reading its schema.
Non-negotiables
- Business logic must stay out of these tools. The moment a tool starts making decisions it becomes a system to maintain rather than a door to walk through.
- Each tool must be callable on demand with structured arguments, not scheduled, not webhook-driven.
- One tool per credential boundary. A tool authenticated against one sub-account must not be able to touch another.
- The team must be able to use them without API knowledge; the arguments are the interface.
The pipeline
Drawn as text and shapes rather than shipped as an image, so the step labels stay readable and downloadable.
The capability layer
Each door is a three-step tool holding exactly one credential. Business logic sits in named automations above the layer; the tools themselves stay thin and permanent.
- Trigger
- Branch / filter
- Processing step
- Delivered output
- Primary path
How the work runs
Each stage, what it does, and the specific failure it is built to prevent.
A caller invokes a named tool
Tools are on-demand only, no schedule, no webhook. They run when an operator or an agent calls them with arguments. That makes them inert by default: nothing happens in this layer unless something deliberately asks for it.
Nothing in the capability layer can fire on its own.
Arguments arrive as a described schema
Each tool declares its inputs with a description and a worked example, a read door takes an API path, a write door takes a path, method, and JSON body, the database door takes SQL. The schema is the interface and the documentation at once, which is what lets a model call the tool correctly without extra prompting.
Exactly one call is made, under one credential
The tool performs a single API call using the one credential it holds. There is no routing, no fallback, and no second call. If you want a different sub-account, you call a different tool, which is precisely how the isolation between sub-accounts is enforced.
A tool cannot reach a credential boundary it was not built for.
Multi-row results are collapsed before returning
The database door aggregates query results into a single payload. Without this, a hundred-row query produces a hundred downstream outputs and every caller has to handle iteration. With it, the response shape is identical whether the query matched nothing or everything.
Empty result sets do not halt the call; they return an empty payload rather than an error.
The result goes back as structured data
One JSON payload per call. The caller (a person reading it, an automation consuming it, or a model reasoning over it) gets a predictable shape every time.
What it runs on
Every tool listed with the job it actually does in this build.
Orchestration
Make.com custom tools
Each door is a published, individually callable automation rather than a scheduled scenario, the mechanism that makes them invokable by name with arguments.
Integration
GoHighLevel REST API
Reached directly rather than through connector modules, so any authorised endpoint is available through one door instead of needing a module per operation.
AI
Model Context Protocol (MCP)
The surface that exposes these tools to an AI agent as named capabilities, so the agent is handed described doors instead of API credentials.
Data
Google Sheets API
One generic door onto the spreadsheet layer, covering range reads, appends, and batch updates across every sheet the service account can see.
PostgreSQL (Railway)
The reporting database for the dispositions pipeline, queryable through its own door with results aggregated into a single response.
What stopped being manual
Snippets are illustrative and generic. No client data appears in any of them.
Field and pipeline discovery
Replaces clicking through CRM settings screens and copying identifiers out of URLs. One call enumerates every custom-field definition for a record type, which is how the field mapping behind the main pipeline was derived in the first place.
text
read_tool(url: "/locations/{location}/customFields?model=opportunity")
// Returns every field definition with its ID, name and type.
// This single call replaced hours of clicking through settings,
// and can be re-run whenever someone adds a field.Ad-hoc record repair without building anything
Replaces the hour of overhead around a thirty-second fix. Setting do-not-contact or patching a mis-typed field used to mean building, reviewing, and running a throwaway automation. Now it is one call.
text
write_tool(
url: "/contacts/{id}",
method: "PUT",
body: '{"dnd": true}'
)Reporting queries the team can run themselves
Replaces asking a developer for numbers. Because the database door returns one aggregated payload, an operator or an agent can ask a question of the reporting database and get a usable answer back directly.
sql
-- Passed straight through the database door; the rows come back
-- collapsed into a single payload rather than one output per row.
SELECT county, count(*) AS properties, avg(asking_price)
FROM dispositions_properties
WHERE status = 'active'
GROUP BY county
ORDER BY properties DESC;What it was worth
The immediate return was discovery speed. Mapping several hundred opaque identifiers across three sub-accounts went from a clicking exercise that had to be repeated whenever a field changed, to a handful of calls that can be re-run at any time. That mapping is the foundation the entire dispositions pipeline sits on, so getting it reliably was worth more than the tools cost to build.
The ongoing return is that small operational work stopped needing a build. Setting do-not-contact, patching a field, checking what the CRM actually holds, pulling numbers out of the reporting database. All of it is a call rather than a project. The graveyard of one-off scenarios stopped growing, because the question that used to require a new scenario now has a permanent door to go through.
The strategic return was the one I did not plan for. Because each tool is narrow, named, and takes structured arguments, the layer doubles as the tool surface for an AI agent. The agent never holds a credential; it holds a description of what it is allowed to do. That is a materially better security posture than the common alternative of handing a model an API key, and it was free, a by-product of building the tools thin and separate in the first place.
Doors in the capability layer
Read access per sub-account, a write door, and doors onto the spreadsheet and database layers.
The entire logic of each tool
Arguments in, one call, result out, which is why they need no maintenance as the business changes.
To enumerate a sub-account's field definitions
Replacing a repeated manual pass through CRM settings screens.
Credentials exposed to the AI agent
The agent is given described capabilities; the credentials stay inside the tools.
Handed over
- A read door per CRM sub-account, three in total, each holding exactly one credential, each able to perform any authorised GET.
- A write door for the operational sub-account, accepting method and body so mutations go through one auditable surface.
- A spreadsheet door covering the whole Sheets API surface for the automation service account.
- A database door that runs SQL against the reporting database and returns results aggregated into a single payload.
- Self-describing argument schemas with worked examples on every tool, so they are usable by an operator and callable by an AI agent without extra prompting.
- The field and pipeline mapping that the main dispositions pipeline depends on, derived using these tools rather than by hand.
Questions about this build
What teams usually ask when they recognise their own process here.
Permanence and auditability. Because it contains no business logic, it cannot become wrong when the business changes, so it never needs maintenance, unlike the throwaway scenarios it replaces. And because every call goes through one named surface holding one credential, you get a single place to reason about access instead of writes happening from wherever was convenient.
Because a parameter can be passed wrongly and a credential cannot. Each door holds exactly one sub-account's credential, so it is physically unable to touch another sub-account; the isolation is structural rather than a convention the caller has to honour. With a single generic tool, one bad argument reaches the wrong CRM.
It is considerably safer than the usual alternative, which is giving the model an API key. Here the agent holds no credentials; it holds named, described capabilities, and every call passes through a surface I defined. The read and write doors are separate, so an agent can be given read access alone. The remaining gap, which I would not pretend away, is that the write door currently accepts any method and path; narrowing it to an allow-list is the next hardening step.
Because without it a query returning a hundred rows produces a hundred separate outputs, and every caller has to handle iteration. Aggregating collapses the result into one payload, so the response shape is identical whether the query matched nothing or hundreds of rows. That predictability is the difference between a tool a model can call reliably and one that breaks on the second query.
Functionally it is the same API. That is the idea. What the layer adds is that the credential is held in one place, the call is inspectable after the fact, and the capability can be handed to someone, or something that should not hold the credential itself. For a solo developer talking to one CRM, direct API access is fine. For a team and an agent operating across three sub-accounts, the door is worth the thin wrapper.
Before, and I would again. The field mapping that the main pipeline depends on was derived using these tools. Trying to build the pipeline first means guessing at identifiers, and every wrong guess surfaces as a silently empty field rather than an error. Build the instrument, then build the machine it measures.
Capabilities this used
Read next
All gohighlevel services workHave a process that works like this one did?
Book a strategy call. We will walk the workflow with you and say plainly which parts are worth automating and which are not.