Skip to main content
Glama

Create or redefine a goal

goals_save
Destructive

Create a goal, or redefine one with the same name: EVENT (an event name like signup, or name@/path for that event on one page: form_submit@/register is the signup form sent on /register, which t.js reports with no code on the site), PAGEVIEW (a path pattern like /welcome*), CTA (a data-sf value, * for a wildcard), ENGAGED, REVENUE (trial, paid), or CHECKOUT (a visit back from a hosted checkout such as Stripe or Dodo: a payment, seen without any code on the site; match is the return path pattern, * for any). Every goal you create is SOFT. Only the founder makes a goal HARD, in the results app, and the headline conversions count HARD goals once there are any; changing a HARD goal's definition puts it back to SOFT. Say why in note. stage puts it on the way to a payment: interest (clicks and pages before signing up, the signup page itself included), engaged, signup (a finished signup, each way of signing up is its own goal in this stage and the stage counts a session once), active (a signed-up person using the product), paying. Left out, it is read from the goal. A goal in signup or paying (or leaving one) needs ways: every way an account is created (or a payment confirmed) that you found in the code, each { way, where: file:line, covered: the goal that counts it, or "server" when the product's server sends the event (the users routine) }, and alsoCounts: what else the goal can count besides a new account or a payment, or "nothing". The save is refused while any way has nothing counting it. A way counted by a goal that does not exist yet: save that goal in the same call with alsoSave. Free.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "type": "<type>"
    },
    "name": "goals_save"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
noteNo
typeYes
waysNoSignup or paying stage: every way in from the code, each with what counts it
matchNoNeeded except for ENGAGED and CHECKOUT
stageNo
siteIdNo
alsoSaveNoOther goals in the same stage saved in this call, so ways can name them
alsoCountsNoSignup or paying stage: what else this goal can count (an existing email sent again, a rejected submit, a page logins also reach), or "nothing"
valueCentsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / alsoCounts
      Added value: +{
      +  "description": "Signup or paying stage: what else this goal can count (an existing email sent again, a rejected submit, a page logins also reach), or \"nothing\"",
      +  "maxLength": 160,
      +  "type": "string"
      +}
    • addedInput schema / properties / alsoSave
      Added value: +{
      +  "description": "Other goals in the same stage saved in this call, so ways can name them",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "alsoCounts": {
      +        "maxLength": 160,
      +        "type": "string"
      +      },
      +      "match": {
      +        "maxLength": 200,
      +        "type": "string"
      +      },
      +      "name": {
      +        "maxLength": 80,
      +        "type": "string"
      +      },
      +      "note": {
      +        "maxLength": 300,
      +        "type": "string"
      +      },
      +      "type": {
      +        "$ref": "#/properties/type"
      +      },
      +      "valueCents": {
      +        "minimum": 0,
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "type"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 5,
      +  "type": "array"
      +}
    • addedInput schema / properties / ways
      Added value: +{
      +  "description": "Signup or paying stage: every way in from the code, each with what counts it",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "covered": {
      +        "description": "The goal that counts it (name or id), or \"server\"",
      +        "maxLength": 80,
      +        "type": "string"
      +      },
      +      "way": {
      +        "description": "How the account is created or the payment confirmed: \"email form\", \"google\", \"github\", \"invite\", \"magic link\", \"stripe webhook\"",
      +        "maxLength": 60,
      +        "type": "string"
      +      },
      +      "where": {
      +        "description": "Where in the code, file:line",
      +        "maxLength": 200,
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "way",
      +      "where",
      +      "covered"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 20,
      +  "type": "array"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / stage
      Added value: +{
      +  "enum": [
      +    "interest",
      +    "engaged",
      +    "signup",
      +    "active",
      +    "paying"
      +  ],
      +  "type": "string"
      +}
  3. Added

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well past the annotations to disclose state transitions: 'Every goal you create is SOFT', 'Only the founder makes a goal HARD', and critically 'changing a HARD goal's definition puts it back to SOFT' — a destructive side effect the destructiveHint annotation only hints at. It also discloses the validation refusal condition and that omitted `stage` is read from the existing goal on redefine. That is exactly the mutation behavior an agent needs before calling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Almost every sentence carries load-bearing domain information, so it is not padded — but it is delivered as one dense paragraph of nested parentheticals (e.g. 'form_submit@/register is the signup form sent on /register, which t.js reports with no code on the site'). The six goal types and five stages would be far easier to scan as a list, and the core action is front-loaded but quickly buried.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter destructive mutation with only 40% schema coverage and no output schema, the description covers the hard parts: type taxonomy, stage semantics, the ways/covered/alsoSave dependency chain, and the soft/hard policy. The remaining gaps are `siteId` (which site the goal belongs to) and `valueCents` (presumably the revenue value for REVENUE/CHECKOUT goals), neither of which is defined anywhere.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 40% schema coverage the description carries much of the load: it defines each `type` enum value, the five `stage` values ('interest (clicks and pages before signing up...)', 'paying'), the required shape and per-way fields of `ways`, and what `alsoCounts` means ('what else the goal can count besides a new account or a payment, or "nothing"'). `alsoSave` is explained as the mechanism for ways that reference not-yet-existing goals. `siteId` and `valueCents` are left entirely unexplained in both schema and description, which keeps it from a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a precise verb+resource: 'Create a goal, or redefine one with the same name', which tells the agent this is an upsert keyed on name. The six goal types (EVENT, PAGEVIEW, CTA, ENGAGED, REVENUE, CHECKOUT) are each defined with concrete examples, so an agent knows exactly what object it is writing. It never names a sibling such as goals_list, so differentiation is inferred from the verb rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Supplies real preconditions rather than vague guidance: 'A goal in signup or paying (or leaving one) needs `ways`', 'The save is refused while any way has nothing counting it', and 'A way counted by a goal that does not exist yet: save that goal in the same call with `alsoSave`'. It also states the soft/hard policy and that `stage` is inferred when omitted. It does not route the agent away from alternatives (e.g. goals_list for inspection), so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.