# הכנת פעולת קהילה

כתובת URL קנונית: https://sosoapi.ai/he/docs/mcp/prepare-community-action

`sosoapi_prepare_community_action`

קישור גרסת בדיקה לפעולה אחת (reply, hide או unhide) וקבלת prepare_token לזמן קצר עבור sosoapi_apply_community_action. עדיין לא נשלח דבר.

## פרופילים ואמצעי תעבורה

פרופילים: full

אמצעי תעבורה: stdio, http

בחרו core או full כדי לשלוט בכלים שהלקוח רואה; הבחירה אינה משנה את ההרשאות שלו. העלאת קבצים מקומיים דורשת stdio ואינה זמינה דרך HTTP. הגדירו SOSOAPI_OUTPUT_SCHEMAS=1 להכללת סכמות פלט בגילוי הכלים. הכלים מחזירים תוצאות מובנות עם ההגדרה הזו או בלעדיה.

## הרשאות והשפעות לוואי

הערות המטא-נתונים עוזרות ללקוחות לתאר כלי. כל קריאה עדיין בודקת את אימות המשתמש, תפקידו, גישתו למשאבים והרשאות היכולות שלו.

```json
{
  "readOnlyHint": false,
  "destructiveHint": false,
  "idempotentHint": true,
  "openWorldHint": false
}
```

`/community-engagement-api/actions/prepare` — agent:engage; synchronous_http_response

## שדות קלט

```json
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid"
    },
    "review_id": {
      "type": "string",
      "format": "uuid"
    },
    "expected_review_version": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "action": {
      "type": "string",
      "enum": [
        "reply",
        "hide",
        "unhide"
      ]
    },
    "reply_draft": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "idempotency_key": {
      "type": "string",
      "format": "uuid"
    }
  },
  "required": [
    "workspace_id",
    "review_id",
    "expected_review_version",
    "action",
    "idempotency_key"
  ],
  "additionalProperties": false
}
```

## פלט מובנה

הסכמה מתארת את structuredContent בתוצאת כלי מוצלחת. תגובת MCP כוללת גם content ועשויה להגדיר isError כשקריאה נכשלת. בפרסום, קראו את התוצאה הסופית של הפוסט במקום לראות בבקשה שהתקבלה או בתגובת טקסט אישור. פעולת ה-API המקושרת מסבירה הרשאות וכללי ניסיון חוזר.

```json
{
  "type": "object",
  "properties": {
    "contract_version": {
      "type": "string",
      "const": "community-engagement/v1"
    },
    "prepared": {
      "type": "object",
      "properties": {
        "prepare_token": {
          "type": "string",
          "format": "uuid"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "binding": {
          "type": "object",
          "properties": {
            "workspace_id": {
              "type": "string",
              "format": "uuid"
            },
            "social_account_id": {
              "type": "string",
              "format": "uuid"
            },
            "social_post_id": {
              "type": "string",
              "format": "uuid"
            },
            "social_comment_id": {
              "type": "string",
              "format": "uuid"
            },
            "platform": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "threads",
                "youtube"
              ]
            },
            "provider_post_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "provider_comment_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "action": {
              "type": "string",
              "enum": [
                "reply",
                "hide",
                "unhide"
              ]
            },
            "desired_hidden": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            },
            "draft_sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "idempotency_key": {
              "type": "string",
              "format": "uuid"
            }
          },
          "required": [
            "workspace_id",
            "social_account_id",
            "social_post_id",
            "social_comment_id",
            "platform",
            "provider_post_id",
            "provider_comment_id",
            "action",
            "desired_hidden",
            "draft_sha256",
            "idempotency_key"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "prepare_token",
        "expires_at",
        "binding"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "contract_version",
    "prepared"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## דוגמת קריאה לכלי

הדוגמאות משתמשות בערכים בדויים שנבדקו מול הסכמות. החליפו את המזהים בכאלה שאתם מורשים להשתמש בהם, את המדיה בנכסים מוכנים ואת התאריכים במועד הפרסום שאישרתם. בדקו את התאמת החשבון לפני שליחת כתיבה. העמוד הזה אינו שולח בקשות API.

```json
{
  "name": "sosoapi_prepare_community_action",
  "arguments": {
    "workspace_id": "11111111-1111-4111-8111-111111111111",
    "review_id": "11111111-1111-4111-8111-111111111111",
    "expected_review_version": 1,
    "action": "reply",
    "idempotency_key": "11111111-1111-4111-8111-111111111111",
    "reply_draft": "Thank you for the feedback. Our team will follow up."
  }
}
```

structuredContent

```json
{
  "contract_version": "community-engagement/v1",
  "prepared": {
    "prepare_token": "11111111-1111-4111-8111-111111111111",
    "expires_at": "2099-01-15T09:00:00Z",
    "binding": {
      "workspace_id": "11111111-1111-4111-8111-111111111111",
      "social_account_id": "11111111-1111-4111-8111-111111111111",
      "social_post_id": "11111111-1111-4111-8111-111111111111",
      "social_comment_id": "11111111-1111-4111-8111-111111111111",
      "platform": "facebook",
      "provider_post_id": "example",
      "provider_comment_id": "example",
      "action": "reply",
      "desired_hidden": null,
      "draft_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "idempotency_key": "11111111-1111-4111-8111-111111111111"
    }
  }
}
```

## פעולות ה-API שבבסיס הכלי

- [/community-engagement-api/actions/prepare](https://sosoapi.ai/he/docs/api/community-engagement-api-actions-prepare)
