[Cotlet](https://cotlet.dev/index.md) · [Integrations](https://cotlet.dev/integrations.md) · [How it works](https://cotlet.dev/how-it-works.md) · [Use cases](https://cotlet.dev/use-cases.md) · [Security](https://cotlet.dev/security.md) · [For developers](https://cotlet.dev/for-developers.md) · [For automation agencies](https://cotlet.dev/for-agencies.md) · [Blog](https://cotlet.dev/blog.md) · [API docs](https://cotlet.dev/docs.md) · [Help center](https://cotlet.dev/help.md) · [Changelog](https://cotlet.dev/changelog.md) · [Contact](https://cotlet.dev/contact.md) · [Pricing](https://cotlet.dev/pricing.md) · [Sign up](https://cotlet.dev/signup)

# Create segment

> Save a segment under Messaging > Segments from criteria joined with and or or. Input schema, a tools/call example and an example result.

Source: https://cotlet.dev/docs/mcp/postscript/create_segment

Docs sections: [Get started](https://cotlet.dev/docs.md) · [REST API](https://cotlet.dev/docs/api.md) · [MCP](https://cotlet.dev/docs/mcp.md) · [SDKs & CLI](https://cotlet.dev/docs/sdks.md) · [Integrations](https://cotlet.dev/docs/integrations.md)

Save a segment under Messaging > Segments from criteria joined with and or or.

Postscript MCP tools: https://cotlet.dev/docs/mcp/postscript.md

MCP tool: `postscript_write → create_segment`

Access: write.

Saves a segment from the criteria you give, each as a criterion name from the Segments editor, a parameter such as equals or before last, and a value. join is and or or and links an item to the one before it; the first item has none. Returns the Segment Size Postscript computes. It messages nobody and only saves the definition, so it does not wait for your OK. include_phone_only adds subscribers not yet linked to a Shopify customer, and purchase filters do not apply to them.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Segment name. |
| `criteria` | array | yes | List of {criterion, parameter, value, join}. join is and or or, absent on the first item. |
| `include_phone_only` | boolean | no | Include all phone-only subscribers. Default: false. |

## tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "postscript_write",
    "arguments": {
      "operation": "create_segment",
      "arguments": {
        "name": "Unengaged 180 days",
        "include_phone_only": false,
        "criteria": [
          {
            "criterion": "Number of Orders",
            "parameter": "equals",
            "value": "0"
          },
          {
            "join": "or",
            "criterion": "Last Order Date",
            "parameter": "before last",
            "value": "365 days"
          },
          {
            "join": "and",
            "criterion": "Subscriber Has Clicked",
            "parameter": "not equal to",
            "value": "TRUE"
          },
          {
            "join": "and",
            "criterion": "Subscriber Created Date",
            "parameter": "before last",
            "value": "180 days"
          },
          {
            "join": "and",
            "criterion": "Number of Replies",
            "parameter": "equals",
            "value": "0"
          }
        ]
      }
    }
  }
}
```

## Example response

```json
{
  "content": [
    {
      "type": "text",
      "text": "{ ... same JSON as structuredContent ... }"
    }
  ],
  "structuredContent": {
    "segment_id": "60418",
    "name": "Unengaged 180 days",
    "size": 3412,
    "include_phone_only": false
  },
  "isError": false
}
```

Previous: [List conversations](https://cotlet.dev/docs/mcp/postscript/list_conversations.md)
Next: [Create campaign draft](https://cotlet.dev/docs/mcp/postscript/create_campaign.md)

---

Give your AI agents your signed-in browser.

**Product:** [Integrations](https://cotlet.dev/integrations.md) · [Use cases](https://cotlet.dev/use-cases.md) · [How it works](https://cotlet.dev/how-it-works.md) · [Pricing](https://cotlet.dev/pricing.md) · [Security](https://cotlet.dev/security.md)

**Resources:** [Blog](https://cotlet.dev/blog.md) · [API docs](https://cotlet.dev/docs.md) · [Help center](https://cotlet.dev/help.md) · [Changelog](https://cotlet.dev/changelog.md) · [GitHub](https://github.com/cotletdev/cotlet)

**Solutions:** [For developers](https://cotlet.dev/for-developers.md) · [For automation agencies](https://cotlet.dev/for-agencies.md)

**Company:** [About](https://cotlet.dev/about.md) · [AI info: company facts](https://cotlet.dev/ai-info.md) · [Contact](https://cotlet.dev/contact.md)

**Legal:** [Terms of service](https://cotlet.dev/terms) · [Privacy policy](https://cotlet.dev/privacy) · [Refund policy](https://cotlet.dev/refunds) · [Acceptable use](https://cotlet.dev/acceptable-use) · [Cookie policy](https://cotlet.dev/cookies) · [DPA](https://cotlet.dev/dpa) · [Subprocessors](https://cotlet.dev/subprocessors)

**Elsewhere:** [Status page](https://status.cotlet.dev) · [Cotlet on GitHub](https://github.com/cotletdev) · [Cotlet on X](https://x.com/cotletdev) · [Cotlet on LinkedIn](https://www.linkedin.com/company/cotletdev) · [Cotlet on Product Hunt](https://www.producthunt.com/products/cotlet) · [Cotlet on Crunchbase](https://www.crunchbase.com/organization/cotlet) · [Cotlet on SaaSHub](https://www.saashub.com/cotlet)

Cotlet.dev is built by Bart Krawczyk and Jake Slugocki, the founders of Take Group sp. z o.o., ul. Wincentego Janasa 4, 40-855 Katowice, Poland. KRS 0000871398, NIP 6342984273, VAT EU: PL6342984273. [About us](https://cotlet.dev/about.md)

Cotlet is an independent service. It is not affiliated with, endorsed by or sponsored by any of the products listed on this site. Product names are trademarks of their respective owners.
