Skip to main content
Glama

Create user segment

create_segment

Create Segment

When to use: 사용자가 말한 고객 조건을 이 프로젝트의 유저 세그먼트로 저장할 때(예: "최근 30일 재구매 고객을 세그먼트로 저장해줘"). 저장한 세그먼트는 웹의 유저 분석 화면에서 그대로 열리고, 응답의 id 를 get_segment_stats 에 넘기면 고객 수·구매 고객 수 같은 핵심 지표를 바로 볼 수 있다.

When NOT to use: 기존 세그먼트를 수정하거나 지우려 할 때 — 수정·삭제는 MCP 로 할 수 없다(웹에서 한다). 조건을 바꾸려면 새 세그먼트를 만들고 옛것은 웹에서 지운다. 저장하지 않고 고객 수만 보고 싶을 때도 쓰지 않는다.

Limitations: 새 세그먼트 한 개를 추가할 뿐 기존 세그먼트는 바꾸지 않는다. 그래도 한 번 만들면 MCP 로 지울 수 없고 웹 세그먼트 목록에서 삭제해야 하니, 만들기 전에 사용자에게 이름과 조건을 확인한다. 서버는 같은 이름을 막지 않으므로 먼저 list_segments 로 같은 이름이 있는지 본다. 필수: name, filter_body(description 은 선택). filter_body 는 형식을 서버가 거의 검증하지 않는다 — 임의로 지어내지 말고 비슷한 조건의 기존 세그먼트를 get_segment 로 읽어 그 filter_body 의 키·값 구조를 따라 만든다. 단계 조건(flow·퍼널 단계)은 조건이 어긋나면 422 로 거절된다. 단계 조건의 saved_user_cnt(저장 시점 인원)는 MCP 로 만든 세그먼트에는 저장되지 않으니 넣지 않는다. 프로젝트 소유자 계정의 세그먼트로 저장되며 data_management:write 권한이 필요하다. 만든 직후 get_segment 로 읽어 조건이 의도대로 저장됐는지, get_segment_stats 로 고객 수가 기대와 맞는지 확인한다.

Examples:

  • Q: 최근 30일 안에 구매한 고객을 '최근 구매 고객' 세그먼트로 저장해줘 params: {'body': {'name': '최근 구매 고객', 'description': '최근 30일 안에 구매한 고객', 'filter_body': {'customer_type': 'all', 'is_paid_customer': 'paid'}}}

Output shape: object: {id, name, description, filter_body, created_at, updated_at} — id 가 get_segment_stats 의 segment_ids 에 들어간다.

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": {
      "name": "<name>",
      "filter_body": "<filter_body>"
    },
    "name": "create_segment"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
project-idNo
descriptionNo
filter_bodyYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Beyond the annotations (readOnlyHint=false, destructiveHint=false), it discloses high-value behavior: segments created via MCP cannot be deleted via MCP, the server does not enforce unique names, filter_body is barely validated server-side, step conditions can 422 on mismatched conditions, saved_user_cnt is not persisted, segments are owned by the project owner account, and data_management:write is required. It does not cover rate limits or what happens on partial/invalid input beyond the 422 note, which keeps it just short of a 5.

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

Conciseness4/5

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

Headings and labeled sections (When to use / When NOT to use / Limitations / Examples) make it skimmable and front-load the routing decision. It is long and mixes Korean prose with English tokens, and the post-creation verification advice is somewhat repeated between Limitations and the example, but nearly every sentence carries actionable constraint information.

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?

For a nested-object, four-parameter mutation tool this is unusually complete: prerequisites, duplicate handling, filter_body construction strategy, step-condition pitfalls, permissions, and a concrete worked example with params are all present, and the return shape is reinforced even though an output schema already exists.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must carry parameter meaning, and it largely does: it marks name and filter_body as required, marks description optional, warns that filter_body structure must be copied from an existing segment read via get_segment rather than invented, and excludes saved_user_cnt. The optional project-id parameter is never mentioned, leaving one of four parameters undocumented in both schema and description.

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?

The description states a specific verb and resource ('save the customer conditions the user described as a user segment for this project') and immediately disambiguates it from the read siblings get_segment, get_segment_stats, and list_segments. An agent can tell this is the only creation path and that edit/delete is out of scope without opening any schema.

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?

It has explicit 'When to use' and 'When NOT to use' sections with named alternatives: modify/delete must be done in the web UI, and dry-run counting should use something other than this tool. It also names the follow-up path (pass the returned id to get_segment_stats) and the duplicate-name pre-check via list_segments.

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