MCP tools for conversion goals
Exact MCP arguments, event rules, responses, and draft behavior for creating, reading, updating, and deleting conversion goals, and for reading goal results.
Goals define which page views, clicks, form submissions, and JavaScript conversion events count as conversions. These tools manage goal definitions, and get-goal-performance reads the results the Goals page shows. They don't record a conversion or attach a goal to a campaign automatically. Campaign attachments use goal_ids in campaign tools.
MCP goal access and draft changes
Every tool accepts an optional project_id, a string containing the public project ID, and follows the shared MCP authorization and project-selection rules. An unresolved, invalid, or inaccessible project returns an MCP error.
These tools don't add a separate goal-plan check to draft edits. Publishing goals requires the project's conversion-goal entitlement. Goals that the plan cannot publish are removed from the published configuration.
Reads use the draft when one exists, otherwise the published configuration. Mutations save a draft and a pre-change snapshot. They do not publish. See publication tools.
Success values below are the JSON payload of an MCP tool result, not a REST response envelope. Errors are MCP error results. Mutation failures use Validation error: ... for configuration-schema failures or Operation failed: ... for other exceptions. Missing required IDs, names, and projects can return an error before mutation.
All examples are illustrative and were not executed. IDs identify fictional WorkForge resources. Replace them with IDs returned by your project.
Goal and event objects
A goal result contains id, name, isVisibleToUser, status, and events. The input name is_visible_to_user becomes isVisibleToUser in stored and returned objects. Goal IDs begin with gol_. Event IDs begin with gev_.
Each object in the events array supports these properties:
| Property | Type and behavior |
|---|---|
id | Optional string. Preserves an existing event ID. Omission generates a new ID. |
type | String, trimmed, case-insensitive, and stored uppercase. PAGEVIEW, CLICK, SUBMIT, or JAVASCRIPT. Defaults to CLICK. Other values are rejected. |
key | String, required for JAVASCRIPT. The site converts by calling RM.push(['conversion', '<key>']) on a matching page. A lowercase letter, then lowercase letters, numbers, or underscores, up to 40 characters, such as purchase. A key belongs to one goal event in the project; a key another goal already uses is rejected. page is optional for JAVASCRIPT and defaults to any page. See track conversions with JavaScript. |
selector | CSS-selector string. Supply it for a usable CLICK or SUBMIT event. Not needed for PAGEVIEW. |
page | Page target. Supply either a comma-separated domain/path string or an array of page-rule objects. |
Each page-rule object contains domain and path strings, plus optional operator. Accepted operators are equals, does not equal, contains, does not contain, starts with, ends with, and glob. Explicit operators compare paths case-insensitively. glob supports *. Omission preserves legacy matching.
String page targets have no URL scheme. example.com/thank-you becomes [{"domain":"example.com","path":"/thank-you"}]. A domain without a path gets path: "*". An empty domain before the slash becomes "*". A domain and its www. form match each other. Other subdomains need their own targets.
Returning the event IDs and page-rule objects from get-goal preserves the existing rule semantics. An empty events array defines no conversion events. A paused goal records no conversions once that state is published.
Unsupported event types are rejected, but saving an event requires only id and type. The type-specific selector and page requirements above aren't enforced on save. A successful save is not proof that an incomplete event can match a visitor action. Unknown event properties are not copied.
create-goal
Creates a draft goal.
| Argument | Required | Type and default |
|---|---|---|
project_id | No | String. Shared project selection. |
name | Yes | Nonempty string. |
is_visible_to_user | No | Boolean. Defaults to true. |
status | No | active or paused. Defaults to active. |
events | No | Array of event objects defined above. Defaults to []. |
value | No | Number from 0 to 1000000000. A fixed value per conversion, a plain number with no currency. Results show conversion value and value per visitor next to each goal; it never decides a winner. A JavaScript conversion can override it with RM.push(['conversion', key, { value, id }]), where id stops a reload from counting the same order twice. |
Returns the new goal object. It does not attach the goal to a campaign. Missing name returns name is required. Unsupported event types return an operation error naming the accepted types. Invalid event or page rules can fail configuration validation.
Illustrative request:
Illustrative result:
list-goals
Returns every goal in the current draft-first configuration. Its only argument is optional string project_id. The result is an array of goal objects, or [] when none exist. Resolved resource-name annotations can accompany stored references. There is no pagination, date filter, or analytics calculation.
This read has no configuration side effect. Shared project and authentication errors apply.
Illustrative request and result for a project with no goals:
get-goal
Returns one complete goal definition, including its events and page-rule objects.
Arguments are optional string project_id and required string goal_id. The result is the goal object, with resolved resource-name annotations where applicable. This read changes no configuration.
Missing goal_id returns goal_id is required. An unknown ID returns Goal 'ID' not found.
Illustrative request:
Illustrative result:
update-goal
Changes a draft goal. Arguments are optional string project_id, required string goal_id, and at least one of name, is_visible_to_user, status, events, or value. Their types match create-goal. Omitted fields retain their current values. Top-level null values are ignored, not clearing instructions, except value: null, which removes the goal's value.
events replaces the entire event array. An empty array removes all events. Event objects use the shared schema above. The tool returns the updated goal object.
Missing goal_id returns goal_id is required. Providing no non-null update fields returns At least one field to update must be provided. An unknown goal becomes Operation failed: Goal 'ID' not found. Event-type and configuration-validation errors match creation.
Illustrative request:
Illustrative result:
The live goal keeps its prior status until publication.
delete-goal
Deletes a goal from the draft and removes its ID from every campaign's goal_ids array in that draft. It does not delete those campaigns. Removing the first goal can change which remaining goal is primary for a campaign using primary_goal.
Arguments are optional string project_id and required string goal_id. Returns {"deleted":true,"goal_id":"ID"}. A missing ID returns goal_id is required. An unknown goal returns Operation failed: Goal 'ID' not found. Shared mutation-validation errors also apply.
Illustrative request and result:
Deletion is a draft change. It does not publish or erase previously recorded conversion events.
get-goal-performance
Reads the conversion results the Goals page shows for an exact inclusive date range. A goal doesn't need a campaign: every published goal records conversions site-wide. This read changes nothing, and it reads the published configuration, not the draft.
| Argument | Required | Type and behavior |
|---|---|---|
project_id | No | String. Shared project selection. |
date_from | Yes | String: YYYY-MM-DD, or an ISO 8601 timestamp whose date is taken in timezone. Inclusive. |
date_to | Yes | String in the same format. Inclusive, not before date_from, at most 90 inclusive days. |
timezone | No | IANA timezone string for the dates. Defaults to UTC. |
goal_id | No | String, such as gol_workdemo. Returns that goal's detail. Omit it for every live goal. |
A conversion is one person converting on one day, so the same visitor converting twice on one day counts once. people counts distinct visitors. siteVisitors is the distinct visitors with a pageview in the range, and conversionRate is conversions divided by siteVisitors, or null when there were no visitors.
Without goal_id, a ready response contains:
| Field | Contract |
|---|---|
status | ready. |
siteVisitors | Integer. |
totals | {conversions, people} across every goal. A person who reached two goals counts once in people. |
goals | One entry per live goal: id, tracking, conversions, people, conversionRate, and lastConvertedAt (timestamp of the latest recorded conversion, or null). |
period | {start, end, timezone} as requested. |
computedAt, stale | When the cached result was computed, and whether it is older than the refresh window. |
With goal_id, a ready response contains status, tracking, period, computedAt, stale, and:
| Field | Contract |
|---|---|
totals | conversions, people, siteVisitors, conversionRate, and lastConvertedAt. |
prior | {conversions, people} for the same number of days just before date_from, or null when recording started inside that earlier window, so a partial period is never compared with a whole one. |
daily | Array of {date, conversions}, one entry per local date in the range. |
sources | One entry per live campaign that lists the goal: campaignId, campaignName, isPrimary, conversions, personalized, holdback, share (that campaign's credited people divided by the goal's people), and test. test is the campaign's personalization test when this goal is the one it measures: {id, kind, kindLabel, state, stateLabel, needsDecision, verdict, reportUrl}, as in A/B test results. It's null for any other campaign. A person is credited to a campaign only when they saw one arm of it before converting. |
noCampaign | {people, share}: the people who converted without any campaign's credit, and their share of people. |
The visitor-level activity rows and sparklines on the Goals page are left out of both shapes.
Each tracking object has status, from, explanation, and detail:
status | Meaning |
|---|---|
recorded | The goal is counted. A non-null from timestamp means conversions count only from that time, when the project's published site started recording goals site-wide. |
after_next_publish | Nothing records the goal yet. detail says why: the goal isn't in the published configuration yet, it has no conversion events (so even a publish won't record it), or the project hasn't published since site-wide goal recording launched on November 3, 2026. |
paused | The goal is paused, so nothing is recorded. |
not_attached | The goal isn't attached to a campaign, so nothing is recorded. |
explanation is the dashboard's sentence for a state that records nothing, and detail is the longer reason written for assistants, null when there's none. For a goal that records nothing, report that state rather than zero conversions: with goal_id, the counts are zeros, daily and sources are empty, and none of them mean that no one converted. Past conversions are never backfilled.
A cold result, with nothing computed yet for these arguments, returns the following. A stale result is still returned, with stale: true, while it refreshes.
Call again with the same arguments after the delay. Don't infer results from this response.
Errors:
Goal ID not found for project PROJECT. Use list-goals for its goals.for a goal ID that isn't in the project.timezone must be a valid IANA timezone.The date range must be no more than 90 inclusive days.date_from and date_to must be valid YYYY-MM-DD dates or ISO 8601 timestamps, with date_from on or before date_to.This range has more goal conversions than one read can include. Try a shorter range.Goal results are temporarily unavailable. Try again shortly.
A goal that exists only in the draft passes the ID check and returns tracking.status after_next_publish, because the live site doesn't record it yet (not_attached on a project without site-wide goal recording).
Illustrative request and result excerpt:
get-campaign-performance and get-ads-report point to this tool when the project has goals but no live campaign counts one.