MCP Control
Файлы и медиа · Изменение

Медиа · Подготовка · Загрузка

media_prepare_upload
Фотокамера и образцы цвета

Попробуйте три запроса

Подготовить
  1. Вы указываетеОбъект
  2. ПомощникПодготовка
  3. Вы получаетеПредпросмотр
Запрос в чат
Подготовь «Медиа / Подготовка / Загрузка». Для изменения нужны entityType, объект. Покажи объект и ожидаемый эффект до выполнения.
Что входит в подготовку
entityType
Параметр
entityId
Объект
mimeType
Параметр
Применить
  1. Вы указываетеСогласованные значения
  2. ПомощникОдин вызов
  3. Вы получаетеОтвет операции
Запрос в чат
На учебной записи подготовь «Медиа / Подготовка / Загрузка» с параметром entityType = customer. Покажи остальные обязательные значения и выполни действие, когда согласованы все поля.
Фрагмент учебных параметров
entityType
customer
mimeType
image/jpeg
entityId
DEMO-101
Проверить итог
  1. Вы указываетеИсходный ответ
  2. ПомощникСверка результата
  3. Вы получаетеПодтверждение
Запрос в чат
Проверь результат «Медиа / Подготовка / Загрузка» по исходному ответу. Покажи mediaId, uploadUrl. Объясни, чем подтвердить эффект для выбранного объекта.
Как проследить одну попытку
  1. ЗапросСохранить исходный ключ
  2. ОтветПроверить статус
  3. ПроверкаСверить эффект операции
Как работает действие

Этот вызов может изменить рабочие данные. Согласуйте точный объект, новые значения и ожидаемый результат. Присвойте операции стабильный requestId. При повторе той же операции используйте прежний ключ и те же значения.

Описание разработчика

Prepare a single image upload linked to an existing accessible entity. The returned 15-minute upload-only URL accepts the exact raw image without a second OAuth login; keep it private. Never put binary or base64 in tool arguments. Accepts JPEG, PNG and WebP up to 8 MiB. For a product, confirm completion with media_get_upload_status, then use catalog_products_attach_managed_image and verify Product.Photos with catalog_products_get. Retrying the same request is safe. For storefront product photos and videos, use the single catalog_products_upload_media action: prepare, PUT original parts, then complete with uploadId (Control retrieves the current revision). For completed private/managed media use complete with fileId or mediaId.

Параметры запроса
entityType
Existing entity type. For a Team avatar use employee and the exact employeeId from employees_search/services_team, then attach the completed image with staff_employee_avatar_set. The server verifies tenant ownership, location access and entity permissions. обязательно по схеме · string · варианты customer, lead, task, order, product, company, employee
entityId
Canonical entity identifier returned by the corresponding search or get action; never a Storage path. обязательно по схеме · string · до символов 128
mimeType
Actual image MIME type, checked against file signature and decoder; SVG and arbitrary files are not accepted. обязательно по схеме · string · варианты image/jpeg, image/png, image/webp
byteLength
Exact number of bytes in the source image, at most 8 MiB; the uploaded binary must have this length. обязательно по схеме · integer · максимум 8388608
requestId
Ключ этой операции. Для повтора с теми же аргументами сохраните исходное значение. обязательно по схеме · string · до символов 128
Что вернёт команда
mediaId
Server-issued media identifier. обязательно по схеме · string
uploadUrl
Short-lived PUT URL for raw file bytes, outside the LLM context. Treat it as a secret until expiration. обязательно по схеме · string
method
HTTP method required by the upload endpoint. обязательно по схеме · string
mimeType
Actual image MIME type, checked against file signature and decoder; SVG and arbitrary files are not accepted. обязательно по схеме · string · варианты image/jpeg, image/png, image/webp
byteLength
Exact required source byte count. обязательно по схеме · integer · минимум -9007199254740991 · максимум 9007199254740991
expiresAt
UTC deadline for submitting this prepared upload. обязательно по схеме · string
status
Whether this request still requires bytes or has already completed. обязательно по схеме · string · варианты prepared, completed
Поля и технические схемы
Входные поля и поля ответа media_prepare_upload
Вход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "entityType": {
      "type": "string",
      "enum": [
        "customer",
        "lead",
        "task",
        "order",
        "product",
        "company",
        "employee"
      ],
      "description": "Existing entity type. For a Team avatar use employee and the exact employeeId from employees_search/services_team, then attach the completed image with staff_employee_avatar_set. The server verifies tenant ownership, location access and entity permissions."
    },
    "entityId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Canonical entity identifier returned by the corresponding search or get action; never a Storage path."
    },
    "mimeType": {
      "type": "string",
      "enum": [
        "image/jpeg",
        "image/png",
        "image/webp"
      ],
      "description": "Actual image MIME type, checked against file signature and decoder; SVG and arbitrary files are not accepted."
    },
    "byteLength": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 8388608,
      "description": "Exact number of bytes in the source image, at most 8 MiB; the uploaded binary must have this length."
    },
    "requestId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_-]+$",
      "description": "Caller-generated retry identifier using letters, digits, underscores or hyphens. Reuse only for this exact upload declaration; no image bytes or base64 belong in the tool request."
    }
  },
  "required": [
    "entityType",
    "entityId",
    "mimeType",
    "byteLength",
    "requestId"
  ],
  "additionalProperties": false
}
Выход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "mediaId": {
      "type": "string",
      "description": "Server-issued media identifier."
    },
    "uploadUrl": {
      "type": "string",
      "format": "uri",
      "description": "Short-lived PUT URL for raw file bytes, outside the LLM context. Treat it as a secret until expiration."
    },
    "method": {
      "type": "string",
      "const": "PUT",
      "description": "HTTP method required by the upload endpoint."
    },
    "mimeType": {
      "type": "string",
      "enum": [
        "image/jpeg",
        "image/png",
        "image/webp"
      ],
      "description": "Actual image MIME type, checked against file signature and decoder; SVG and arbitrary files are not accepted."
    },
    "byteLength": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Exact required source byte count."
    },
    "expiresAt": {
      "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))$",
      "description": "UTC deadline for submitting this prepared upload."
    },
    "status": {
      "type": "string",
      "enum": [
        "prepared",
        "completed"
      ],
      "description": "Whether this request still requires bytes or has already completed."
    }
  },
  "required": [
    "mediaId",
    "uploadUrl",
    "method",
    "mimeType",
    "byteLength",
    "expiresAt",
    "status"
  ],
  "additionalProperties": false
}