MCP tool reference

create_metric

Create a metric (goal) in a project. Requires mcp:write and the existing metric create policy.

Create a metric (goal) in a project. Requires mcp:write and the existing metric create policy.

Permissions

{
  "scope": "mcp:read and mcp:write",
  "role": "The existing entity create/update policy must allow this user; the mcp:write scope alone is insufficient.",
  "plan": "The billing account must have the MCP entitlement. Writes also require a writable billing mode and applicable entity limits.",
  "team": "The OAuth connection is approved for exactly one Team. Other team_id values cannot change the tenant."
}

Input

{
  "properties": {
    "project_id": {
      "description": "Project ID in the authenticated team",
      "type": "integer"
    },
    "name": {
      "description": "Metric name",
      "maxLength": 255,
      "type": "string"
    },
    "type": {
      "description": "Metric type",
      "enum": [
        "average-per-user",
        "rate-per-user",
        "average-per-session",
        "rate-per-session"
      ],
      "type": "string"
    },
    "winning_direction": {
      "description": "Whether an increase or a decrease is a win",
      "enum": [
        "increasing",
        "decreasing"
      ],
      "type": "string"
    },
    "description": {
      "description": "Optional description",
      "type": "string"
    }
  },
  "type": "object",
  "required": [
    "project_id",
    "name",
    "type",
    "winning_direction"
  ]
}

Output

{
  "type": "object",
  "properties": {
    "created": {
      "type": "boolean",
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "project_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "average-per-user",
            "rate-per-user",
            "average-per-session",
            "rate-per-session",
            null
          ]
        },
        "winning_direction": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "increasing",
            "decreasing",
            null
          ]
        }
      },
      "required": [
        "id",
        "project_id",
        "name",
        "description",
        "type",
        "winning_direction"
      ]
    }
  },
  "required": [
    "created",
    "data"
  ]
}

Examples

Request arguments

{
  "project_id": 1,
  "name": "Checkout conversion",
  "type": "rate-per-user",
  "winning_direction": "increasing"
}

Result

{
  "created": true,
  "data": {
    "id": 101,
    "project_id": 1,
    "name": "Checkout conversion",
    "description": null,
    "type": "average-per-user",
    "winning_direction": "increasing"
  }
}

Errors

[
  {
    "status": 401,
    "description": "Missing, expired, or revoked OAuth access token."
  },
  {
    "status": 403,
    "description": "Missing MCP scope, team membership, plan entitlement, or user permission."
  },
  {
    "status": 404,
    "description": "The MCP server is disabled."
  },
  {
    "status": 429,
    "description": "Rate limited; honor Retry-After before retrying."
  },
  {
    "description": "Tool execution or validation failures are MCP error results. Inspect isError; a successful HTTP status alone does not indicate a successful tool call."
  }
]

An expired or revoked OAuth connection cannot connect. A missing scope, role, feature entitlement, or team access prevents the operation. See MCP setup.

Was this article helpful?

Need more help? Copy this article's details and paste them into a request on our feedback portal. You may need to sign in.

Open feedback portal

On this page