Record a metric value

metric.observeChanges dataCreates, updates or deletes something in your workspace.

What it does

Records one measured value for a product KPI or a feature metric at a point in time, building up its history. Example: weekly active users was 4200 on 2026-09-14. Set metricType to "product" for a KPI (id from productkpi.list) or "feature" for a feature metric (id from featuremetric.list); a mismatched type, or a metric from another workspace, is reported as not found. Use it when the user shares a number from analytics, or after pulling one yourself. Each call adds a new row; nothing is overwritten. It does not change the metric's status or check it against the target. Returns {success, data: the saved observation}. Read the history from the resource testmaze://metric-observations/{spaceId}/{metricType}/{metricId}.

Ask your agent

You don’t call metric.observe yourself. Say something like this to Claude Code, Cursor or another MCP-connected agent:

  • “Log 4,200 weekly active users for this week”
  • “Checkout conversion was 48% yesterday, record it”

Inputs

NameTypeDescription
metricType
required
enumproduct = the id is a product KPI (productkpi.list); feature = the id is a feature metric (featuremetric.list).
Allowed: productfeature
metricId
required
stringId of the KPI or feature metric being measured (the id from productkpi.list or featuremetric.list).
value
required
stringThe measured value. A plain number in a string: digits and an optional decimal point, no commas, symbols or units. It is stored as a number, so "5,000" or "5%" is rejected. Examples: "4200", "48.5".
observedAt
optional
stringWhen the value was true, as an ISO 8601 date or date-time. Example: "2026-09-14T00:00:00Z". Defaults to now.
source
optional
stringWhere the number came from, free text up to 32 characters. Default "manual". Examples: "posthog", "stripe-dashboard".
notes
optional
stringAny context worth keeping. Example: "Dip due to the holiday weekend."

The MCP call

What the agent’s MCP client sends (placeholders in angle brackets):

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "metric.observe",
    "arguments": {
      "metricType": "product",
      "metricId": "<metricId>",
      "value": "<value>"
    }
  }
}

Connect your agent

npx -y @testmaze/mcp init tmt_xxx
claude mcp add tm --scope project -- npx -y @testmaze/mcp

Create the token in your Test Maze workspace under Settings → MCP. Setup for Cursor, Cline, Gemini CLI and Codex CLI is shown there too.