> ## 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

> سير عمل نهائي لمهام Flowstep MCP الشائعة.

## 1. إنشاء شاشة ومعاينتها

سير العمل الأكثر شيوعًا: إنشاء شاشة (إنشاء الملف في نفس الخطوة)، ثم عرض النتيجة.

```
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]
```

إغفال `fileId` ينشئ ملفًا جديدًا تلقائيًا. مرر `fileId` موجودًا لإضافة شاشات لهذا الملف بدلاً من ذلك.

**موجه لمساعدك الذكي:**

> 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. تصور مكون React

قم بتحميل ملف `.jsx` أو `.tsx` كمرفق واطلب من Flowstep إنشاء تصميم مطابق. يقرأ Flowstep المصدر وينتج شاشة — لا حاجة لتشغيل التطبيق.

```
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]
```

**موجه لمساعدك الذكي:**

> 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. تحسين شاشة تم إنشاؤها بواسطة MCP

يتطلب `edit-design` و`regenerate-design` سياق التصميم الذي يوجد فقط على الشاشات المنشأة باستخدام مصفوفة `designs`. بالنسبة للشاشات التي تم إنشاؤها بدونها، الحل البديل هو تحويل الشاشة إلى صورة واستدعاء `create-new-design` مع الصورة.

```
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]
```

بالنسبة للشاشات التي تحتوي على سياق التصميم، استدعِ `edit-design` مباشرة مع التغيير في `message` والشاشة في `targets`.

***

## 4. توسيع شاشة إلى تدفق كامل

أضف الشاشات التالية إلى التصميم الموجود.

```
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]
```

كرر الخطوة 2 مع `operationVariant: "error_state"` أو `"empty_state"` لإضافة شاشات الحالات الخاصة.

<Note>
  `operationVariant` هو معامل مطلوب لـ `expand-design`. يجب أيضًا أن تكون الشاشة الأساسية قد تم إنشاؤها باستخدام مصفوفة `designs` (سياق التصميم) — بالنسبة للشاشات بدونها، استخدم حل المرفق من المثال 3.
</Note>

***

## 5. فحص الحصة قبل مهمة دفعية

تحقق من السعة المتبقية قبل بدء عمليات التوليد المتعددة.

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

إذا كانت `daily` منخفضة، جدول المهمة الدفعية بعد 00:00 UTC عندما تعاد تعيينها.
