Skip to content

Restore MCP blueprint/segment tools dropped in the reslice#38

Merged
hookdump merged 1 commit into
mainfrom
restore/mcp-blueprint-segment-tools
Jul 15, 2026
Merged

Restore MCP blueprint/segment tools dropped in the reslice#38
hookdump merged 1 commit into
mainfrom
restore/mcp-blueprint-segment-tools

Conversation

@hookdump

@hookdump hookdump commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What & why

The #23 MCP Overhaul re-captured the blueprint/segment tool from a reduced snapshot of the XDEV-2316 feature branch (#6), so the #24/#25 reslice faithfully reproduced a version that was missing 4 tools and a safety gate. Their Data API endpoints have been live on master the whole time (OAuth-gated), so this is SDK-surface-only work — no API change required. Full trace: forensic write-up.

Restored tools

Tool Backing endpoint (live on API master)
create_blueprint POST /data/blueprints — default org flow; empty/BASIC/B2B/MERGEFIELDS templates
create_segment_flow POST /data/segments — segment + editable draft in one call (preferred isolated/test-flow path)
archive_segment POST /data/segments/:id/archive — soft-delete disposable segments
list_segment_attributes GET /data/segments/attributes — targetable audience attributes with valueType, valid operands, and fixed-enum values

Two correctness fixes (please sanity-check)

  1. update_segment_filter regains confirmLiveChange. The API enforces it (assertLiveAudienceChangeAcknowledged) for live (enabled + published) segments — main's tool couldn't send it, so an agent editing a live segment's audience got rejected with no way to retry through the tool.
  2. GT/LT removed from the segment operand set. The API's OPERANDS_BY_VALUE_TYPE only accepts INCLUDES/NOT_INCLUDES (STRING/BOOLEAN) and GTE/LTE/BETWEEN/NOT_BETWEEN (NUMBER/DATE), with an explicit comment that GT/LT render as unrecognized operands. Current main advertised them (a reslice-era addition), producing guaranteed-fail calls. This restores the feature branch's API-accurate set + the richer attribute catalog in the tool descriptions.

Scope

Rebate is intentionally excluded — it was the other reslice casualty but is already handled by the in-flight rebate PR, and duplicating it here would clobber that work. A couple of blueprint description refinements that were also trimmed (the update_blueprint_offer add-offer-by-type affordance, the update_blueprint_draft segment-rename note) are left out of this PR to avoid touching the same lines; happy to follow up once rebate lands.

Validation

  • pnpm --filter @churnkey/mcp typecheck — pass
  • pnpm --filter @churnkey/mcp build — pass
  • pnpm --filter @churnkey/mcp exec vitest run234 tests pass (blueprints 15, segments 11, incl. the restored tools + confirmLiveChange)
  • Biome — clean

cc @robert-moore

The MCP overhaul (#23) re-captured the blueprint/segment tool from a
reduced snapshot of the XDEV-2316 feature branch (#6), so four tools and
one safety gate never reached main even though their Data API endpoints
have been live the whole time:

- create_blueprint (default org flow; empty/BASIC/B2B/MERGEFIELDS templates)
- create_segment_flow (segment + editable draft in one call)
- archive_segment (soft-delete disposable segments)
- list_segment_attributes (targetable audience attributes + operands + enum values)
- update_segment_filter regains confirmLiveChange, which the API enforces
  (assertLiveAudienceChangeAcknowledged) for live enabled+published segments

Also aligns the segment operand set to the API: GT/LT are removed because
the server (OPERANDS_BY_VALUE_TYPE) rejects them as unrecognized operands,
so advertising them produced guaranteed-fail calls.

Rebate offer support (the other reslice casualty) is intentionally left to
its own in-flight PR to avoid conflicts.

typecheck + build + full vitest (234) pass; biome clean.

Claude-Session: https://claude.ai/code/session_01WT9PV52GttJcUP6xzHVPCe
@hookdump
hookdump merged commit 73c68b2 into main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants