# 请求平台洞察

标准 URL： https://sosoapi.ai/zh-hans/docs/mcp/request-provider-insights

`sosoapi_request_provider_insights`

请求平台提供某账号或单篇帖子的洞察，可指定日期范围（最多 366 天）。返回 request_id，命中缓存时也返回结果；否则轮询 sosoapi_get_provider_insight_status。

## 配置与传输方式

配置：core、full

传输方式：stdio、http

选择 core 或 full 以控制客户端显示的工具；这不会变更权限。本地文件上传需要 stdio，无法通过 HTTP 使用。设置 SOSOAPI_OUTPUT_SCHEMAS=1 可在探索结果加入输出schema。无论是否启用此设置，工具皆会返回结构化结果。

## 权限与副作用

注解帮助客户端描述工具。每次调用仍会检查用户身份验证、角色、资源访问和能力授权。

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

`/analytics-api/provider-insights/request` — agent:operate；平台原生结果或明确的不可用原因

## 输入字段

```json
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid"
    },
    "social_account_id": {
      "type": "string",
      "format": "uuid"
    },
    "resource_kind": {
      "type": "string",
      "enum": [
        "account",
        "post"
      ]
    },
    "provider_resource_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "start_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "end_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "include_audience": {
      "type": "boolean"
    },
    "refresh": {
      "type": "boolean"
    }
  },
  "required": [
    "workspace_id",
    "social_account_id",
    "resource_kind"
  ],
  "additionalProperties": false
}
```

## 结构化输出

此 schema 描述成功工具结果中的 structuredContent。MCP 响应也包含 content，并可能在调用失败时设置 isError。对于发布，请读取帖子的最终结果，不要把获接受的请求或文字响应当作确认。链接的 API 操作说明了权限和重试规则。

```json
{
  "type": "object",
  "properties": {
    "contract_version": {
      "type": "string",
      "const": "provider-insights/v1"
    },
    "request_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "completed"
      ]
    },
    "cache_status": {
      "type": "string",
      "enum": [
        "hit",
        "miss",
        "bypassed"
      ]
    },
    "poll_after_ms": {
      "type": "integer",
      "minimum": 0,
      "maximum": 60000
    },
    "result": {
      "type": "object",
      "properties": {
        "contract_version": {
          "type": "string",
          "const": "provider-insights/v1"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "platform": {
          "type": "string",
          "enum": [
            "facebook",
            "instagram",
            "threads",
            "youtube"
          ]
        },
        "resource": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "account",
                "post"
              ]
            },
            "social_account_id": {
              "type": "string",
              "format": "uuid"
            },
            "provider_resource_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "kind",
            "social_account_id",
            "provider_resource_id"
          ],
          "additionalProperties": false
        },
        "provider_api_version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "fetched_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)))$"
        },
        "status": {
          "type": "string",
          "enum": [
            "available",
            "partial",
            "unavailable"
          ]
        },
        "availability": {
          "minItems": 1,
          "maxItems": 64,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "scope": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "status": {
                "type": "string",
                "enum": [
                  "available",
                  "partial",
                  "not_returned",
                  "unsupported",
                  "permission_required",
                  "threshold_not_met",
                  "no_data",
                  "failed"
                ]
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "scope",
              "status"
            ],
            "additionalProperties": false
          }
        },
        "provider_data": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ]
        },
        "requested_date_range": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "start_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "end_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                }
              },
              "required": [
                "start_date",
                "end_date"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "cache": {
          "type": "object",
          "properties": {
            "authoritative": {
              "type": "boolean",
              "const": false
            },
            "status": {
              "type": "string",
              "enum": [
                "stored",
                "hit",
                "bypassed"
              ]
            },
            "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)))$"
            }
          },
          "required": [
            "authoritative",
            "status",
            "expires_at"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "contract_version",
        "request_id",
        "platform",
        "resource",
        "provider_api_version",
        "fetched_at",
        "status",
        "availability",
        "provider_data",
        "requested_date_range",
        "cache"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "contract_version",
    "request_id",
    "status",
    "cache_status",
    "poll_after_ms"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## 工具调用示例

这些示例使用已依schema检查的虚构值。请将 ID 替换为你有权使用的 ID、将媒体替换为已就绪素材，并将日期替换为已确认的发布时间。提交写入前，请检查账号资格。本页不会发送 API 请求。

```json
{
  "name": "sosoapi_request_provider_insights",
  "arguments": {
    "workspace_id": "11111111-1111-4111-8111-111111111111",
    "social_account_id": "11111111-1111-4111-8111-111111111111",
    "resource_kind": "account"
  }
}
```

structuredContent

```json
{
  "contract_version": "provider-insights/v1",
  "request_id": "11111111-1111-4111-8111-111111111111",
  "status": "queued",
  "cache_status": "hit",
  "poll_after_ms": 0
}
```

## 底层 API 操作

- [/analytics-api/provider-insights/request](https://sosoapi.ai/zh-hans/docs/api/analytics-api-provider-insights-request)
