@sentientui/mcp 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4TM3SCHF.js → chunk-ZJ2JZ5RR.js} +243 -93
- package/dist/index.cjs +243 -93
- package/dist/index.js +1 -1
- package/dist/lib.cjs +243 -93
- package/dist/lib.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -734,16 +734,20 @@ function registerGoalTools(server, client) {
|
|
|
734
734
|
"get_goal_funnel",
|
|
735
735
|
{
|
|
736
736
|
title: "Goal funnel",
|
|
737
|
-
description: "Get goal hit counts, unique-session conversion rates, and per-variant breakdown.",
|
|
737
|
+
description: "Get goal hit counts, unique-session conversion rates, and per-variant breakdown. This is a flat per-goal list \u2014 for multi-step funnel drop-off, use get_funnel_report.",
|
|
738
738
|
inputSchema: { projectId: projectIdSchema },
|
|
739
739
|
_meta: uiMeta("goal-funnel"),
|
|
740
740
|
outputSchema: {
|
|
741
|
+
currency: import_zod6.z.string().describe("Project display currency (ISO-4217) for the revenue fields"),
|
|
741
742
|
goals: import_zod6.z.array(
|
|
742
743
|
import_zod6.z.object({
|
|
743
744
|
goalName: import_zod6.z.string(),
|
|
744
745
|
hits: import_zod6.z.number(),
|
|
745
746
|
uniqueSessions: import_zod6.z.number(),
|
|
746
747
|
conversionRate: import_zod6.z.number().describe("Unique-session conversion rate (0-1)"),
|
|
748
|
+
revenue: import_zod6.z.number().nullable().describe("Total revenue from valued conversions, in the project currency (null for valueless goals)"),
|
|
749
|
+
avgOrderValue: import_zod6.z.number().nullable().describe("Average value per valued conversion (null for valueless goals)"),
|
|
750
|
+
revenuePerSession: import_zod6.z.number().nullable().describe("Revenue divided by all project sessions (null for valueless goals)"),
|
|
747
751
|
variants: import_zod6.z.array(
|
|
748
752
|
import_zod6.z.object({
|
|
749
753
|
componentId: import_zod6.z.string(),
|
|
@@ -761,20 +765,28 @@ function registerGoalTools(server, client) {
|
|
|
761
765
|
}
|
|
762
766
|
},
|
|
763
767
|
withApiErrorGuidance(async ({ projectId }) => {
|
|
768
|
+
var _a2, _b;
|
|
764
769
|
const id = encodeURIComponent(projectId);
|
|
765
770
|
const data = await client.get(`/projects/${id}/goals`);
|
|
766
771
|
const structuredContent = {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
772
|
+
currency: (_a2 = data.currency) != null ? _a2 : "USD",
|
|
773
|
+
goals: data.goals.map((g) => {
|
|
774
|
+
var _a3, _b2, _c;
|
|
775
|
+
return {
|
|
776
|
+
goalName: g.goalName,
|
|
777
|
+
hits: g.hits,
|
|
778
|
+
uniqueSessions: g.uniqueSessions,
|
|
779
|
+
conversionRate: g.pct,
|
|
780
|
+
revenue: (_a3 = g.revenue) != null ? _a3 : null,
|
|
781
|
+
avgOrderValue: (_b2 = g.avgOrderValue) != null ? _b2 : null,
|
|
782
|
+
revenuePerSession: (_c = g.revenuePerSession) != null ? _c : null,
|
|
783
|
+
variants: g.variants.map((v) => ({
|
|
784
|
+
componentId: v.componentId,
|
|
785
|
+
variantId: v.variantId,
|
|
786
|
+
completionRate: v.completionRate
|
|
787
|
+
}))
|
|
788
|
+
};
|
|
789
|
+
})
|
|
778
790
|
};
|
|
779
791
|
if (!data.goals.length) {
|
|
780
792
|
return {
|
|
@@ -783,11 +795,15 @@ function registerGoalTools(server, client) {
|
|
|
783
795
|
_meta: uiMeta("goal-funnel")
|
|
784
796
|
};
|
|
785
797
|
}
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
798
|
+
const currency = (_b = data.currency) != null ? _b : "USD";
|
|
799
|
+
const lines = data.goals.flatMap((g) => {
|
|
800
|
+
var _a3;
|
|
801
|
+
return [
|
|
802
|
+
`${g.goalName}: ${g.hits} hits, ${g.uniqueSessions} unique sessions, ${(g.pct * 100).toFixed(1)}% conversion` + (g.revenue != null ? `, ${g.revenue.toFixed(2)} ${currency} revenue (${((_a3 = g.avgOrderValue) != null ? _a3 : 0).toFixed(2)} avg order)` : ""),
|
|
803
|
+
...g.variants.map((v) => ` ${v.componentId}/${v.variantId}: ${(v.completionRate * 100).toFixed(1)}% per assigned session`),
|
|
804
|
+
""
|
|
805
|
+
];
|
|
806
|
+
});
|
|
791
807
|
return { content: [{ type: "text", text: lines.join("\n").trim() }], structuredContent, _meta: uiMeta("goal-funnel") };
|
|
792
808
|
})
|
|
793
809
|
);
|
|
@@ -805,7 +821,8 @@ function registerGoalTools(server, client) {
|
|
|
805
821
|
role: import_zod6.z.string().describe("primary | secondary | guardrail"),
|
|
806
822
|
event: import_zod6.z.string().describe("click | form_submit | url_reached"),
|
|
807
823
|
urlPattern: import_zod6.z.string().nullable().describe("Only for url_reached goals"),
|
|
808
|
-
status: import_zod6.z.string().describe("active | archived")
|
|
824
|
+
status: import_zod6.z.string().describe("active | archived"),
|
|
825
|
+
defaultValue: import_zod6.z.number().nullable().describe("Fixed worth applied when a conversion carries no explicit value (project currency); null when unset")
|
|
809
826
|
})
|
|
810
827
|
).describe("Defined goals (empty if none)")
|
|
811
828
|
},
|
|
@@ -827,7 +844,10 @@ function registerGoalTools(server, client) {
|
|
|
827
844
|
role: g.role,
|
|
828
845
|
event: g.event,
|
|
829
846
|
urlPattern: (_a2 = g.url_pattern) != null ? _a2 : null,
|
|
830
|
-
status: g.status
|
|
847
|
+
status: g.status,
|
|
848
|
+
// NUMERIC arrives serialized as a string; coerce and tolerate its
|
|
849
|
+
// absence from an older API deploy.
|
|
850
|
+
defaultValue: g.default_value != null ? Number(g.default_value) : null
|
|
831
851
|
};
|
|
832
852
|
})
|
|
833
853
|
};
|
|
@@ -849,8 +869,137 @@ function registerGoalTools(server, client) {
|
|
|
849
869
|
);
|
|
850
870
|
}
|
|
851
871
|
|
|
852
|
-
// src/tools/
|
|
872
|
+
// src/tools/funnels.ts
|
|
853
873
|
var import_zod7 = require("zod");
|
|
874
|
+
var funnelIdSchema = import_zod7.z.string().describe('Funnel slug (from list_funnels), e.g. "checkout"');
|
|
875
|
+
function registerFunnelTools(server, client) {
|
|
876
|
+
server.registerTool(
|
|
877
|
+
"list_funnels",
|
|
878
|
+
{
|
|
879
|
+
title: "List funnels",
|
|
880
|
+
description: `List the project's multi-step funnels \u2014 ordered goal steps plus the components serving them. Use get_funnel_report for a funnel's drop-off numbers. Reference a funnelId verbatim from code: <Adaptive funnel="<funnelId>">.`,
|
|
881
|
+
inputSchema: { projectId: projectIdSchema },
|
|
882
|
+
outputSchema: {
|
|
883
|
+
funnels: import_zod7.z.array(
|
|
884
|
+
import_zod7.z.object({
|
|
885
|
+
funnelId: import_zod7.z.string().describe("Stable slug \u2014 use this exact string in code and in get_funnel_report"),
|
|
886
|
+
displayName: import_zod7.z.string(),
|
|
887
|
+
status: import_zod7.z.string().describe("draft | active | archived"),
|
|
888
|
+
windowDays: import_zod7.z.number().describe("Conversion window in days"),
|
|
889
|
+
source: import_zod7.z.string().describe("user | chat | editor | sdk"),
|
|
890
|
+
steps: import_zod7.z.array(
|
|
891
|
+
import_zod7.z.object({
|
|
892
|
+
stepIndex: import_zod7.z.number(),
|
|
893
|
+
goalId: import_zod7.z.string(),
|
|
894
|
+
weight: import_zod7.z.number().nullable().describe("Manual optimizer credit for reaching this step (null = automatic end-weighted)")
|
|
895
|
+
})
|
|
896
|
+
).describe("Ordered steps"),
|
|
897
|
+
components: import_zod7.z.array(import_zod7.z.object({ componentId: import_zod7.z.string(), stepIndex: import_zod7.z.number().nullable() })).describe("Components serving this funnel (stepIndex null = whole funnel)")
|
|
898
|
+
})
|
|
899
|
+
).describe("Defined funnels (empty if none)")
|
|
900
|
+
},
|
|
901
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
902
|
+
},
|
|
903
|
+
withApiErrorGuidance(async ({ projectId }) => {
|
|
904
|
+
var _a2;
|
|
905
|
+
const id = encodeURIComponent(projectId);
|
|
906
|
+
const data = await client.get(`/projects/${id}/funnels`);
|
|
907
|
+
const structuredContent = {
|
|
908
|
+
funnels: ((_a2 = data.funnels) != null ? _a2 : []).map((f) => ({
|
|
909
|
+
funnelId: f.funnel_id,
|
|
910
|
+
displayName: f.display_name,
|
|
911
|
+
status: f.status,
|
|
912
|
+
windowDays: f.window_days,
|
|
913
|
+
source: f.source,
|
|
914
|
+
// NUMERIC arrives serialized as a string; coerce.
|
|
915
|
+
steps: f.steps.map((s) => ({
|
|
916
|
+
stepIndex: s.step_index,
|
|
917
|
+
goalId: s.goal_id,
|
|
918
|
+
weight: s.weight == null ? null : Number(s.weight)
|
|
919
|
+
})),
|
|
920
|
+
components: f.components.map((c) => {
|
|
921
|
+
var _a3;
|
|
922
|
+
return { componentId: c.component_id, stepIndex: (_a3 = c.step_index) != null ? _a3 : null };
|
|
923
|
+
})
|
|
924
|
+
}))
|
|
925
|
+
};
|
|
926
|
+
if (structuredContent.funnels.length === 0) {
|
|
927
|
+
return {
|
|
928
|
+
content: [{
|
|
929
|
+
type: "text",
|
|
930
|
+
text: "No funnels defined yet. Build one in the dashboard (Goals \u2192 Funnels tab) or via the goal chat \u2014 a funnel is 2-12 ordered goal steps, e.g. add_to_cart \u2192 checkout \u2192 purchase."
|
|
931
|
+
}],
|
|
932
|
+
structuredContent
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
const lines = structuredContent.funnels.map(
|
|
936
|
+
(f) => `${f.funnelId} (${f.status}) \u2014 ${f.displayName}: ${f.steps.map((s) => s.goalId).join(" \u2192 ")}`
|
|
937
|
+
);
|
|
938
|
+
lines.push("", 'Reference a funnelId verbatim from code: <Adaptive funnel="<funnelId>">. Use get_funnel_report for drop-off numbers.');
|
|
939
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
940
|
+
})
|
|
941
|
+
);
|
|
942
|
+
server.registerTool(
|
|
943
|
+
"get_funnel_report",
|
|
944
|
+
{
|
|
945
|
+
title: "Funnel drop-off report",
|
|
946
|
+
description: 'Per-step reach and drop-off for one funnel over its conversion window, with per-variant and audience splits per step, final-step revenue, and the holdout ("without optimization") comparison.',
|
|
947
|
+
inputSchema: { projectId: projectIdSchema, funnelId: funnelIdSchema },
|
|
948
|
+
outputSchema: {
|
|
949
|
+
funnelId: import_zod7.z.string(),
|
|
950
|
+
displayName: import_zod7.z.string(),
|
|
951
|
+
windowDays: import_zod7.z.number(),
|
|
952
|
+
currency: import_zod7.z.string().describe("Project display currency (ISO-4217) for the revenue fields"),
|
|
953
|
+
steps: import_zod7.z.array(
|
|
954
|
+
import_zod7.z.object({
|
|
955
|
+
stepIndex: import_zod7.z.number(),
|
|
956
|
+
goalId: import_zod7.z.string(),
|
|
957
|
+
displayName: import_zod7.z.string(),
|
|
958
|
+
reached: import_zod7.z.number().describe("Distinct visitors reaching this step in-window"),
|
|
959
|
+
dropOffFromPrevious: import_zod7.z.number().nullable().describe("1 - reached/previousReached (null on the first step)"),
|
|
960
|
+
neverFired: import_zod7.z.boolean().describe("True when the step goal has never been recorded anywhere \u2014 likely a typo"),
|
|
961
|
+
variants: import_zod7.z.array(import_zod7.z.object({
|
|
962
|
+
componentId: import_zod7.z.string(),
|
|
963
|
+
variantId: import_zod7.z.string(),
|
|
964
|
+
reached: import_zod7.z.number(),
|
|
965
|
+
assigned: import_zod7.z.number().describe("Distinct sessions served this variant in-window (the rate denominator)")
|
|
966
|
+
})),
|
|
967
|
+
personas: import_zod7.z.array(import_zod7.z.object({ label: import_zod7.z.string(), reached: import_zod7.z.number() }))
|
|
968
|
+
})
|
|
969
|
+
),
|
|
970
|
+
revenue: import_zod7.z.number().nullable().describe("Final-step revenue in the project currency (null when no valued conversions)"),
|
|
971
|
+
avgOrderValue: import_zod7.z.number().nullable(),
|
|
972
|
+
revenuePerEnteringVisitor: import_zod7.z.number().nullable(),
|
|
973
|
+
holdoutCompletion: import_zod7.z.object({ entered: import_zod7.z.number(), reached: import_zod7.z.number() }).nullable().describe('Holdout visitors entering vs finishing \u2014 the "without optimization" line')
|
|
974
|
+
},
|
|
975
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
976
|
+
},
|
|
977
|
+
withApiErrorGuidance(async ({ projectId, funnelId }) => {
|
|
978
|
+
const data = await client.get(`/projects/${encodeURIComponent(projectId)}/funnels/${encodeURIComponent(funnelId)}/report`);
|
|
979
|
+
const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
|
|
980
|
+
for (const s of data.steps) {
|
|
981
|
+
lines.push(
|
|
982
|
+
`${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + (s.dropOffFromPrevious != null ? ` (${Math.round(s.dropOffFromPrevious * 100)}% drop-off from previous)` : "") + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
|
|
983
|
+
);
|
|
984
|
+
for (const v of s.variants) {
|
|
985
|
+
lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
if (data.revenue != null) {
|
|
989
|
+
lines.push(
|
|
990
|
+
`Revenue: ${data.revenue.toFixed(2)} ${data.currency}` + (data.avgOrderValue != null ? ` (${data.avgOrderValue.toFixed(2)} ${data.currency} avg order)` : "") + (data.revenuePerEnteringVisitor != null ? `, ${data.revenuePerEnteringVisitor.toFixed(2)} ${data.currency} per entering visitor` : "")
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
if (data.holdoutCompletion && data.holdoutCompletion.entered > 0) {
|
|
994
|
+
lines.push(`Without optimization: ${data.holdoutCompletion.reached} of ${data.holdoutCompletion.entered} holdout visitors finished.`);
|
|
995
|
+
}
|
|
996
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent: data };
|
|
997
|
+
})
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/tools/guardrails.ts
|
|
1002
|
+
var import_zod8 = require("zod");
|
|
854
1003
|
function registerGuardrailTools(server, client) {
|
|
855
1004
|
server.registerTool(
|
|
856
1005
|
"list_guardrail_events",
|
|
@@ -859,11 +1008,11 @@ function registerGuardrailTools(server, client) {
|
|
|
859
1008
|
description: "List variants currently paused by the guardrail in the last 24 hours.",
|
|
860
1009
|
inputSchema: { projectId: projectIdSchema },
|
|
861
1010
|
outputSchema: {
|
|
862
|
-
events:
|
|
863
|
-
|
|
864
|
-
componentId:
|
|
865
|
-
variantIds:
|
|
866
|
-
pausedAt:
|
|
1011
|
+
events: import_zod8.z.array(
|
|
1012
|
+
import_zod8.z.object({
|
|
1013
|
+
componentId: import_zod8.z.string(),
|
|
1014
|
+
variantIds: import_zod8.z.array(import_zod8.z.string()).describe("Variants paused by the guardrail"),
|
|
1015
|
+
pausedAt: import_zod8.z.string().nullable().describe("ISO timestamp the pause fired, or null")
|
|
867
1016
|
})
|
|
868
1017
|
).describe("Guardrail events in the last 24h (empty if none)")
|
|
869
1018
|
},
|
|
@@ -898,7 +1047,7 @@ function registerGuardrailTools(server, client) {
|
|
|
898
1047
|
}
|
|
899
1048
|
|
|
900
1049
|
// src/tools/layout.ts
|
|
901
|
-
var
|
|
1050
|
+
var import_zod9 = require("zod");
|
|
902
1051
|
function registerLayoutTools(server, client) {
|
|
903
1052
|
server.registerTool(
|
|
904
1053
|
"get_layout_stats",
|
|
@@ -908,12 +1057,12 @@ function registerLayoutTools(server, client) {
|
|
|
908
1057
|
inputSchema: { projectId: projectIdSchema },
|
|
909
1058
|
_meta: uiMeta("layout-stats"),
|
|
910
1059
|
outputSchema: {
|
|
911
|
-
layouts:
|
|
912
|
-
|
|
913
|
-
persona:
|
|
914
|
-
layoutOrder:
|
|
915
|
-
pulls:
|
|
916
|
-
avgReward:
|
|
1060
|
+
layouts: import_zod9.z.array(
|
|
1061
|
+
import_zod9.z.object({
|
|
1062
|
+
persona: import_zod9.z.string(),
|
|
1063
|
+
layoutOrder: import_zod9.z.array(import_zod9.z.string()).describe("Ranked section order for this persona"),
|
|
1064
|
+
pulls: import_zod9.z.number().describe("Number of times this arm was served"),
|
|
1065
|
+
avgReward: import_zod9.z.number().describe("Average bandit reward weight")
|
|
917
1066
|
})
|
|
918
1067
|
).describe("Per-persona layout rankings (empty until enough sessions)")
|
|
919
1068
|
},
|
|
@@ -950,7 +1099,7 @@ function registerLayoutTools(server, client) {
|
|
|
950
1099
|
}
|
|
951
1100
|
|
|
952
1101
|
// src/tools/variants.ts
|
|
953
|
-
var
|
|
1102
|
+
var import_zod10 = require("zod");
|
|
954
1103
|
function registerVariantWriteTools(server, client) {
|
|
955
1104
|
server.registerTool(
|
|
956
1105
|
"create_variant",
|
|
@@ -959,19 +1108,19 @@ function registerVariantWriteTools(server, client) {
|
|
|
959
1108
|
description: "Create a NO-CODE managed text variant for a component (content stored in SentientUI, rendered by <AdaptiveText>). Use this ONLY for text-only variants the user wants without a code change. For variants that will live in the codebase (full components \u2014 copy, markup, styling), use get_variant_brief and write the variant in code instead; those auto-register on deploy and do not need create_variant. Requires a paid plan (server keys are Starter+; anonymous demo tokens are read-only).",
|
|
960
1109
|
inputSchema: {
|
|
961
1110
|
projectId: projectIdSchema,
|
|
962
|
-
componentId:
|
|
963
|
-
displayName:
|
|
964
|
-
content:
|
|
1111
|
+
componentId: import_zod10.z.string().min(1).max(200).describe("The component ID to add a variant to"),
|
|
1112
|
+
displayName: import_zod10.z.string().min(1).max(200).describe("Human-readable name for the new variant"),
|
|
1113
|
+
content: import_zod10.z.string().max(1e4).optional().describe("The text content for this managed variant (rendered by <AdaptiveText>). Generate it from get_variant_brief context; omit only to create an empty placeholder to fill in from the dashboard.")
|
|
965
1114
|
},
|
|
966
1115
|
outputSchema: {
|
|
967
|
-
variantId:
|
|
1116
|
+
variantId: import_zod10.z.string().describe("The new variant ID"),
|
|
968
1117
|
// API returns `body.displayName ?? null`, so a successful create can
|
|
969
1118
|
// carry a null name — match that contract or outputSchema validation
|
|
970
1119
|
// would reject an otherwise-successful response.
|
|
971
|
-
displayName:
|
|
972
|
-
componentId:
|
|
973
|
-
state:
|
|
974
|
-
hasContent:
|
|
1120
|
+
displayName: import_zod10.z.string().nullable(),
|
|
1121
|
+
componentId: import_zod10.z.string(),
|
|
1122
|
+
state: import_zod10.z.literal("draft").describe("New managed variants start in draft state"),
|
|
1123
|
+
hasContent: import_zod10.z.boolean().describe("Whether text content was provided at creation")
|
|
975
1124
|
},
|
|
976
1125
|
annotations: {
|
|
977
1126
|
readOnlyHint: false,
|
|
@@ -1009,13 +1158,13 @@ function registerVariantWriteTools(server, client) {
|
|
|
1009
1158
|
description: "Pause a variant, stopping traffic from being assigned to it.",
|
|
1010
1159
|
inputSchema: {
|
|
1011
1160
|
projectId: projectIdSchema,
|
|
1012
|
-
componentId:
|
|
1013
|
-
variantId:
|
|
1161
|
+
componentId: import_zod10.z.string().describe("The component ID"),
|
|
1162
|
+
variantId: import_zod10.z.string().describe("The variant ID to pause")
|
|
1014
1163
|
},
|
|
1015
1164
|
outputSchema: {
|
|
1016
|
-
variantId:
|
|
1017
|
-
componentId:
|
|
1018
|
-
paused:
|
|
1165
|
+
variantId: import_zod10.z.string(),
|
|
1166
|
+
componentId: import_zod10.z.string(),
|
|
1167
|
+
paused: import_zod10.z.literal(true).describe("The variant is now paused")
|
|
1019
1168
|
},
|
|
1020
1169
|
annotations: {
|
|
1021
1170
|
readOnlyHint: false,
|
|
@@ -1043,8 +1192,8 @@ function registerVariantWriteTools(server, client) {
|
|
|
1043
1192
|
description: "Trigger fresh AI insight generation for a project. Returns immediately; use get_insights in ~15 seconds to see results.",
|
|
1044
1193
|
inputSchema: { projectId: projectIdSchema },
|
|
1045
1194
|
outputSchema: {
|
|
1046
|
-
projectId:
|
|
1047
|
-
status:
|
|
1195
|
+
projectId: import_zod10.z.string(),
|
|
1196
|
+
status: import_zod10.z.literal("generating").describe("Generation has been triggered")
|
|
1048
1197
|
},
|
|
1049
1198
|
annotations: {
|
|
1050
1199
|
readOnlyHint: false,
|
|
@@ -1068,7 +1217,7 @@ function registerVariantWriteTools(server, client) {
|
|
|
1068
1217
|
}
|
|
1069
1218
|
|
|
1070
1219
|
// src/tools/variant-brief.ts
|
|
1071
|
-
var
|
|
1220
|
+
var import_zod11 = require("zod");
|
|
1072
1221
|
var GOAL_TARGET = 500;
|
|
1073
1222
|
var BEST_PRACTICE_PRIORS = {
|
|
1074
1223
|
ecommerce: [
|
|
@@ -1141,15 +1290,15 @@ function registerVariantBriefTools(server, client) {
|
|
|
1141
1290
|
description: "Get an insight-driven brief for creating a new CODE-NATIVE variant of a component. Returns current variant performance, audience, insights, a data-sufficiency assessment (with a best-practice fallback when there is no data yet), and step-by-step instructions for writing the variant in the customer's code. Use this instead of create_variant when the variant will live in the codebase.",
|
|
1142
1291
|
inputSchema: {
|
|
1143
1292
|
projectId: projectIdSchema,
|
|
1144
|
-
componentId:
|
|
1293
|
+
componentId: import_zod11.z.string().describe('The component ID to write a new variant for (matches <Adaptive id="...">).')
|
|
1145
1294
|
},
|
|
1146
1295
|
outputSchema: {
|
|
1147
|
-
componentId:
|
|
1148
|
-
contextType:
|
|
1149
|
-
dataState:
|
|
1150
|
-
existingVariantIds:
|
|
1151
|
-
priors:
|
|
1152
|
-
markdown:
|
|
1296
|
+
componentId: import_zod11.z.string(),
|
|
1297
|
+
contextType: import_zod11.z.string().describe("The project's context type (or 'unknown')"),
|
|
1298
|
+
dataState: import_zod11.z.enum(["sufficient", "collecting", "empty"]).describe("Data-sufficiency assessment"),
|
|
1299
|
+
existingVariantIds: import_zod11.z.array(import_zod11.z.string()).describe("Variant IDs already in use (do not reuse)"),
|
|
1300
|
+
priors: import_zod11.z.array(import_zod11.z.string()).describe("Best-practice priors applied for this context type"),
|
|
1301
|
+
markdown: import_zod11.z.string().describe("The full variant brief in Markdown")
|
|
1153
1302
|
},
|
|
1154
1303
|
annotations: {
|
|
1155
1304
|
readOnlyHint: true,
|
|
@@ -1266,7 +1415,7 @@ function registerVariantBriefTools(server, client) {
|
|
|
1266
1415
|
}
|
|
1267
1416
|
|
|
1268
1417
|
// src/tools/test-brief.ts
|
|
1269
|
-
var
|
|
1418
|
+
var import_zod12 = require("zod");
|
|
1270
1419
|
async function settled2(p) {
|
|
1271
1420
|
try {
|
|
1272
1421
|
return await p;
|
|
@@ -1282,13 +1431,13 @@ function registerTestBriefTools(server, client) {
|
|
|
1282
1431
|
description: "Get a ready-to-paste test for a SentientUI-wrapped component, populated with the component's real variants and goals. This project uses @sentientui/react/testing. Use this so your tests force a specific variant/layout deterministically and never break when the optimizer serves a different version. Returns a React Testing Library example plus the URL-param recipe for E2E (Playwright/Cypress).",
|
|
1283
1432
|
inputSchema: {
|
|
1284
1433
|
projectId: projectIdSchema,
|
|
1285
|
-
componentId:
|
|
1434
|
+
componentId: import_zod12.z.string().describe('The component ID to write a test for (matches <Adaptive id="...">).')
|
|
1286
1435
|
},
|
|
1287
1436
|
outputSchema: {
|
|
1288
|
-
componentId:
|
|
1289
|
-
forcedVariantId:
|
|
1290
|
-
goalName:
|
|
1291
|
-
markdown:
|
|
1437
|
+
componentId: import_zod12.z.string(),
|
|
1438
|
+
forcedVariantId: import_zod12.z.string().describe("The non-control variant the example forces"),
|
|
1439
|
+
goalName: import_zod12.z.string().describe("The goal the example asserts fires"),
|
|
1440
|
+
markdown: import_zod12.z.string().describe("The full test brief in Markdown")
|
|
1292
1441
|
},
|
|
1293
1442
|
annotations: {
|
|
1294
1443
|
readOnlyHint: true,
|
|
@@ -1371,7 +1520,7 @@ function registerTestBriefTools(server, client) {
|
|
|
1371
1520
|
}
|
|
1372
1521
|
|
|
1373
1522
|
// src/tools/integration-guide.ts
|
|
1374
|
-
var
|
|
1523
|
+
var import_zod13 = require("zod");
|
|
1375
1524
|
var GUIDE = `# SentientUI integration guide \u2014 the adaptive ladder
|
|
1376
1525
|
|
|
1377
1526
|
SentientUI adapts a site per visitor type (personas: buyer, researcher, deal_seeker, browser,
|
|
@@ -1446,7 +1595,7 @@ function registerIntegrationGuideTools(server) {
|
|
|
1446
1595
|
description: "Get the SentientUI adaptive-ladder integration guide: setup (keyless and keyed) plus copy-pasteable examples for every rung (Style, Swap, Reorder). Use this to integrate SentientUI into a codebase.",
|
|
1447
1596
|
inputSchema: {},
|
|
1448
1597
|
outputSchema: {
|
|
1449
|
-
guide:
|
|
1598
|
+
guide: import_zod13.z.string().describe("The full integration guide in Markdown")
|
|
1450
1599
|
},
|
|
1451
1600
|
annotations: {
|
|
1452
1601
|
readOnlyHint: true,
|
|
@@ -1462,7 +1611,7 @@ function registerIntegrationGuideTools(server) {
|
|
|
1462
1611
|
}
|
|
1463
1612
|
|
|
1464
1613
|
// src/tools/agent-traffic.ts
|
|
1465
|
-
var
|
|
1614
|
+
var import_zod14 = require("zod");
|
|
1466
1615
|
var PLAN_GATE_GUIDANCE = {
|
|
1467
1616
|
agent_analytics_requires_paid_plan: "Agent analytics requires a paid SentientUI plan (Starter or above). Upgrade at https://sentient-ui.com, then try again."
|
|
1468
1617
|
};
|
|
@@ -1474,19 +1623,19 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1474
1623
|
description: "Which AI agents and crawlers are reading this site: totals by type (passive crawlers, agentic browsers, agent API calls), engine breakdown, and the paths they fetch most. Agent traffic is tracked separately and never counted in conversion rate.",
|
|
1475
1624
|
inputSchema: { projectId: projectIdSchema },
|
|
1476
1625
|
outputSchema: {
|
|
1477
|
-
totals:
|
|
1478
|
-
engines:
|
|
1479
|
-
|
|
1480
|
-
engine:
|
|
1481
|
-
intent:
|
|
1482
|
-
count:
|
|
1483
|
-
sharePct:
|
|
1484
|
-
lastSeen:
|
|
1485
|
-
firstSeenInRange:
|
|
1626
|
+
totals: import_zod14.z.object({ crawler: import_zod14.z.number(), api: import_zod14.z.number(), browser: import_zod14.z.number() }),
|
|
1627
|
+
engines: import_zod14.z.array(
|
|
1628
|
+
import_zod14.z.object({
|
|
1629
|
+
engine: import_zod14.z.string(),
|
|
1630
|
+
intent: import_zod14.z.string().describe("user | search | training | other"),
|
|
1631
|
+
count: import_zod14.z.number(),
|
|
1632
|
+
sharePct: import_zod14.z.number(),
|
|
1633
|
+
lastSeen: import_zod14.z.string(),
|
|
1634
|
+
firstSeenInRange: import_zod14.z.boolean().describe("First observed within the queried period")
|
|
1486
1635
|
})
|
|
1487
1636
|
),
|
|
1488
|
-
intents:
|
|
1489
|
-
topPaths:
|
|
1637
|
+
intents: import_zod14.z.object({ user: import_zod14.z.number(), search: import_zod14.z.number(), training: import_zod14.z.number(), other: import_zod14.z.number() }).describe("Crawler fetches by purpose: user = an assistant answering a real person live"),
|
|
1638
|
+
topPaths: import_zod14.z.array(import_zod14.z.object({ path: import_zod14.z.string(), count: import_zod14.z.number(), engines: import_zod14.z.number() }))
|
|
1490
1639
|
},
|
|
1491
1640
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
1492
1641
|
},
|
|
@@ -1524,26 +1673,26 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1524
1673
|
description: "Whether the pages AI agents actually read are machine-legible: per-path checks for price, product name, positioning, and CTA in the server HTML, plus agent API blocks served without agent data. Each failure comes with a concrete fix.",
|
|
1525
1674
|
inputSchema: { projectId: projectIdSchema },
|
|
1526
1675
|
outputSchema: {
|
|
1527
|
-
paths:
|
|
1528
|
-
|
|
1529
|
-
path:
|
|
1530
|
-
score:
|
|
1531
|
-
checks:
|
|
1532
|
-
price:
|
|
1533
|
-
name:
|
|
1534
|
-
positioning:
|
|
1535
|
-
cta:
|
|
1536
|
-
notes:
|
|
1676
|
+
paths: import_zod14.z.array(
|
|
1677
|
+
import_zod14.z.object({
|
|
1678
|
+
path: import_zod14.z.string(),
|
|
1679
|
+
score: import_zod14.z.number().describe("0\u2013100, 25 per passing check"),
|
|
1680
|
+
checks: import_zod14.z.object({
|
|
1681
|
+
price: import_zod14.z.boolean(),
|
|
1682
|
+
name: import_zod14.z.boolean(),
|
|
1683
|
+
positioning: import_zod14.z.boolean(),
|
|
1684
|
+
cta: import_zod14.z.boolean(),
|
|
1685
|
+
notes: import_zod14.z.array(import_zod14.z.string())
|
|
1537
1686
|
}),
|
|
1538
|
-
fixes:
|
|
1539
|
-
check:
|
|
1540
|
-
advice:
|
|
1541
|
-
snippet:
|
|
1687
|
+
fixes: import_zod14.z.array(import_zod14.z.object({
|
|
1688
|
+
check: import_zod14.z.string(),
|
|
1689
|
+
advice: import_zod14.z.string(),
|
|
1690
|
+
snippet: import_zod14.z.string().optional()
|
|
1542
1691
|
})).optional().describe("Concrete Next.js remediation per failing check"),
|
|
1543
|
-
lastChecked:
|
|
1692
|
+
lastChecked: import_zod14.z.string()
|
|
1544
1693
|
})
|
|
1545
1694
|
),
|
|
1546
|
-
emptyBlocks:
|
|
1695
|
+
emptyBlocks: import_zod14.z.array(import_zod14.z.object({ block: import_zod14.z.string(), variant: import_zod14.z.string(), occurrences: import_zod14.z.number() }))
|
|
1547
1696
|
},
|
|
1548
1697
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
1549
1698
|
},
|
|
@@ -1580,7 +1729,7 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1580
1729
|
}
|
|
1581
1730
|
|
|
1582
1731
|
// src/server.ts
|
|
1583
|
-
var PKG_VERSION = true ? "0.
|
|
1732
|
+
var PKG_VERSION = true ? "0.13.0" : "0.0.0-dev";
|
|
1584
1733
|
function createMcpServer(client) {
|
|
1585
1734
|
const server = new import_mcp.McpServer(
|
|
1586
1735
|
{
|
|
@@ -1607,6 +1756,7 @@ function createMcpServer(client) {
|
|
|
1607
1756
|
registerInsightTools(server, client);
|
|
1608
1757
|
registerPersonaTools(server, client);
|
|
1609
1758
|
registerGoalTools(server, client);
|
|
1759
|
+
registerFunnelTools(server, client);
|
|
1610
1760
|
registerGuardrailTools(server, client);
|
|
1611
1761
|
registerLayoutTools(server, client);
|
|
1612
1762
|
registerVariantBriefTools(server, client);
|