> ## Documentation Index
> Fetch the complete documentation index at: https://developers.manglai.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools — Custom metrics

> Custom metric definitions and measurements with the Manglai MCP

## Available Tools

| Tool                               | Kind   | Description                                   |
| ---------------------------------- | ------ | --------------------------------------------- |
| `list_custom_metrics`              | Data   | List custom metric definitions                |
| `list_custom_metric_measurements`  | Data   | List measurements (optional `customMetricId`) |
| `upsert_custom_metric`             | Action | Create or update a custom metric              |
| `upsert_custom_metric_measurement` | Action | Create or update a measurement                |

Action tools require `userConfirmed: false` (preview) then `userConfirmed: true` after user approval. See [MCP intro](/mcp/en/intro).

## Usage Examples

```
"List my custom metrics"
→ list_custom_metrics()

"Show measurements for metric X"
→ list_custom_metrics({ query: "X" })
→ list_custom_metric_measurements({ customMetricId: "..." })

"Create a metric named Water use in m3 with emission factor 22 kg CO2e"
→ upsert_custom_metric({
     name: "Water use",
     unit: "m3",
     emissionFactor: 22,
     emissionFactorYear: "2024",
     userConfirmed: false
   })
→ upsert_custom_metric({ ..., userConfirmed: true }) after approval

"Add a measurement of 120 for January"
→ upsert_custom_metric_measurement({
     customMetricId: "...",
     quantity: 120,
     startDate: "2024-01-01",
     endDate: "2024-01-31",
     userConfirmed: false
   })
→ upsert_custom_metric_measurement({ ..., userConfirmed: true }) after approval
```

Resolve metric ids with `list_custom_metrics` before creating measurements or updating definitions. Configure emission factors with `emissionFactor` (year shortcut) or `emissionFactors` (same shape as the settings UI).
