Skip to main content
Glama
thenavidm
by thenavidm

Create segment

create_segment
Destructive

Create a Beehiiv publication segment from explicit subscriptions, emails, or custom-field filters; requires confirm=true because it changes account state.

Instructions

Create segment. Changes account state and requires confirm=true for the user-requested action.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoA unique name for the segment that does not already exist in the publication.
inputNo
accountNoNamed private account from BEEHIIV_ACCOUNTS. Defaults to BEEHIIV_DEFAULT_ACCOUNT or the first configured account.
confirmNoSet true only when the user asked for exactly this action.
payloadNoComplete JSON body instead of individual body flags. Supports nullable fields and nested bulk structures. Cannot be combined with body flags or payload_file.
payload_fileNoLocal JSON request body file, at most 5 MB. Contents are validated before the API call and are never logged.
publication_idYesThe prefixed ID of the publication object

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv3.0.1
    • addedInput schema / $defs
      Added value: +{
      +  "SegmentSubscriptionInput": {
      +    "description": "Input for segment creation. Use `subscriptions` or `emails` to create a manual segment from explicit lists, or `custom_fields` to create a dynamic segment filtered by custom field values.",
      +    "oneOf": [
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "subscriptions": {
      +            "items": {
      +              "description": "The prefixed ID of the subscription.",
      +              "pattern": "^(sub_[0-9a-fA-F\\-]+)$",
      +              "title": "SubscriptionId",
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          "type": {
      +            "description": "Discriminator value: subscriptions",
      +            "enum": [
      +              "subscriptions"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "subscriptions"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "emails": {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          "type": {
      +            "description": "Discriminator value: emails",
      +            "enum": [
      +              "emails"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "emails"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "custom_fields": {
      +            "items": {
      +              "additionalProperties": false,
      +              "description": "A single custom field filter condition.",
      +              "properties": {
      +                "name": {
      +                  "description": "The display name of the custom field (case-insensitive match). Must be an existing custom field on the publication.",
      +                  "type": "string"
      +                },
      +                "operator": {
      +                  "description": "The comparison operator for the filter (e.g., `equal`, `not_equal`, `contains`, `exists`, `does_not_exist`). Available operators depend on the custom field's type.",
      +                  "type": "string"
      +                },
      +                "value": {
      +                  "description": "The value to compare against. Required for all operators except `exists` and `does_not_exist`.",
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "name",
      +                "operator"
      +              ],
      +              "title": "CustomFieldFilter",
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "operator": {
      +            "description": "The logical operator used to combine multiple custom field filters. Defaults to `and` if not specified.",
      +            "enum": [
      +              "and",
      +              "or"
      +            ],
      +            "title": "CustomFieldsLogicalOperator",
      +            "type": "string"
      +          },
      +          "type": {
      +            "description": "Discriminator value: custom_fields",
      +            "enum": [
      +              "custom_fields"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "custom_fields"
      +        ],
      +        "type": "object"
      +      }
      +    ],
      +    "title": "SegmentSubscriptionInput"
      +  }
      +}
    • changedInput schema / properties / confirm / description
      Previous value: -"Must be true for every account mutation. Confirms only the user-requested action."New value: +"Set true only when the user asked for exactly this action."
    • addedInput schema / properties / input / $ref
      Added value: +"#/$defs/SegmentSubscriptionInput"
    • removedInput schema / properties / input / description
      Removed value: -"Input for segment creation. Use `subscriptions` or `emails` to create a manual segment from explicit lists, or `custom_fields` to create a dynamic segment filtered by custom field values."
    • removedInput schema / properties / input / oneOf
      Removed value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "subscriptions": {
      -        "items": {
      -          "description": "The prefixed ID of the subscription.",
      -          "pattern": "^(sub_[0-9a-fA-F\\-]+)$",
      -          "title": "SubscriptionId",
      -          "type": "string"
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "description": "Discriminator value: subscriptions",
      -        "enum": [
      -          "subscriptions"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "subscriptions"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "emails": {
      -        "items": {
      -          "type": "string"
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "description": "Discriminator value: emails",
      -        "enum": [
      -          "emails"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "emails"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "custom_fields": {
      -        "items": {
      -          "additionalProperties": false,
      -          "description": "A single custom field filter condition.",
      -          "properties": {
      -            "name": {
      -              "description": "The display name of the custom field (case-insensitive match). Must be an existing custom field on the publication.",
      -              "type": "string"
      -            },
      -            "operator": {
      -              "description": "The comparison operator for the filter (e.g., `equal`, `not_equal`, `contains`, `exists`, `does_not_exist`). Available operators depend on the custom field's type.",
      -              "type": "string"
      -            },
      -            "value": {
      -              "description": "The value to compare against. Required for all operators except `exists` and `does_not_exist`.",
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "name",
      -            "operator"
      -          ],
      -          "title": "CustomFieldFilter",
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "operator": {
      -        "description": "The logical operator used to combine multiple custom field filters. Defaults to `and` if not specified.",
      -        "enum": [
      -          "and",
      -          "or"
      -        ],
      -        "title": "CustomFieldsLogicalOperator",
      -        "type": "string"
      -      },
      -      "type": {
      -        "description": "Discriminator value: custom_fields",
      -        "enum": [
      -          "custom_fields"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "custom_fields"
      -    ],
      -    "type": "object"
      -  }
      -]
    • removedInput schema / properties / input / title
      Removed value: -"SegmentSubscriptionInput"
    • addedInput schema / properties / payload / properties / input / $ref
      Added value: +"#/$defs/SegmentSubscriptionInput"
    • removedInput schema / properties / payload / properties / input / description
      Removed value: -"Input for segment creation. Use `subscriptions` or `emails` to create a manual segment from explicit lists, or `custom_fields` to create a dynamic segment filtered by custom field values."
    • removedInput schema / properties / payload / properties / input / oneOf
      Removed value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "subscriptions": {
      -        "items": {
      -          "description": "The prefixed ID of the subscription.",
      -          "pattern": "^(sub_[0-9a-fA-F\\-]+)$",
      -          "title": "SubscriptionId",
      -          "type": "string"
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "description": "Discriminator value: subscriptions",
      -        "enum": [
      -          "subscriptions"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "subscriptions"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "emails": {
      -        "items": {
      -          "type": "string"
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "description": "Discriminator value: emails",
      -        "enum": [
      -          "emails"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "emails"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "custom_fields": {
      -        "items": {
      -          "additionalProperties": false,
      -          "description": "A single custom field filter condition.",
      -          "properties": {
      -            "name": {
      -              "description": "The display name of the custom field (case-insensitive match). Must be an existing custom field on the publication.",
      -              "type": "string"
      -            },
      -            "operator": {
      -              "description": "The comparison operator for the filter (e.g., `equal`, `not_equal`, `contains`, `exists`, `does_not_exist`). Available operators depend on the custom field's type.",
      -              "type": "string"
      -            },
      -            "value": {
      -              "description": "The value to compare against. Required for all operators except `exists` and `does_not_exist`.",
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "name",
      -            "operator"
      -          ],
      -          "title": "CustomFieldFilter",
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "operator": {
      -        "description": "The logical operator used to combine multiple custom field filters. Defaults to `and` if not specified.",
      -        "enum": [
      -          "and",
      -          "or"
      -        ],
      -        "title": "CustomFieldsLogicalOperator",
      -        "type": "string"
      -      },
      -      "type": {
      -        "description": "Discriminator value: custom_fields",
      -        "enum": [
      -          "custom_fields"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "custom_fields"
      -    ],
      -    "type": "object"
      -  }
      -]
    • removedInput schema / properties / payload / properties / input / title
      Removed value: -"SegmentSubscriptionInput"
  2. First observedv2.0.0

TDQS

C2.4/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, idempotentHint=false and openWorldHint=true, so the safety profile is largely covered. The description does add value beyond them by disclosing that the call changes account state and requires an explicit confirm=true gate. It stops short of saying what is created/destroyed or what the result looks like.

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

Conciseness3/5

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

Two short sentences with no filler and the behavioral constraint front-loaded, so it is compact. However the first sentence is pure restatement of the title, so a portion of the text does not earn its place.

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

Completeness2/5

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

For a destructive, non-idempotent mutation with 7 params, nested oneOf input structures and no output schema, the description omits the notion of what a segment is, the manual-vs-dynamic distinction, and any failure/permission context. Annotations carry the safety signal but the description is too thin for this complexity.

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 description coverage is 86%, so the schema already documents confirm, publication_id, account, payload and payload_file. The description only echoes the confirm semantics ("only when the user asked for exactly this action") already in the schema, adding no new parameter meaning; baseline 3 applies.

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

Purpose2/5

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

"Create segment" restates the tool name and title almost verbatim, adding no resource definition (what a segment is, manual vs dynamic) or distinguishing it from siblings like create_custom_field or create_newsletter_list. The only extra content is a behavioral note about account state, not purpose.

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

Usage Guidelines2/5

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

No when-to-use guidance and no named alternatives, despite many plausible siblings (list_segments, get_segment, create_custom_field). The confirm=true requirement is stated as a precondition, which is the one useful hint, but it does not tell the agent when this tool is the right choice.

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

Deploy Server

Other Tools