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

# MCP Tools Reference

> Reference for all Leaf MCP server tools in Cursor, Claude Code, and other AI assistants. Covers fields, operations, machine files, weather, billing, and users.

Every tool the Leaf MCP server exposes to AI coding assistants. Tools are organized by category. All tools authenticate using the `LEAF_TOKEN` header configured in your MCP client. See [MCP Server Overview](/mcp/overview) for setup instructions.

## Documentation

### `get_docs_index`

Returns an index of all available Leaf API documentation pages.

| Parameter | Type | Required | Description   |
| --------- | ---- | -------- | ------------- |
| —         | —    | —        | No parameters |

### `get_leaf_doc`

Returns the contents of a specific Leaf API documentation page.

| Parameter  | Type   | Required | Description                                                          |
| ---------- | ------ | -------- | -------------------------------------------------------------------- |
| `doc_path` | string | Yes      | Path to the doc page (e.g., `API_Reference/Alerts/alerts_endpoints`) |

***

## Configuration

### `get_api_owner_configuration`

Returns configuration settings for the API owner, including defaults for field operation image creation, fields auto-sync, and merge intersections.

| Parameter | Type | Required | Description   |
| --------- | ---- | -------- | ------------- |
| —         | —    | —        | No parameters |

### `get_leaf_user_configuration`

Returns configuration settings for a specific Leaf user. If the user has no custom configuration, they inherit from the API owner.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |

***

## Provider Credentials

### `get_john_deere_credentials_events`

Returns events and status information for a Leaf user's John Deere credentials. Useful for troubleshooting connection issues with John Deere Operations Center.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |

### `get_climate_fieldview_credentials_events`

Returns events and status information for a Leaf user's Climate FieldView credentials.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |

### `get_cnhi_credentials_events`

Returns events and status information for a Leaf user's CNHi credentials.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |

***

## User Management

### `list_users`

Returns a paginated list of Leaf users belonging to the authenticated organization.

| Parameter     | Type    | Required | Description                          |
| ------------- | ------- | -------- | ------------------------------------ |
| `email`       | string  | No       | Filter by email address              |
| `name`        | string  | No       | Filter by full name                  |
| `external_id` | string  | No       | Filter by your external identifier   |
| `page`        | integer | No       | Zero-based page number (default `0`) |
| `size`        | integer | No       | Page size, max 100 (default `10`)    |

***

## Fields

### `list_fields`

Returns a paginated list of fields for a Leaf user.

| Parameter      | Type    | Required | Description                          |
| -------------- | ------- | -------- | ------------------------------------ |
| `leaf_user_id` | string  | Yes      | UUID of the Leaf user                |
| `type`         | string  | No       | Filter by field type                 |
| `farm_id`      | integer | No       | Filter by farm ID                    |
| `provider`     | string  | No       | Filter by provider                   |
| `page`         | integer | No       | Zero-based page number (default `0`) |
| `size`         | integer | No       | Page size, max 100 (default `10`)    |

### `get_field`

Returns details for a single field.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |
| `field_id`     | string | Yes      | UUID of the field     |

### `get_field_boundary`

Returns the active GeoJSON boundary of a field.

| Parameter      | Type   | Required | Description           |
| -------------- | ------ | -------- | --------------------- |
| `leaf_user_id` | string | Yes      | UUID of the Leaf user |
| `field_id`     | string | Yes      | UUID of the field     |

***

## Field Operations

### `list_operations`

Returns a paginated list of field operations for a Leaf user. Supports filtering by provider, time range, operation type, and field.

| Parameter        | Type    | Required | Description                                                                        |
| ---------------- | ------- | -------- | ---------------------------------------------------------------------------------- |
| `leaf_user_id`   | string  | Yes      | UUID of the Leaf user                                                              |
| `provider`       | string  | No       | `CNHI`, `JohnDeere`, `Trimble`, `ClimateFieldView`, `AgLeader`, `Stara`, or `Leaf` |
| `start_time`     | string  | No       | ISO-8601 timestamp; operations starting on or after this time                      |
| `updated_time`   | string  | No       | ISO-8601 timestamp; operations updated on or after this time                       |
| `end_time`       | string  | No       | ISO-8601 timestamp; operations ending on or before this time                       |
| `operation_type` | string  | No       | `applied`, `planted`, `harvested`, or `tillage`                                    |
| `field_id`       | string  | No       | UUID of the field                                                                  |
| `page`           | integer | No       | Zero-based page number (default `0`)                                               |
| `size`           | integer | No       | Page size, max 100 (default `10`)                                                  |
| `sort`           | string  | No       | Comma-separated sort fields with optional `,asc` or `,desc` suffix                 |

### `get_operation`

Returns details for a single field operation.

| Parameter      | Type   | Required | Description                 |
| -------------- | ------ | -------- | --------------------------- |
| `operation_id` | string | Yes      | UUID of the field operation |

### `get_operation_summary`

Returns the GeoJSON summary for a field operation.

| Parameter      | Type   | Required | Description                 |
| -------------- | ------ | -------- | --------------------------- |
| `operation_id` | string | Yes      | UUID of the field operation |

### `get_operation_units`

Returns the unit map for a field operation (what units each property uses).

| Parameter      | Type   | Required | Description                 |
| -------------- | ------ | -------- | --------------------------- |
| `operation_id` | string | Yes      | UUID of the field operation |

***

## Machine Files

### `list_files`

Returns a paginated list of machine files with optional filters. Machine files are the raw data files from providers that Leaf processes into standardized field operations.

| Parameter         | Type    | Required | Description                                                                                          |
| ----------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------- |
| `leaf_user_id`    | string  | No       | UUID of the Leaf user                                                                                |
| `provider`        | string  | No       | `CNHI`, `JohnDeere`, `Trimble`, `ClimateFieldView`, `AgLeader`, `RavenSlingshot`, `Stara`, or `Leaf` |
| `status`          | string  | No       | `processed`, `failed`, or `processing`                                                               |
| `origin`          | string  | No       | `provider`, `automerged`, `merged`, or `uploaded`                                                    |
| `organization_id` | string  | No       | Provider organization ID (John Deere only)                                                           |
| `batch_id`        | string  | No       | UUID of the batch upload                                                                             |
| `created_time`    | string  | No       | ISO-8601 timestamp; files created on or after this time                                              |
| `start_time`      | string  | No       | ISO-8601 timestamp; operation started on or after this time                                          |
| `updated_time`    | string  | No       | ISO-8601 timestamp; files updated on or after this time                                              |
| `end_time`        | string  | No       | ISO-8601 timestamp; operation ended on or before this time                                           |
| `operation_type`  | string  | No       | `applied`, `planted`, `harvested`, or `tillage`                                                      |
| `min_area`        | float   | No       | Minimum operation area in square meters                                                              |
| `page`            | integer | No       | Zero-based page number (default `0`)                                                                 |
| `size`            | integer | No       | Page size, max 100 (default `10`)                                                                    |
| `sort`            | string  | No       | Comma-separated sort fields with optional `,asc` or `,desc` suffix                                   |

### `get_file`

Returns details for a single machine file.

| Parameter | Type   | Required | Description              |
| --------- | ------ | -------- | ------------------------ |
| `file_id` | string | Yes      | UUID of the machine file |

### `get_file_summary`

Returns the summary for a machine file.

| Parameter | Type   | Required | Description              |
| --------- | ------ | -------- | ------------------------ |
| `file_id` | string | Yes      | UUID of the machine file |

### `get_file_units`

Returns the unit map for a machine file.

| Parameter | Type   | Required | Description              |
| --------- | ------ | -------- | ------------------------ |
| `file_id` | string | Yes      | UUID of the machine file |

### `get_file_status`

Returns the processing status for every step of Leaf's pipeline for a machine file. Each step reports `processed`, `processing`, or `failed`.

Pipeline steps: `standardGeojson`, `cleanupGeojson`, `areaAndYield`, `summary`, `units`, `originalFile`.

| Parameter | Type   | Required | Description              |
| --------- | ------ | -------- | ------------------------ |
| `file_id` | string | Yes      | UUID of the machine file |

***

## Batch Uploads

### `list_batches`

Returns a paginated list of manual-upload batches.

| Parameter      | Type    | Required | Description                                                        |
| -------------- | ------- | -------- | ------------------------------------------------------------------ |
| `leaf_user_id` | string  | No       | UUID of the Leaf user                                              |
| `provider`     | string  | No       | Provider name (e.g., `JohnDeere`, `AgLeader`, `Trimble`)           |
| `status`       | string  | No       | `RECEIVED`, `PROCESSING`, `PROCESSED`, or `FAILED`                 |
| `page`         | integer | No       | Zero-based page number (default `0`)                               |
| `size`         | integer | No       | Page size, max 100 (default `10`)                                  |
| `sort`         | string  | No       | Comma-separated sort fields with optional `,asc` or `,desc` suffix |

### `get_batch`

Returns details for a single batch upload.

| Parameter  | Type   | Required | Description       |
| ---------- | ------ | -------- | ----------------- |
| `batch_id` | string | Yes      | UUID of the batch |

### `get_batch_status`

Returns the processing status of all files inside a batch.

| Parameter  | Type   | Required | Description       |
| ---------- | ------ | -------- | ----------------- |
| `batch_id` | string | Yes      | UUID of the batch |

***

## Weather

Weather tools come in two flavors: **field-based** (pass a Leaf user ID and field ID) and **coordinate-based** (pass latitude and longitude). Each flavor supports daily and hourly granularity for both forecasts and historical data. That's eight tools total.

All weather tools share these optional parameters:

| Parameter    | Type   | Required | Description                                                           |
| ------------ | ------ | -------- | --------------------------------------------------------------------- |
| `start_time` | string | No       | Start of the time range (`YYYY-MM-DD` for daily, ISO-8601 for hourly) |
| `end_time`   | string | No       | End of the time range                                                 |
| `model`      | string | No       | Weather model to use                                                  |
| `units`      | string | No       | Unit system for results                                               |

### Field-based weather

These tools require `leaf_user_id` (string) and `field_id` (string), plus the shared optional parameters above.

| Tool                                  | Granularity | Data       |
| ------------------------------------- | ----------- | ---------- |
| `get_weather_forecast_field_daily`    | Daily       | Forecast   |
| `get_weather_forecast_field_hourly`   | Hourly      | Forecast   |
| `get_weather_historical_field_daily`  | Daily       | Historical |
| `get_weather_historical_field_hourly` | Hourly      | Historical |

### Coordinate-based weather

These tools require `lat` (float) and `lon` (float), plus the shared optional parameters above.

| Tool                                    | Granularity | Data       |
| --------------------------------------- | ----------- | ---------- |
| `get_weather_forecast_lat_lon_daily`    | Daily       | Forecast   |
| `get_weather_forecast_lat_lon_hourly`   | Hourly      | Forecast   |
| `get_weather_historical_lat_lon_daily`  | Daily       | Historical |
| `get_weather_historical_lat_lon_hourly` | Hourly      | Historical |

***

## Billing

### `list_billing_contracts`

Returns all billing contracts for the authenticated API owner. Each contract includes product type, start/end dates, and quota.

Contract product types:

* `AUDIT_FIELDS_BOUNDARY` — active field boundary area (not bounded by contract dates)
* `FIELDS_BOUNDARY` — field boundary area consumption within the contract period
* `FIELDS_BOUNDARY_SENTERA` — Sentera-exclusive field boundary area
* `OPERATIONS_FILE` — machine file area consumption
* `OPERATIONS_OPERATION` — field operation area consumption
* `SATELLITE_PROCESS_PLANET` — Planet satellite imagery area
* `SATELLITE_PROCESS_SENTINEL` — Sentinel satellite imagery area

| Parameter | Type | Required | Description   |
| --------- | ---- | -------- | ------------- |
| —         | —    | —        | No parameters |

### `get_billing_contract`

Returns details for a specific billing contract.

| Parameter     | Type   | Required | Description          |
| ------------- | ------ | -------- | -------------------- |
| `contract_id` | string | Yes      | UUID of the contract |

### `get_contract_consumption`

Returns consumption metrics for a contract. Defaults to the current day if no timestamp is specified.

| Parameter     | Type   | Required | Description                                                        |
| ------------- | ------ | -------- | ------------------------------------------------------------------ |
| `contract_id` | string | Yes      | UUID of the contract                                               |
| `timestamp`   | string | No       | ISO-8601 timestamp (`YYYY-MM-DDTHH:MM:SS.sssZ`) for a specific day |

### `get_contract_consumption_range_api_owner`

Returns daily consumption breakdown for the API owner over a time range.

| Parameter     | Type   | Required | Description                   |
| ------------- | ------ | -------- | ----------------------------- |
| `contract_id` | string | Yes      | UUID of the contract          |
| `start_time`  | string | Yes      | Start time in ISO-8601 format |
| `end_time`    | string | Yes      | End time in ISO-8601 format   |

### `get_contract_consumption_range_leaf_user`

Returns daily consumption breakdown for a specific Leaf user over a time range.

| Parameter             | Type   | Required | Description                   |
| --------------------- | ------ | -------- | ----------------------------- |
| `contract_id`         | string | Yes      | UUID of the contract          |
| `target_leaf_user_id` | string | Yes      | UUID of the Leaf user         |
| `start_time`          | string | Yes      | Start time in ISO-8601 format |
| `end_time`            | string | Yes      | End time in ISO-8601 format   |
