Restore MCP blueprint/segment tools dropped in the reslice#38
Merged
Conversation
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
robert-moore
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
masterthe whole time (OAuth-gated), so this is SDK-surface-only work — no API change required. Full trace: forensic write-up.Restored tools
master)create_blueprintPOST /data/blueprints— default org flow;empty/BASIC/B2B/MERGEFIELDStemplatescreate_segment_flowPOST /data/segments— segment + editable draft in one call (preferred isolated/test-flow path)archive_segmentPOST /data/segments/:id/archive— soft-delete disposable segmentslist_segment_attributesGET /data/segments/attributes— targetable audience attributes withvalueType, validoperands, and fixed-enumvaluesTwo correctness fixes (please sanity-check)
update_segment_filterregainsconfirmLiveChange. 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.GT/LTremoved from the segment operand set. The API'sOPERANDS_BY_VALUE_TYPEonly acceptsINCLUDES/NOT_INCLUDES(STRING/BOOLEAN) andGTE/LTE/BETWEEN/NOT_BETWEEN(NUMBER/DATE), with an explicit comment thatGT/LTrender as unrecognized operands. Currentmainadvertised 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_offeradd-offer-by-type affordance, theupdate_blueprint_draftsegment-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— passpnpm --filter @churnkey/mcp build— passpnpm --filter @churnkey/mcp exec vitest run— 234 tests pass (blueprints 15, segments 11, incl. the restored tools +confirmLiveChange)cc @robert-moore