@sentientui/mcp 0.10.0 → 0.12.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/README.md +1 -0
- package/dist/{chunk-ZH3EDKIT.js → chunk-BMOKDBGH.js} +93 -17
- package/dist/index.cjs +93 -17
- package/dist/index.js +1 -1
- package/dist/lib.cjs +93 -17
- package/dist/lib.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,6 +93,7 @@ A sandboxed demo token is provisioned automatically — 10 calls/month, read-onl
|
|
|
93
93
|
| `refresh_insights` | Trigger fresh AI insight generation |
|
|
94
94
|
| `get_persona_breakdown` | Visitor cluster distribution with reliability scores |
|
|
95
95
|
| `get_goal_funnel` | Goal hit counts and conversion rates per variant |
|
|
96
|
+
| `list_goals` | Defined goals (id, role, event, status) — includes goals with no conversions yet, so agents can wire a dashboard-defined goal into code |
|
|
96
97
|
| `list_guardrail_events` | Variants auto-paused by the guardrail (last 24h) |
|
|
97
98
|
| `get_layout_stats` | Per-persona section layout rankings and reward weights |
|
|
98
99
|
| `get_integration_guide` | SentientUI adaptive-ladder setup guide (static — same for every project) |
|
|
@@ -734,12 +734,16 @@ function registerGoalTools(server, client) {
|
|
|
734
734
|
inputSchema: { projectId: projectIdSchema },
|
|
735
735
|
_meta: uiMeta("goal-funnel"),
|
|
736
736
|
outputSchema: {
|
|
737
|
+
currency: z6.string().describe("Project display currency (ISO-4217) for the revenue fields"),
|
|
737
738
|
goals: z6.array(
|
|
738
739
|
z6.object({
|
|
739
740
|
goalName: z6.string(),
|
|
740
741
|
hits: z6.number(),
|
|
741
742
|
uniqueSessions: z6.number(),
|
|
742
743
|
conversionRate: z6.number().describe("Unique-session conversion rate (0-1)"),
|
|
744
|
+
revenue: z6.number().nullable().describe("Total revenue from valued conversions, in the project currency (null for valueless goals)"),
|
|
745
|
+
avgOrderValue: z6.number().nullable().describe("Average value per valued conversion (null for valueless goals)"),
|
|
746
|
+
revenuePerSession: z6.number().nullable().describe("Revenue divided by all project sessions (null for valueless goals)"),
|
|
743
747
|
variants: z6.array(
|
|
744
748
|
z6.object({
|
|
745
749
|
componentId: z6.string(),
|
|
@@ -757,20 +761,28 @@ function registerGoalTools(server, client) {
|
|
|
757
761
|
}
|
|
758
762
|
},
|
|
759
763
|
withApiErrorGuidance(async ({ projectId }) => {
|
|
764
|
+
var _a, _b;
|
|
760
765
|
const id = encodeURIComponent(projectId);
|
|
761
766
|
const data = await client.get(`/projects/${id}/goals`);
|
|
762
767
|
const structuredContent = {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
768
|
+
currency: (_a = data.currency) != null ? _a : "USD",
|
|
769
|
+
goals: data.goals.map((g) => {
|
|
770
|
+
var _a2, _b2, _c;
|
|
771
|
+
return {
|
|
772
|
+
goalName: g.goalName,
|
|
773
|
+
hits: g.hits,
|
|
774
|
+
uniqueSessions: g.uniqueSessions,
|
|
775
|
+
conversionRate: g.pct,
|
|
776
|
+
revenue: (_a2 = g.revenue) != null ? _a2 : null,
|
|
777
|
+
avgOrderValue: (_b2 = g.avgOrderValue) != null ? _b2 : null,
|
|
778
|
+
revenuePerSession: (_c = g.revenuePerSession) != null ? _c : null,
|
|
779
|
+
variants: g.variants.map((v) => ({
|
|
780
|
+
componentId: v.componentId,
|
|
781
|
+
variantId: v.variantId,
|
|
782
|
+
completionRate: v.completionRate
|
|
783
|
+
}))
|
|
784
|
+
};
|
|
785
|
+
})
|
|
774
786
|
};
|
|
775
787
|
if (!data.goals.length) {
|
|
776
788
|
return {
|
|
@@ -779,14 +791,78 @@ function registerGoalTools(server, client) {
|
|
|
779
791
|
_meta: uiMeta("goal-funnel")
|
|
780
792
|
};
|
|
781
793
|
}
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
794
|
+
const currency = (_b = data.currency) != null ? _b : "USD";
|
|
795
|
+
const lines = data.goals.flatMap((g) => {
|
|
796
|
+
var _a2;
|
|
797
|
+
return [
|
|
798
|
+
`${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)` : ""),
|
|
799
|
+
...g.variants.map((v) => ` ${v.componentId}/${v.variantId}: ${(v.completionRate * 100).toFixed(1)}% per assigned session`),
|
|
800
|
+
""
|
|
801
|
+
];
|
|
802
|
+
});
|
|
787
803
|
return { content: [{ type: "text", text: lines.join("\n").trim() }], structuredContent, _meta: uiMeta("goal-funnel") };
|
|
788
804
|
})
|
|
789
805
|
);
|
|
806
|
+
server.registerTool(
|
|
807
|
+
"list_goals",
|
|
808
|
+
{
|
|
809
|
+
title: "List goal definitions",
|
|
810
|
+
description: `List the project's defined goals \u2014 including ones with no conversions yet, which get_goal_funnel cannot see. Returns each goal's stable id, display name, role (primary/secondary/guardrail), event type, and status. Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`,
|
|
811
|
+
inputSchema: { projectId: projectIdSchema },
|
|
812
|
+
outputSchema: {
|
|
813
|
+
goals: z6.array(
|
|
814
|
+
z6.object({
|
|
815
|
+
goalId: z6.string().describe("Stable id \u2014 use this exact string when firing the goal from code"),
|
|
816
|
+
displayName: z6.string(),
|
|
817
|
+
role: z6.string().describe("primary | secondary | guardrail"),
|
|
818
|
+
event: z6.string().describe("click | form_submit | url_reached"),
|
|
819
|
+
urlPattern: z6.string().nullable().describe("Only for url_reached goals"),
|
|
820
|
+
status: z6.string().describe("active | archived"),
|
|
821
|
+
defaultValue: z6.number().nullable().describe("Fixed worth applied when a conversion carries no explicit value (project currency); null when unset")
|
|
822
|
+
})
|
|
823
|
+
).describe("Defined goals (empty if none)")
|
|
824
|
+
},
|
|
825
|
+
annotations: {
|
|
826
|
+
readOnlyHint: true,
|
|
827
|
+
idempotentHint: true,
|
|
828
|
+
openWorldHint: false
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
withApiErrorGuidance(async ({ projectId }) => {
|
|
832
|
+
const id = encodeURIComponent(projectId);
|
|
833
|
+
const data = await client.get(`/projects/${id}/goal-definitions`);
|
|
834
|
+
const structuredContent = {
|
|
835
|
+
goals: data.goals.map((g) => {
|
|
836
|
+
var _a;
|
|
837
|
+
return {
|
|
838
|
+
goalId: g.goal_id,
|
|
839
|
+
displayName: g.display_name,
|
|
840
|
+
role: g.role,
|
|
841
|
+
event: g.event,
|
|
842
|
+
urlPattern: (_a = g.url_pattern) != null ? _a : null,
|
|
843
|
+
status: g.status,
|
|
844
|
+
// NUMERIC arrives serialized as a string; coerce and tolerate its
|
|
845
|
+
// absence from an older API deploy.
|
|
846
|
+
defaultValue: g.default_value != null ? Number(g.default_value) : null
|
|
847
|
+
};
|
|
848
|
+
})
|
|
849
|
+
};
|
|
850
|
+
if (!structuredContent.goals.length) {
|
|
851
|
+
return {
|
|
852
|
+
content: [{
|
|
853
|
+
type: "text",
|
|
854
|
+
text: "No goal definitions yet. Define one in the dashboard (Goals page or onboarding chat), or fire client.goal('<name>') from code and it will appear in get_goal_funnel once it converts."
|
|
855
|
+
}],
|
|
856
|
+
structuredContent
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
const lines = structuredContent.goals.map(
|
|
860
|
+
(g) => `${g.goalId} (${g.role}, ${g.event}${g.status === "archived" ? ", archived" : ""}) \u2014 ${g.displayName}`
|
|
861
|
+
);
|
|
862
|
+
lines.push("", `Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`);
|
|
863
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
864
|
+
})
|
|
865
|
+
);
|
|
790
866
|
}
|
|
791
867
|
|
|
792
868
|
// src/tools/guardrails.ts
|
|
@@ -1520,7 +1596,7 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1520
1596
|
}
|
|
1521
1597
|
|
|
1522
1598
|
// src/server.ts
|
|
1523
|
-
var PKG_VERSION = true ? "0.
|
|
1599
|
+
var PKG_VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
1524
1600
|
function createMcpServer(client) {
|
|
1525
1601
|
const server = new McpServer(
|
|
1526
1602
|
{
|
package/dist/index.cjs
CHANGED
|
@@ -738,12 +738,16 @@ function registerGoalTools(server, client) {
|
|
|
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,14 +795,78 @@ 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
|
);
|
|
810
|
+
server.registerTool(
|
|
811
|
+
"list_goals",
|
|
812
|
+
{
|
|
813
|
+
title: "List goal definitions",
|
|
814
|
+
description: `List the project's defined goals \u2014 including ones with no conversions yet, which get_goal_funnel cannot see. Returns each goal's stable id, display name, role (primary/secondary/guardrail), event type, and status. Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`,
|
|
815
|
+
inputSchema: { projectId: projectIdSchema },
|
|
816
|
+
outputSchema: {
|
|
817
|
+
goals: import_zod6.z.array(
|
|
818
|
+
import_zod6.z.object({
|
|
819
|
+
goalId: import_zod6.z.string().describe("Stable id \u2014 use this exact string when firing the goal from code"),
|
|
820
|
+
displayName: import_zod6.z.string(),
|
|
821
|
+
role: import_zod6.z.string().describe("primary | secondary | guardrail"),
|
|
822
|
+
event: import_zod6.z.string().describe("click | form_submit | url_reached"),
|
|
823
|
+
urlPattern: import_zod6.z.string().nullable().describe("Only for url_reached goals"),
|
|
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")
|
|
826
|
+
})
|
|
827
|
+
).describe("Defined goals (empty if none)")
|
|
828
|
+
},
|
|
829
|
+
annotations: {
|
|
830
|
+
readOnlyHint: true,
|
|
831
|
+
idempotentHint: true,
|
|
832
|
+
openWorldHint: false
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
withApiErrorGuidance(async ({ projectId }) => {
|
|
836
|
+
const id = encodeURIComponent(projectId);
|
|
837
|
+
const data = await client.get(`/projects/${id}/goal-definitions`);
|
|
838
|
+
const structuredContent = {
|
|
839
|
+
goals: data.goals.map((g) => {
|
|
840
|
+
var _a2;
|
|
841
|
+
return {
|
|
842
|
+
goalId: g.goal_id,
|
|
843
|
+
displayName: g.display_name,
|
|
844
|
+
role: g.role,
|
|
845
|
+
event: g.event,
|
|
846
|
+
urlPattern: (_a2 = g.url_pattern) != null ? _a2 : null,
|
|
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
|
|
851
|
+
};
|
|
852
|
+
})
|
|
853
|
+
};
|
|
854
|
+
if (!structuredContent.goals.length) {
|
|
855
|
+
return {
|
|
856
|
+
content: [{
|
|
857
|
+
type: "text",
|
|
858
|
+
text: "No goal definitions yet. Define one in the dashboard (Goals page or onboarding chat), or fire client.goal('<name>') from code and it will appear in get_goal_funnel once it converts."
|
|
859
|
+
}],
|
|
860
|
+
structuredContent
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
const lines = structuredContent.goals.map(
|
|
864
|
+
(g) => `${g.goalId} (${g.role}, ${g.event}${g.status === "archived" ? ", archived" : ""}) \u2014 ${g.displayName}`
|
|
865
|
+
);
|
|
866
|
+
lines.push("", `Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`);
|
|
867
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
868
|
+
})
|
|
869
|
+
);
|
|
794
870
|
}
|
|
795
871
|
|
|
796
872
|
// src/tools/guardrails.ts
|
|
@@ -1524,7 +1600,7 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1524
1600
|
}
|
|
1525
1601
|
|
|
1526
1602
|
// src/server.ts
|
|
1527
|
-
var PKG_VERSION = true ? "0.
|
|
1603
|
+
var PKG_VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
1528
1604
|
function createMcpServer(client) {
|
|
1529
1605
|
const server = new import_mcp.McpServer(
|
|
1530
1606
|
{
|
package/dist/index.js
CHANGED
package/dist/lib.cjs
CHANGED
|
@@ -763,12 +763,16 @@ function registerGoalTools(server, client) {
|
|
|
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,14 +820,78 @@ 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
|
);
|
|
835
|
+
server.registerTool(
|
|
836
|
+
"list_goals",
|
|
837
|
+
{
|
|
838
|
+
title: "List goal definitions",
|
|
839
|
+
description: `List the project's defined goals \u2014 including ones with no conversions yet, which get_goal_funnel cannot see. Returns each goal's stable id, display name, role (primary/secondary/guardrail), event type, and status. Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`,
|
|
840
|
+
inputSchema: { projectId: projectIdSchema },
|
|
841
|
+
outputSchema: {
|
|
842
|
+
goals: import_zod6.z.array(
|
|
843
|
+
import_zod6.z.object({
|
|
844
|
+
goalId: import_zod6.z.string().describe("Stable id \u2014 use this exact string when firing the goal from code"),
|
|
845
|
+
displayName: import_zod6.z.string(),
|
|
846
|
+
role: import_zod6.z.string().describe("primary | secondary | guardrail"),
|
|
847
|
+
event: import_zod6.z.string().describe("click | form_submit | url_reached"),
|
|
848
|
+
urlPattern: import_zod6.z.string().nullable().describe("Only for url_reached goals"),
|
|
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")
|
|
851
|
+
})
|
|
852
|
+
).describe("Defined goals (empty if none)")
|
|
853
|
+
},
|
|
854
|
+
annotations: {
|
|
855
|
+
readOnlyHint: true,
|
|
856
|
+
idempotentHint: true,
|
|
857
|
+
openWorldHint: false
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
withApiErrorGuidance(async ({ projectId }) => {
|
|
861
|
+
const id = encodeURIComponent(projectId);
|
|
862
|
+
const data = await client.get(`/projects/${id}/goal-definitions`);
|
|
863
|
+
const structuredContent = {
|
|
864
|
+
goals: data.goals.map((g) => {
|
|
865
|
+
var _a;
|
|
866
|
+
return {
|
|
867
|
+
goalId: g.goal_id,
|
|
868
|
+
displayName: g.display_name,
|
|
869
|
+
role: g.role,
|
|
870
|
+
event: g.event,
|
|
871
|
+
urlPattern: (_a = g.url_pattern) != null ? _a : null,
|
|
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
|
|
876
|
+
};
|
|
877
|
+
})
|
|
878
|
+
};
|
|
879
|
+
if (!structuredContent.goals.length) {
|
|
880
|
+
return {
|
|
881
|
+
content: [{
|
|
882
|
+
type: "text",
|
|
883
|
+
text: "No goal definitions yet. Define one in the dashboard (Goals page or onboarding chat), or fire client.goal('<name>') from code and it will appear in get_goal_funnel once it converts."
|
|
884
|
+
}],
|
|
885
|
+
structuredContent
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
const lines = structuredContent.goals.map(
|
|
889
|
+
(g) => `${g.goalId} (${g.role}, ${g.event}${g.status === "archived" ? ", archived" : ""}) \u2014 ${g.displayName}`
|
|
890
|
+
);
|
|
891
|
+
lines.push("", `Reference a goalId verbatim from code: client.goal('<goalId>') or <Adaptive goal="<goalId>">.`);
|
|
892
|
+
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
893
|
+
})
|
|
894
|
+
);
|
|
819
895
|
}
|
|
820
896
|
|
|
821
897
|
// src/tools/guardrails.ts
|
|
@@ -1549,7 +1625,7 @@ function registerAgentTrafficTools(server, client) {
|
|
|
1549
1625
|
}
|
|
1550
1626
|
|
|
1551
1627
|
// src/server.ts
|
|
1552
|
-
var PKG_VERSION = true ? "0.
|
|
1628
|
+
var PKG_VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
1553
1629
|
function createMcpServer(client) {
|
|
1554
1630
|
const server = new import_mcp.McpServer(
|
|
1555
1631
|
{
|
package/dist/lib.js
CHANGED