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

# MCP-esimerkit

> Täydellisiä työnkulkuja yleisiin Flowstep MCP -tehtäviin.

## 1. Luo ja esikatsele näyttö

Yleisin työnkulku: luo näyttö (luo tiedoston samalla kerralla) ja katso tulos.

```
1. create-new-design { "message": "Mobile sign-in screen for a developer tool.
                                  Email/password fields, Google SSO button, dark theme." }
                     → { "fileId": "FILE_ID", "screenIds": ["SCREEN_ID"] }

2. get-screen-image  { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                     → [inline PNG]
```

Jos jätät `fileId`-parametrin pois, luodaan uusi tiedosto automaattisesti. Välitä olemassa olevan `fileId`-parametrin arvo lisätäksesi näyttöjä siihen tiedostoon.

**Kehote tekoälyassistenttillesi:**

> Generate a Flowstep design: a mobile sign-in screen for a developer tool with email/password and a Google SSO button in dark theme, then show me the image.

***

## 2. Visualisoi React-komponentti

Lataa `.jsx`- tai `.tsx`-tiedosto liitteenä ja pyydä Flowstepiä luomaan vastaava suunnittelu. Flowstep lukee lähdekodin ja tuottaa näytön – sinun ei tarvitse käynnistää sovellusta.

```
1. upload-attachment  { "fileData": "<UTF-8 contents of ApiKeys.tsx>",
                        "fileName": "ApiKeys.tsx",
                        "mimeType": "text/javascript" }
                      → { "id": "ATT_ID", "path": "...", "type": "document",
                          "mimeType": "text/javascript" }

2. create-new-design  { "message": "Generate a desktop screen that matches this React component.",
                        "attachments": [{ "id": "ATT_ID", "path": "...", "type": "document" }] }
                      → { "fileId": "FILE_ID", "screenIds": ["SCREEN_ID"] }

3. get-screen-image   { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                      → [inline PNG]
```

**Kehote tekoälyassistenttillesi:**

> Read `src/components/settings/ApiKeys.tsx`, upload it as an attachment, and generate a Flowstep screen that matches the component layout. Show me the rendered image.

***

## 3. Muokkaa MCP-luotua näyttöä

`edit-design`- ja `regenerate-design`-toiminnot vaativat suunnittelun kontekstia, joka on olemassa vain näytöillä, jotka on luotu `designs`-taulukon kanssa. Näytöille, jotka on luotu ilman sitä, vaihtoehto on tehdä näytöstä liite ja kutsua `create-new-design` kuvalla.

```
1. upload-attachment  { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                      → { "id": "ATT_ID", "path": "...", "type": "image", "mimeType": "image/jpeg" }

2. create-new-design  { "fileId": "FILE_ID",
                        "message": "Change the color scheme to dark mode and
                                    add a 'Remember me' checkbox below the password field.",
                        "attachments": [{ "id": "ATT_ID", "path": "...", "type": "image" }] }
                      → { "fileId": "FILE_ID", "screenIds": ["NEW_SCREEN_ID"] }

3. get-screen-image   { "fileId": "FILE_ID", "screenId": "NEW_SCREEN_ID" }
                      → [inline PNG]
```

Näytöille, joissa on suunnittelun konteksti, kutsu `edit-design` suoraan muutoksella `message`-parametrissa ja näyttöä `targets`-parametrissa.

***

## 4. Laajenna näyttö täydeksi työnkuluksi

Lisää seuraavat näytöt olemassa olevaan suunnitteluun.

```
1. list-screens   { "fileId": "FILE_ID" }
                  → [{ "screenId": "BASE_SCREEN_ID", "prompt": "Sign-in screen", ... }]

2. expand-design  { "fileId": "FILE_ID",
                    "message": "Add the next screen in the user flow",
                    "operationVariant": "next_screen",
                    "targets": ["BASE_SCREEN_ID"] }
                  → { "fileId": "FILE_ID", "screenIds": ["NEXT_SCREEN_ID"] }

3. get-screen-image { "fileId": "FILE_ID", "screenId": "NEXT_SCREEN_ID" }
                    → [inline PNG]
```

Toista vaihe 2 parametreillä `operationVariant: "error_state"` tai `"empty_state"` lisätäksesi reunatapauksia varten tehtyjä näyttöjä.

<Note>
  `operationVariant` on pakollinen parametri `expand-design`-toiminnolle. Perusnäytön on oltava luotu myös `designs`-taulukon kanssa (suunnittelun konteksti) – näytöille ilman sitä käytä liitevaihtoehdon työnkulkua esimerkistä 3.
</Note>

***

## 5. Tarkista kiintiö ennen erätyötä

Tarkista jäljellä oleva kapasiteetti ennen useiden luontien aloittamista.

```
get-plan-details {}
→ {
    "remaining": {
      "messages": { "daily": 38, "monthly": 413 }
    }
  }
```

Jos `daily`-arvo on pieni, ajoita erä ajanhetkelle 00:00 UTC, jolloin se nollaantuu.
