# FlowStudio MCP — Trigger Types

Copy-paste trigger definitions for Power Automate flow definitions.

---

## Recurrence

Run on a schedule.

```json
"Recurrence": {
  "type": "Recurrence",
  "recurrence": {
    "frequency": "Day",
    "interval": 1,
    "startTime": "2026-01-01T08:00:00Z",
    "timeZone": "AUS Eastern Standard Time"
  }
}
```

Weekly on specific days:
```json
"Recurrence": {
  "type": "Recurrence",
  "recurrence": {
    "frequency": "Week",
    "interval": 1,
    "schedule": {
      "weekDays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
    },
    "startTime": "2026-01-05T09:00:00Z",
    "timeZone": "AUS Eastern Standard Time"
  }
}
```

Common `timeZone` values:
- `"AUS Eastern Standard Time"` — Sydney/Melbourne (UTC+10/+11)
- `"UTC"` — Universal time
- `"E. Australia Standard Time"` — Brisbane (UTC+10 no DST)
- `"New Zealand Standard Time"` — Auckland (UTC+12/+13)
- `"Pacific Standard Time"` — Los Angeles (UTC-8/-7)
- `"GMT Standard Time"` — London (UTC+0/+1)

---

## Manual (HTTP Request / Power Apps)

Receive an HTTP POST with a JSON body.

```json
"manual": {
  "type": "Request",
  "kind": "Http",
  "inputs": {
    "schema": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "value": { "type": "integer" }
      },
      "required": ["name"]
    }
  }
}
```

Access values: `@triggerBody()?['name']`  
Trigger URL available after saving: `@listCallbackUrl()`

#### No-Schema Variant (Accept Arbitrary JSON)

When the incoming payload structure is unknown or varies, omit the schema
to accept any valid JSON body without validation:

```json
"manual": {
  "type": "Request",
  "kind": "Http",
  "inputs": {
    "schema": {}
  }
}
```

Access any field dynamically: `@triggerBody()?['anyField']`

> Use this for external webhooks (Stripe, GitHub, Employment Hero, etc.) where the
> payload shape may change or is not fully documented. The flow accepts any
> JSON without returning 400 for unexpected properties.

---

## Manual (Copilot Studio Skills)

Use the Skills trigger when the flow is meant to be called by a Copilot Studio
agent tool. Keep the trigger schema explicit so the agent receives predictable
input names and types.

```json
"manual": {
  "type": "Request",
  "kind": "Skills",
  "inputs": {
    "schema": {
      "type": "object",
      "properties": {
        "itemId": { "type": "string" },
        "notes": { "type": "string" }
      },
      "required": ["itemId"]
    }
  },
  "metadata": {
    "operationMetadataId": "<stable-guid>"
  }
}
```

After deploying a production Skills-triggered flow, call `add_to_solution`
with `flowName` and `solution` (the solution's unique name or id); Copilot
Studio agent tool discovery expects the flow to be solution-aware. To test it from MCP, call
`trigger_live_flow` with the inputs in `body` — Skills triggers run through the
connector runtime the same way Button and PowerApps triggers do.

---

## Automated (SharePoint Item Created)

A polling trigger: it checks the list on its `recurrence` and fires once per new
item (`splitOn`). Get `table` (the list id) from `resolve_live_parameters` with
`match` on the list name.

```json
"When_an_item_is_created": {
  "type": "OpenApiConnection",
  "recurrence": { "frequency": "Minute", "interval": 1 },
  "splitOn": "@triggerBody()?['value']",
  "inputs": {
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
      "connectionName": "<connectionName>",
      "operationId": "GetOnNewItems"
    },
    "parameters": {
      "dataset": "https://mytenant.sharepoint.com/sites/mysite",
      "table": "MyList"
    }
  }
}
```

Access trigger data: `@triggerBody()?['ID']`, `@triggerBody()?['Title']`, etc.

---

## Automated (SharePoint Item Created or Modified)

Same polling shape with `GetOnUpdatedItems`: it fires when an item is created
and each time it is modified. For modified only, describe `GetOnChangedItems`
("When an item or a file is modified") with `describe_live_connector` first.

```json
"When_an_item_is_created_or_modified": {
  "type": "OpenApiConnection",
  "recurrence": { "frequency": "Minute", "interval": 1 },
  "splitOn": "@triggerBody()?['value']",
  "inputs": {
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
      "connectionName": "<connectionName>",
      "operationId": "GetOnUpdatedItems"
    },
    "parameters": {
      "dataset": "https://mytenant.sharepoint.com/sites/mysite",
      "table": "MyList"
    }
  }
}
```

---

## Automated (Outlook: When New Email Arrives)

`OnNewEmailV3` ("When a new email arrives (V3)"). All its inputs are optional:
`folderPath` (default `Inbox`), `to`, `cc`, `toOrCc`, `from`, `subjectFilter`,
`importance`, `includeAttachments`, `fetchOnlyWithAttachment`. For a shared
mailbox, use `SharedMailboxOnNewEmailV2`.

```json
"When_a_new_email_arrives": {
  "type": "OpenApiConnectionNotification",
  "splitOn": "@triggerOutputs()?['body/value']",
  "inputs": {
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
      "connectionName": "<connectionName>",
      "operationId": "OnNewEmailV3"
    },
    "parameters": {
      "folderPath": "Inbox",
      "to": "monitored@contoso.com",
      "importance": "Any",
      "includeAttachments": false
    }
  }
}
```

---

## Child Flow (Called by Another Flow)

```json
"manual": {
  "type": "Request",
  "kind": "Button",
  "inputs": {
    "schema": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": { "type": "object" }
        }
      }
    }
  }
}
```

Access parent-supplied data: `@triggerBody()?['items']`

To return data to the parent, add a `Response` action:
```json
"Respond_to_Parent": {
  "type": "Response",
  "runAfter": { "Compose_Result": ["Succeeded"] },
  "inputs": {
    "statusCode": 200,
    "body": "@outputs('Compose_Result')"
  }
}
```
