@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/lib.cjs
CHANGED
|
@@ -759,16 +759,20 @@ function registerGoalTools(server, client) {
|
|
|
759
759
|
"get_goal_funnel",
|
|
760
760
|
{
|
|
761
761
|
title: "Goal funnel",
|
|
762
|
-
description: "Get goal hit counts, unique-session conversion rates, and per-variant breakdown.",
|
|
762
|
+
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.",
|
|
763
763
|
inputSchema: { projectId: projectIdSchema },
|
|
764
764
|
_meta: uiMeta("goal-funnel"),
|
|
765
765
|
outputSchema: {
|
|
766
|
+
currency: import_zod6.z.string().describe("Project display currency (ISO-4217) for the revenue fields"),
|
|
766
767
|
goals: import_zod6.z.array(
|
|
767
768
|
import_zod6.z.object({
|
|
768
769
|
goalName: import_zod6.z.string(),
|
|
769
770
|
hits: import_zod6.z.number(),
|
|
770
771
|
uniqueSessions: import_zod6.z.number(),
|
|
771
772
|
conversionRate: import_zod6.z.number().describe("Unique-session conversion rate (0-1)"),
|
|
773
|
+
revenue: import_zod6.z.number().nullable().describe("Total revenue from valued conversions, in the project currency (null for valueless goals)"),
|
|
774
|
+
avgOrderValue: import_zod6.z.number().nullable().describe("Average value per valued conversion (null for valueless goals)"),
|
|
775
|
+
revenuePerSession: import_zod6.z.number().nullable().describe("Revenue divided by all project sessions (null for valueless goals)"),
|
|
772
776
|
variants: import_zod6.z.array(
|
|
773
777
|
import_zod6.z.object({
|
|
774
778
|
componentId: import_zod6.z.string(),
|
|
@@ -786,20 +790,28 @@ function registerGoalTools(server, client) {
|
|
|
786
790
|
}
|
|
787
791
|
},
|
|
788
792
|
withApiErrorGuidance(async ({ projectId }) => {
|
|
793
|
+
var _a, _b;
|
|
789
794
|
const id = encodeURIComponent(projectId);
|
|
790
795
|
const data = await client.get(`/projects/${id}/goals`);
|
|
791
796
|
const structuredContent = {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
797
|
+
currency: (_a = data.currency) != null ? _a : "USD",
|
|
798
|
+
goals: data.goals.map((g) => {
|
|
799
|
+
var _a2, _b2, _c;
|
|
800
|
+
return {
|
|
801
|
+
goalName: g.goalName,
|
|
802
|
+
hits: g.hits,
|
|
803
|
+
uniqueSessions: g.uniqueSessions,
|
|
804
|
+
conversionRate: g.pct,
|
|
805
|
+
revenue: (_a2 = g.revenue) != null ? _a2 : null,
|
|
806
|
+
avgOrderValue: (_b2 = g.avgOrderValue) != null ? _b2 : null,
|
|
807
|
+
revenuePerSession: (_c = g.revenuePerSession) != null ? _c : null,
|
|
808
|
+
variants: g.variants.map((v) => ({
|
|
809
|
+
componentId: v.componentId,
|
|
810
|
+
variantId: v.variantId,
|
|
811
|
+
completionRate: v.completionRate
|
|
812
|
+
}))
|
|
813
|
+
};
|
|
814
|
+
})
|
|
803
815
|
};
|
|
804
816
|
if (!data.goals.length) {
|
|
805
817
|
return {
|
|
@@ -808,11 +820,15 @@ function registerGoalTools(server, client) {
|
|
|
808
820
|
_meta: uiMeta("goal-funnel")
|
|
809
821
|
};
|
|
810
822
|
}
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
823
|
+
const currency = (_b = data.currency) != null ? _b : "USD";
|
|
824
|
+
const lines = data.goals.flatMap((g) => {
|
|
825
|
+
var _a2;
|
|
826
|
+
return [
|
|
827
|
+
`${g.goalName}: ${g.hits} hits, ${g.uniqueSessions} unique sessions, ${(g.pct * 100).toFixed(1)}% conversion` + (g.revenue != null ? `, ${g.revenue.toFixed(2)} ${currency} revenue (${((_a2 = g.avgOrderValue) != null ? _a2 : 0).toFixed(2)} avg order)` : ""),
|
|
828
|
+
...g.variants.map((v) => ` ${v.componentId}/${v.variantId}: ${(v.completionRate * 100).toFixed(1)}% per assigned session`),
|
|
829
|
+
""
|
|
830
|
+
];
|
|
831
|
+
});
|
|
816
832
|
return { content: [{ type: "text", text: lines.join("\n").trim() }], structuredContent, _meta: uiMeta("goal-funnel") };
|
|
817
833
|
})
|
|
818
834
|
);
|
|
@@ -830,7 +846,8 @@ function registerGoalTools(server, client) {
|
|
|
830
846
|
role: import_zod6.z.string().describe("primary | secondary | guardrail"),
|
|
831
847
|
event: import_zod6.z.string().describe("click | form_submit | url_reached"),
|
|
832
848
|
urlPattern: import_zod6.z.string().nullable().describe("Only for url_reached goals"),
|
|
833
|
-
status: import_zod6.z.string().describe("active | archived")
|
|
849
|
+
status: import_zod6.z.string().describe("active | archived"),
|
|
850
|
+
defaultValue: import_zod6.z.number().nullable().describe("Fixed worth applied when a conversion carries no explicit value (project currency); null when unset")
|
|
834
851
|
})
|
|
835
852
|
).describe("Defined goals (empty if none)")
|
|
836
853
|
},
|
|
@@ -852,7 +869,10 @@ function registerGoalTools(server, client) {
|
|
|
852
869
|
role: g.role,
|
|
853
870
|
event: g.event,
|
|
854
871
|
urlPattern: (_a = g.url_pattern) != null ? _a : null,
|
|
855
|
-
status: g.status
|
|
872
|
+
status: g.status,
|
|
873
|
+
// NUMERIC arrives serialized as a string; coerce and tolerate its
|
|
874
|
+
// absence from an older API deploy.
|
|
875
|
+
defaultValue: g.default_value != null ? Number(g.default_value) : null
|
|
856
876
|
};
|
|
857
877
|
})
|
|
858
878
|
};
|
|
@@ -874,8 +894,137 @@ function registerGoalTools(server, client) {
|
|
|
874
894
|
);
|
|
875
895
|
}
|
|
876
896
|
|
|
877
|
-
// src/tools/
|
|
897
|
+
// src/tools/funnels.ts
|
|
878
898
|
var import_zod7 = require("zod");
|
|
899
|
+
var funnelIdSchema = import_zod7.z.string().describe('Funnel slug (from list_funnels), e.g. "checkout"');
|
|
900
|
+
function registerFunnelTools(server, client) {
|
|
901
|
+
server.registerTool(
|
|
902
|
+
"list_funnels",
|
|
903
|
+
{
|
|
904
|
+
title: "List funnels",
|
|
905
|
+
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>">.`,
|
|
906
|
+
inputSchema: { projectId: projectIdSchema },
|
|
907
|
+
outputSchema: {
|
|
908
|
+
funnels: import_zod7.z.array(
|
|
909
|
+
import_zod7.z.object({
|
|
910
|
+
funnelId: import_zod7.z.string().describe("Stable slug \u2014 use this exact string in code and in get_funnel_report"),
|
|
911
|
+
displayName: import_zod7.z.string(),
|
|
912
|
+
status: import_zod7.z.string().describe("draft | active | archived"),
|
|
913
|
+
windowDays: import_zod7.z.number().describe("Conversion window in days"),
|
|
914
|
+
source: import_zod7.z.string().describe("user | chat | editor | sdk"),
|
|
915
|
+
steps: import_zod7.z.array(
|
|
916
|
+
import_zod7.z.object({
|
|
917
|
+
stepIndex: import_zod7.z.number(),
|
|
918
|
+
goalId: import_zod7.z.string(),
|
|
919
|
+
weight: import_zod7.z.number().nullable().describe("Manual optimizer credit for reaching this step (null = automatic end-weighted)")
|
|
920
|
+
})
|
|
921
|
+
).describe("Ordered steps"),
|
|
922
|
+
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)")
|
|
923
|
+
})
|
|
924
|
+
).describe("Defined funnels (empty if none)")
|
|
925
|
+
},
|
|
926
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
927
|
+
},
|
|
928
|
+
withApiErrorGuidance(async ({ projectId }) => {
|
|
929
|
+
var _a;
|
|
930
|
+
const id = encodeURIComponent(projectId);
|
|
931
|
+
const data = await client.get(`/projects/${id}/funnels`);
|
|
932
|
+
const structuredContent = {
|
|
933
|
+
funnels: ((_a = data.funnels) != null ? _a : []).map((f) => ({
|
|
934
|
+
funnelId: f.funnel_id,
|
|
935
|
+
displayName: f.display_name,
|
|
936
|
+
status: f.status,
|
|
937
|
+
windowDays: f.window_days,
|
|
938
|
+
source: f.source,
|
|
939
|
+
// NUMERIC arrives serialized as a string; coerce.
|
|
940
|
+
steps: f.steps.map((s) => ({
|
|
941
|
+
stepIndex: s.step_index,
|
|
942
|
+
goalId: s.goal_id,
|
|
943
|
+
weight: s.weight == null ? null : Number(s.weight)
|
|
944
|
+
})),
|
|
945
|
+
components: f.components.map((c) => {
|
|
946
|
+
var _a2;
|
|
947
|
+
return { componentId: c.component_id, stepIndex: (_a2 = c.step_index) != null ? _a2 : null };
|
|
948
|
+
})
|
|
949
|
+
}))
|
|
950
|
+
};
|
|
951
|
+
if (structuredContent.funnels.length === 0) {
|
|
952
|
+
return {
|
|
953
|
+
content: [{
|
|
954
|
+
type: "text",
|
|
955
|
+
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."
|
|
956
|
+
}],
|
|
957
|
+
structuredContent
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
const lines = structuredContent.funnels.map(
|
|
961
|
+
(f) => `${f.funnelId} (${f.status}) \u2014 ${f.displayName}: ${f.steps.map((s) => s.goalId).join(" \u2192 ")}`
|
|
962
|
+
);
|
|
963
|
+
lines.push("", 'Reference a funnelId verbatim from code: <Adaptive funnel="<funnelId>">. Use get_funnel_report for drop-off numbers.');
|
|
964
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
965
|
+
})
|
|
966
|
+
);
|
|
967
|
+
server.registerTool(
|
|
968
|
+
"get_funnel_report",
|
|
969
|
+
{
|
|
970
|
+
title: "Funnel drop-off report",
|
|
971
|
+
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.',
|
|
972
|
+
inputSchema: { projectId: projectIdSchema, funnelId: funnelIdSchema },
|
|
973
|
+
outputSchema: {
|
|
974
|
+
funnelId: import_zod7.z.string(),
|
|
975
|
+
displayName: import_zod7.z.string(),
|
|
976
|
+
windowDays: import_zod7.z.number(),
|
|
977
|
+
currency: import_zod7.z.string().describe("Project display currency (ISO-4217) for the revenue fields"),
|
|
978
|
+
steps: import_zod7.z.array(
|
|
979
|
+
import_zod7.z.object({
|
|
980
|
+
stepIndex: import_zod7.z.number(),
|
|
981
|
+
goalId: import_zod7.z.string(),
|
|
982
|
+
displayName: import_zod7.z.string(),
|
|
983
|
+
reached: import_zod7.z.number().describe("Distinct visitors reaching this step in-window"),
|
|
984
|
+
dropOffFromPrevious: import_zod7.z.number().nullable().describe("1 - reached/previousReached (null on the first step)"),
|
|
985
|
+
neverFired: import_zod7.z.boolean().describe("True when the step goal has never been recorded anywhere \u2014 likely a typo"),
|
|
986
|
+
variants: import_zod7.z.array(import_zod7.z.object({
|
|
987
|
+
componentId: import_zod7.z.string(),
|
|
988
|
+
variantId: import_zod7.z.string(),
|
|
989
|
+
reached: import_zod7.z.number(),
|
|
990
|
+
assigned: import_zod7.z.number().describe("Distinct sessions served this variant in-window (the rate denominator)")
|
|
991
|
+
})),
|
|
992
|
+
personas: import_zod7.z.array(import_zod7.z.object({ label: import_zod7.z.string(), reached: import_zod7.z.number() }))
|
|
993
|
+
})
|
|
994
|
+
),
|
|
995
|
+
revenue: import_zod7.z.number().nullable().describe("Final-step revenue in the project currency (null when no valued conversions)"),
|
|
996
|
+
avgOrderValue: import_zod7.z.number().nullable(),
|
|
997
|
+
revenuePerEnteringVisitor: import_zod7.z.number().nullable(),
|
|
998
|
+
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')
|
|
999
|
+
},
|
|
1000
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
1001
|
+
},
|
|
1002
|
+
withApiErrorGuidance(async ({ projectId, funnelId }) => {
|
|
1003
|
+
const data = await client.get(`/projects/${encodeURIComponent(projectId)}/funnels/${encodeURIComponent(funnelId)}/report`);
|
|
1004
|
+
const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
|
|
1005
|
+
for (const s of data.steps) {
|
|
1006
|
+
lines.push(
|
|
1007
|
+
`${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]" : "")
|
|
1008
|
+
);
|
|
1009
|
+
for (const v of s.variants) {
|
|
1010
|
+
lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
if (data.revenue != null) {
|
|
1014
|
+
lines.push(
|
|
1015
|
+
`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` : "")
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
if (data.holdoutCompletion && data.holdoutCompletion.entered > 0) {
|
|
1019
|
+
lines.push(`Without optimization: ${data.holdoutCompletion.reached} of ${data.holdoutCompletion.entered} holdout visitors finished.`);
|
|
1020
|
+
}
|
|
1021
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent: data };
|
|
1022
|
+
})
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// src/tools/guardrails.ts
|
|
1027
|
+
var import_zod8 = require("zod");
|
|
879
1028
|
function registerGuardrailTools(server, client) {
|
|
880
1029
|
server.registerTool(
|
|
881
1030
|
"list_guardrail_events",
|
|
@@ -884,11 +1033,11 @@ function registerGuardrailTools(server, client) {
|
|
|
884
1033
|
description: "List variants currently paused by the guardrail in the last 24 hours.",
|
|
885
1034
|
inputSchema: { projectId: projectIdSchema },
|
|
886
1035
|
outputSchema: {
|
|
887
|
-
events:
|
|
888
|
-
|
|
889
|
-
componentId:
|
|
890
|
-
variantIds:
|
|
891
|
-
pausedAt:
|
|
1036
|
+
events: import_zod8.z.array(
|
|
1037
|
+
import_zod8.z.object({
|
|
1038
|
+
componentId: import_zod8.z.string(),
|
|
1039
|
+
variantIds: import_zod8.z.array(import_zod8.z.string()).describe("Variants paused by the guardrail"),
|
|
1040
|
+
pausedAt: import_zod8.z.string().nullable().describe("ISO timestamp the pause fired, or null")
|
|
892
1041
|
})
|
|
893
1042
|
).describe("Guardrail events in the last 24h (empty if none)")
|
|
894
1043
|
},
|
|
@@ -923,7 +1072,7 @@ function registerGuardrailTools(server, client) {
|
|
|
923
1072
|
}
|
|
924
1073
|
|
|
925
1074
|
// src/tools/layout.ts
|
|
926
|
-
var
|
|
1075
|
+
var import_zod9 = require("zod");
|
|
927
1076
|
function registerLayoutTools(server, client) {
|
|
928
1077
|
server.registerTool(
|
|
929
1078
|
"get_layout_stats",
|
|
@@ -933,12 +1082,12 @@ function registerLayoutTools(server, client) {
|
|
|
933
1082
|
inputSchema: { projectId: projectIdSchema },
|
|
934
1083
|
_meta: uiMeta("layout-stats"),
|
|
935
1084
|
outputSchema: {
|
|
936
|
-
layouts:
|
|
937
|
-
|
|
938
|
-
persona:
|
|
939
|
-
layoutOrder:
|
|
940
|
-
pulls:
|
|
941
|
-
avgReward:
|
|
1085
|
+
layouts: import_zod9.z.array(
|
|
1086
|
+
import_zod9.z.object({
|
|
1087
|
+
persona: import_zod9.z.string(),
|
|
1088
|
+
layoutOrder: import_zod9.z.array(import_zod9.z.string()).describe("Ranked section order for this persona"),
|
|
1089
|
+
pulls: import_zod9.z.number().describe("Number of times this arm was served"),
|
|
1090
|
+
avgReward: import_zod9.z.number().describe("Average bandit reward weight")
|
|
942
1091
|
})
|
|
943
1092
|
).describe("Per-persona layout rankings (empty until enough sessions)")
|
|
944
1093
|
},
|
|
@@ -975,7 +1124,7 @@ function registerLayoutTools(server, client) {
|
|
|
975
1124
|
}
|
|
976
1125
|
|
|
977
1126
|
// src/tools/variants.ts
|
|
978
|
-
var
|
|
1127
|
+
var import_zod10 = require("zod");
|
|
979
1128
|
function registerVariantWriteTools(server, client) {
|
|
980
1129
|
server.registerTool(
|
|
981
1130
|
"create_variant",
|
|
@@ -984,19 +1133,19 @@ function registerVariantWriteTools(server, client) {
|
|
|
984
1133
|
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).",
|
|
985
1134
|
inputSchema: {
|
|
986
1135
|
projectId: projectIdSchema,
|
|
987
|
-
componentId:
|
|
988
|
-
displayName:
|
|
989
|
-
content:
|
|
1136
|
+
componentId: import_zod10.z.string().min(1).max(200).describe("The component ID to add a variant to"),
|
|
1137
|
+
displayName: import_zod10.z.string().min(1).max(200).describe("Human-readable name for the new variant"),
|
|
1138
|
+
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.")
|
|
990
1139
|
},
|
|
991
1140
|
outputSchema: {
|
|
992
|
-
variantId:
|
|
1141
|
+
variantId: import_zod10.z.string().describe("The new variant ID"),
|
|
993
1142
|
// API returns `body.displayName ?? null`, so a successful create can
|
|
994
1143
|
// carry a null name — match that contract or outputSchema validation
|
|
995
1144
|
// would reject an otherwise-successful response.
|
|
996
|
-
displayName:
|
|
997
|
-
componentId:
|
|
998
|
-
state:
|
|
999
|
-
hasContent:
|
|
1145
|
+
displayName: import_zod10.z.string().nullable(),
|
|
1146
|
+
componentId: import_zod10.z.string(),
|
|
1147
|
+
state: import_zod10.z.literal("draft").describe("New managed variants start in draft state"),
|
|
1148
|
+
hasContent: import_zod10.z.boolean().describe("Whether text content was provided at creation")
|
|
1000
1149
|
},
|
|
1001
1150
|
annotations: {
|
|
1002
1151
|
readOnlyHint: false,
|
|
@@ -1034,13 +1183,13 @@ function registerVariantWriteTools(server, client) {
|
|
|
1034
1183
|
description: "Pause a variant, stopping traffic from being assigned to it.",
|
|
1035
1184
|
inputSchema: {
|
|
1036
1185
|
projectId: projectIdSchema,
|
|
1037
|
-
componentId:
|
|
1038
|
-
variantId:
|
|
1186
|
+
componentId: import_zod10.z.string().describe("The component ID"),
|
|
1187
|
+
variantId: import_zod10.z.string().describe("The variant ID to pause")
|
|
1039
1188
|
},
|
|
1040
1189
|
outputSchema: {
|
|
1041
|
-
variantId:
|
|
1042
|
-
componentId:
|
|
1043
|
-
paused:
|
|
1190
|
+
variantId: import_zod10.z.string(),
|
|
1191
|
+
componentId: import_zod10.z.string(),
|
|
1192
|
+
paused: import_zod10.z.literal(true).describe("The variant is now paused")
|
|
1044
1193
|
},
|
|
1045
1194
|
annotations: {
|
|
1046
1195
|
readOnlyHint: false,
|
|
@@ -1068,8 +1217,8 @@ function registerVariantWriteTools(server, client) {
|
|
|
1068
1217
|
description: "Trigger fresh AI insight generation for a project. Returns immediately; use get_insights in ~15 seconds to see results.",
|
|
1069
1218
|
inputSchema: { projectId: projectIdSchema },
|
|
1070
1219
|
outputSchema: {
|
|
1071
|
-
projectId:
|
|
1072
|
-
status:
|
|
1220
|
+
projectId: import_zod10.z.string(),
|
|
1221
|
+
status: import_zod10.z.literal("generating").describe("Generation has been triggered")
|
|
1073
1222
|
},
|
|
1074
1223
|
annotations: {
|
|
1075
1224
|
readOnlyHint: false,
|
|
@@ -1093,7 +1242,7 @@ function registerVariantWriteTools(server, client) {
|
|
|
1093
1242
|
}
|
|
1094
1243
|
|
|
1095
1244
|
// src/tools/variant-brief.ts
|
|
1096
|
-
var
|
|
1245
|
+
var import_zod11 = require("zod");
|
|
1097
1246
|
var GOAL_TARGET = 500;
|
|
1098
1247
|
var BEST_PRACTICE_PRIORS = {
|
|
1099
1248
|
ecommerce: [
|
|
@@ -1166,15 +1315,15 @@ function registerVariantBriefTools(server, client) {
|
|
|
1166
1315
|
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.",
|
|
1167
1316
|
inputSchema: {
|
|
1168
1317
|
projectId: projectIdSchema,
|
|
1169
|
-
componentId:
|
|
1318
|
+
componentId: import_zod11.z.string().describe('The component ID to write a new variant for (matches <Adaptive id="...">).')
|
|
1170
1319
|
},
|
|
1171
1320
|
outputSchema: {
|
|
1172
|
-
componentId:
|
|
1173
|
-
contextType:
|
|
1174
|
-
dataState:
|
|
1175
|
-
existingVariantIds:
|
|
1176
|
-
priors:
|
|
1177
|
-
markdown:
|
|
1321
|
+
componentId: import_zod11.z.string(),
|
|
1322
|
+
contextType: import_zod11.z.string().describe("The project's context type (or 'unknown')"),
|
|
1323
|
+
dataState: import_zod11.z.enum(["sufficient", "collecting", "empty"]).describe("Data-sufficiency assessment"),
|
|
1324
|
+
existingVariantIds: import_zod11.z.array(import_zod11.z.string()).describe("Variant IDs already in use (do not reuse)"),
|
|
1325
|
+
priors: import_zod11.z.array(import_zod11.z.string()).describe("Best-practice priors applied for this context type"),
|
|
1326
|
+
markdown: import_zod11.z.string().describe("The full variant brief in Markdown")
|
|
1178
1327
|
},
|
|
1179
1328
|
annotations: {
|
|
1180
1329
|
readOnlyHint: true,
|
|
@@ -1291,7 +1440,7 @@ function registerVariantBriefTools(server, client) {
|
|
|
1291
1440
|
}
|
|
1292
1441
|
|
|
1293
1442
|
// src/tools/test-brief.ts
|
|
1294
|
-
var
|
|
1443
|
+
var import_zod12 = require("zod");
|
|
1295
1444
|
async function settled2(p) {
|
|
1296
1445
|
try {
|
|
1297
1446
|
return await p;
|
|
@@ -1307,13 +1456,13 @@ function registerTestBriefTools(server, client) {
|
|
|
1307
1456
|
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).",
|
|
1308
1457
|
inputSchema: {
|
|
1309
1458
|
projectId: projectIdSchema,
|
|
1310
|
-
componentId:
|
|
1459
|
+
componentId: import_zod12.z.string().describe('The component ID to write a test for (matches <Adaptive id="...">).')
|
|
1311
1460
|
},
|
|
1312
1461
|
outputSchema: {
|
|
1313
|
-
componentId:
|
|
1314
|
-
forcedVariantId:
|
|
1315
|
-
goalName:
|
|
1316
|
-
markdown:
|
|
1462
|
+
componentId: import_zod12.z.string(),
|
|
1463
|
+
forcedVariantId: import_zod12.z.string().describe("The non-control variant the example forces"),
|
|
1464
|
+
goalName: import_zod12.z.string().describe("The goal the example asserts fires"),
|
|
1465
|
+
markdown: import_zod12.z.string().describe("The full test brief in Markdown")
|
|
1317
1466
|
},
|
|
1318
1467
|
annotations: {
|
|
1319
1468
|
readOnlyHint: true,
|
|
@@ -1396,7 +1545,7 @@ function registerTestBriefTools(server, client) {
|
|
|
1396
1545
|
}
|
|
1397
1546
|
|
|
1398
1547
|
// src/tools/integration-guide.ts
|
|
1399
|
-
var
|
|
1548
|
+
var import_zod13 = require("zod");
|
|
1400
1549
|
var GUIDE = `# SentientUI integration guide \u2014 the adaptive ladder
|
|
1401
1550
|
|
|
1402
1551
|
SentientUI adapts a site per visitor type (personas: buyer, researcher, deal_seeker, browser,
|
|
@@ -1471,7 +1620,7 @@ function registerIntegrationGuideTools(server) {
|
|
|
1471
1620
|
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.",
|
|
1472
1621
|
inputSchema: {},
|
|
1473
1622
|
outputSchema: {
|
|
1474
|
-
guide:
|
|
1623
|
+
guide: import_zod13.z.string().describe("The full integration guide in Markdown")
|
|
1475
1624
|
},
|
|
1476
1625
|
annotations: {
|
|
1477
1626
|
readOnlyHint: true,
|
|
@@ -1487,7 +1636,7 @@ function registerIntegrationGuideTools(server) {
|
|
|
1487
1636
|
}
|
|
1488
1637
|
|
|
1489
1638
|
// src/tools/agent-traffic.ts
|
|
1490
|
-
var
|
|
1639
|
+
var import_zod14 = require("zod");
|
|
1491
1640
|
var PLAN_GATE_GUIDANCE = {
|
|
1492
1641
|
agent_analytics_requires_paid_plan: "Agent analytics requires a paid SentientUI plan (Starter or above). Upgrade at https://sentient-ui.com, then try again."
|
|
1493
1642
|
};
|
|
@@ -1499,19 +1648,19 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1499
1648
|
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.",
|
|
1500
1649
|
inputSchema: { projectId: projectIdSchema },
|
|
1501
1650
|
outputSchema: {
|
|
1502
|
-
totals:
|
|
1503
|
-
engines:
|
|
1504
|
-
|
|
1505
|
-
engine:
|
|
1506
|
-
intent:
|
|
1507
|
-
count:
|
|
1508
|
-
sharePct:
|
|
1509
|
-
lastSeen:
|
|
1510
|
-
firstSeenInRange:
|
|
1651
|
+
totals: import_zod14.z.object({ crawler: import_zod14.z.number(), api: import_zod14.z.number(), browser: import_zod14.z.number() }),
|
|
1652
|
+
engines: import_zod14.z.array(
|
|
1653
|
+
import_zod14.z.object({
|
|
1654
|
+
engine: import_zod14.z.string(),
|
|
1655
|
+
intent: import_zod14.z.string().describe("user | search | training | other"),
|
|
1656
|
+
count: import_zod14.z.number(),
|
|
1657
|
+
sharePct: import_zod14.z.number(),
|
|
1658
|
+
lastSeen: import_zod14.z.string(),
|
|
1659
|
+
firstSeenInRange: import_zod14.z.boolean().describe("First observed within the queried period")
|
|
1511
1660
|
})
|
|
1512
1661
|
),
|
|
1513
|
-
intents:
|
|
1514
|
-
topPaths:
|
|
1662
|
+
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"),
|
|
1663
|
+
topPaths: import_zod14.z.array(import_zod14.z.object({ path: import_zod14.z.string(), count: import_zod14.z.number(), engines: import_zod14.z.number() }))
|
|
1515
1664
|
},
|
|
1516
1665
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
1517
1666
|
},
|
|
@@ -1549,26 +1698,26 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1549
1698
|
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.",
|
|
1550
1699
|
inputSchema: { projectId: projectIdSchema },
|
|
1551
1700
|
outputSchema: {
|
|
1552
|
-
paths:
|
|
1553
|
-
|
|
1554
|
-
path:
|
|
1555
|
-
score:
|
|
1556
|
-
checks:
|
|
1557
|
-
price:
|
|
1558
|
-
name:
|
|
1559
|
-
positioning:
|
|
1560
|
-
cta:
|
|
1561
|
-
notes:
|
|
1701
|
+
paths: import_zod14.z.array(
|
|
1702
|
+
import_zod14.z.object({
|
|
1703
|
+
path: import_zod14.z.string(),
|
|
1704
|
+
score: import_zod14.z.number().describe("0\u2013100, 25 per passing check"),
|
|
1705
|
+
checks: import_zod14.z.object({
|
|
1706
|
+
price: import_zod14.z.boolean(),
|
|
1707
|
+
name: import_zod14.z.boolean(),
|
|
1708
|
+
positioning: import_zod14.z.boolean(),
|
|
1709
|
+
cta: import_zod14.z.boolean(),
|
|
1710
|
+
notes: import_zod14.z.array(import_zod14.z.string())
|
|
1562
1711
|
}),
|
|
1563
|
-
fixes:
|
|
1564
|
-
check:
|
|
1565
|
-
advice:
|
|
1566
|
-
snippet:
|
|
1712
|
+
fixes: import_zod14.z.array(import_zod14.z.object({
|
|
1713
|
+
check: import_zod14.z.string(),
|
|
1714
|
+
advice: import_zod14.z.string(),
|
|
1715
|
+
snippet: import_zod14.z.string().optional()
|
|
1567
1716
|
})).optional().describe("Concrete Next.js remediation per failing check"),
|
|
1568
|
-
lastChecked:
|
|
1717
|
+
lastChecked: import_zod14.z.string()
|
|
1569
1718
|
})
|
|
1570
1719
|
),
|
|
1571
|
-
emptyBlocks:
|
|
1720
|
+
emptyBlocks: import_zod14.z.array(import_zod14.z.object({ block: import_zod14.z.string(), variant: import_zod14.z.string(), occurrences: import_zod14.z.number() }))
|
|
1572
1721
|
},
|
|
1573
1722
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
1574
1723
|
},
|
|
@@ -1605,7 +1754,7 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1605
1754
|
}
|
|
1606
1755
|
|
|
1607
1756
|
// src/server.ts
|
|
1608
|
-
var PKG_VERSION = true ? "0.
|
|
1757
|
+
var PKG_VERSION = true ? "0.13.0" : "0.0.0-dev";
|
|
1609
1758
|
function createMcpServer(client) {
|
|
1610
1759
|
const server = new import_mcp.McpServer(
|
|
1611
1760
|
{
|
|
@@ -1632,6 +1781,7 @@ function createMcpServer(client) {
|
|
|
1632
1781
|
registerInsightTools(server, client);
|
|
1633
1782
|
registerPersonaTools(server, client);
|
|
1634
1783
|
registerGoalTools(server, client);
|
|
1784
|
+
registerFunnelTools(server, client);
|
|
1635
1785
|
registerGuardrailTools(server, client);
|
|
1636
1786
|
registerLayoutTools(server, client);
|
|
1637
1787
|
registerVariantBriefTools(server, client);
|
package/dist/lib.js
CHANGED