Analyze Segment Upload
analyze_audience_uploadAfter uploading a file to the presigned upload_url (or all same-format shards to upload_urls) returned by create_segment(subtype=matched), call this to run LLM-assisted column mapping inference. For a sharded upload, analysis runs against the first shard only — every shard is assumed to share the same schema; a mismatch fails the batch job later with a specific error, not silently here. Returns: segment_id, analysis.columns[] (each: source_column, mapped_to, inferred_type, confidence 0–1, warning), analysis.unmapped_columns[] (column headers that could not be mapped), analysis.recommendations[] (human-readable tips to improve match rates). gzip is detected from file bytes, so a missing or incorrect compression declaration is self-healed during analysis. Returns typed 422 errors for malformed gzip, format mismatch, or malformed input, and 409 FILE_NOT_YET_UPLOADED before upload. The upload is staged (create_segment sets hitl:true) — nothing has started yet. Present these results to the user and wait for their response, then call confirm_column_mappings (to start resolution) or cancel_matched_upload (to abort) — do not call wait_for_segment before confirm_column_mappings succeeds. Requires 'discovery' scope.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"segment_id": "<segment_id>"
},
"name": "analyze_audience_upload"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| segment_id | Yes | The segment_id of the matched segment returned by create_segment(subtype=matched) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysis | Yes | ||
| guidance | No | Interpretation or recovery guidance for this result | |
| count_unit | No | ||
| page_count | No | Number of objects on this page, not the organization total | |
| segment_id | Yes | ||
| count_state | No | Unknown means no count; available does not guarantee freshness. Recount for a current value. | |
| next_actions | No | Suggested next calls using returned IDs and available scopes. Not executed and not user consent. | |
| population_input | No | Population input used for the preview; IDs refer to their current saved definitions |