Skip to main content
Glama

Analyze Segment Upload

analyze_audience_upload
Destructive

After 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.

Input Schema

NameRequiredDescriptionDefault
segment_idYesThe segment_id of the matched segment returned by create_segment(subtype=matched)

Output Schema

NameRequiredDescriptionDefault
analysisYes
guidanceNoInterpretation or recovery guidance for this result
count_unitNo
page_countNoNumber of objects on this page, not the organization total
segment_idYes
count_stateNoUnknown means no count; available does not guarantee freshness. Recount for a current value.
next_actionsNoSuggested next calls using returned IDs and available scopes. Not executed and not user consent.
money_displayNoCurrency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "analysis": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "columns": {
      +          "items": {
      +            "additionalProperties": {},
      +            "properties": {
      +              "source_column": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "source_column"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "recommendations": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        "unmapped_columns": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "columns",
      +        "unmapped_columns",
      +        "recommendations"
      +      ],
      +      "type": "object"
      +    },
      +    "count_state": {
      +      "description": "Unknown means no count; available does not guarantee freshness. Recount for a current value.",
      +      "enum": [
      +        "unknown",
      +        "available"
      +      ],
      +      "type": "string"
      +    },
      +    "count_unit": {
      +      "const": "records",
      +      "type": "string"
      +    },
      +    "guidance": {
      +      "description": "Interpretation or recovery guidance for this result",
      +      "type": "string"
      +    },
      +    "money_display": {
      +      "additionalProperties": {
      +        "type": "string"
      +      },
      +      "description": "Currency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "next_actions": {
      +      "description": "Suggested next calls using returned IDs and available scopes. Not executed and not user consent.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "arguments": {
      +            "additionalProperties": {},
      +            "propertyNames": {
      +              "type": "string"
      +            },
      +            "type": "object"
      +          },
      +          "reason": {
      +            "type": "string"
      +          },
      +          "tool": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "tool",
      +          "arguments",
      +          "reason"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "page_count": {
      +      "description": "Number of objects on this page, not the organization total",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "population_input": {
      +      "additionalProperties": {},
      +      "description": "Population input used for the preview; IDs refer to their current saved definitions",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "segment_id": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "segment_id",
      +    "analysis"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial behavior beyond the annotations: sharded uploads are analyzed against the first shard only, schema mismatch fails later with a specific error, gzip is detected from bytes and self-healed, typed 422 and 409 FILE_NOT_YET_UPLOADED errors are returned, the upload is staged with hitl:true, and discovery scope is required. These details materially help the agent understand state transitions and error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but well organized and front-loaded: it starts with the trigger condition, then covers shard behavior, return shape, errors, workflow state, next steps, and required scope. Every sentence contributes operational information for a complex workflow tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool participates in a staged upload-to-confirmation workflow, the description covers the necessary preconditions, expected return structure, error conditions, and sequencing with sibling tools. Although an output schema exists and return details are not strictly required, the added context makes the definition complete for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the only parameter segment_id is already documented in the schema as the matched segment returned by create_segment(subtype=matched). The description references the same origin but adds no extra parameter semantics beyond what the schema already provides, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific action (run LLM-assisted column mapping inference) on a specific resource (an uploaded matched-segment file), and ties it directly to the create_segment(subtype=matched) upload flow. It also clearly distinguishes this analysis step from confirm_column_mappings, cancel_matched_upload, and wait_for_segment.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to call this: after uploading to the presigned URL(s) from create_segment(subtype=matched). It also states the next steps in order, including presenting results to the user, waiting, then calling confirm_column_mappings or cancel_matched_upload, and explicitly warns not to call wait_for_segment before confirm_column_mappings succeeds.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources