@capivv/mcp-server 0.2.0 → 0.5.1
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/client.d.ts +52 -1
- package/dist/client.js +189 -0
- package/dist/tools/approve-change-request.d.ts +3 -0
- package/dist/tools/approve-change-request.js +16 -0
- package/dist/tools/archive-app.d.ts +3 -0
- package/dist/tools/archive-app.js +9 -0
- package/dist/tools/check-drift.d.ts +3 -0
- package/dist/tools/check-drift.js +21 -0
- package/dist/tools/connect-apple-integration.d.ts +3 -0
- package/dist/tools/connect-apple-integration.js +27 -0
- package/dist/tools/connect-google-integration.d.ts +3 -0
- package/dist/tools/connect-google-integration.js +20 -0
- package/dist/tools/create-experiment.d.ts +3 -0
- package/dist/tools/create-experiment.js +43 -0
- package/dist/tools/create-paywall.d.ts +3 -0
- package/dist/tools/create-paywall.js +18 -0
- package/dist/tools/create-pricing-strategy.d.ts +3 -0
- package/dist/tools/create-pricing-strategy.js +49 -0
- package/dist/tools/create-product.js +43 -8
- package/dist/tools/create-promotion.d.ts +3 -0
- package/dist/tools/create-promotion.js +35 -0
- package/dist/tools/create-rescue-flow.d.ts +3 -0
- package/dist/tools/create-rescue-flow.js +20 -0
- package/dist/tools/delete-app.d.ts +3 -0
- package/dist/tools/delete-app.js +9 -0
- package/dist/tools/delete-entitlement.d.ts +3 -0
- package/dist/tools/delete-entitlement.js +11 -0
- package/dist/tools/delete-paywall.d.ts +3 -0
- package/dist/tools/delete-paywall.js +16 -0
- package/dist/tools/delete-promotion.d.ts +3 -0
- package/dist/tools/delete-promotion.js +11 -0
- package/dist/tools/delete-rescue-flow.d.ts +3 -0
- package/dist/tools/delete-rescue-flow.js +11 -0
- package/dist/tools/disconnect-integration.d.ts +3 -0
- package/dist/tools/disconnect-integration.js +13 -0
- package/dist/tools/get-entitlement.d.ts +3 -0
- package/dist/tools/get-entitlement.js +9 -0
- package/dist/tools/get-experiment-summary.d.ts +3 -0
- package/dist/tools/get-experiment-summary.js +9 -0
- package/dist/tools/get-offering.d.ts +3 -0
- package/dist/tools/get-offering.js +9 -0
- package/dist/tools/get-paywall-stats.d.ts +3 -0
- package/dist/tools/get-paywall-stats.js +6 -0
- package/dist/tools/get-product.d.ts +3 -0
- package/dist/tools/get-product.js +9 -0
- package/dist/tools/get-rescue-stats.d.ts +3 -0
- package/dist/tools/get-rescue-stats.js +12 -0
- package/dist/tools/get-rule.d.ts +3 -0
- package/dist/tools/get-rule.js +9 -0
- package/dist/tools/index.js +115 -0
- package/dist/tools/list-change-requests.d.ts +3 -0
- package/dist/tools/list-change-requests.js +14 -0
- package/dist/tools/list-integrations.d.ts +3 -0
- package/dist/tools/list-integrations.js +6 -0
- package/dist/tools/list-paywalls.d.ts +3 -0
- package/dist/tools/list-paywalls.js +6 -0
- package/dist/tools/list-pricing-strategies.d.ts +3 -0
- package/dist/tools/list-pricing-strategies.js +8 -0
- package/dist/tools/list-promotions.d.ts +3 -0
- package/dist/tools/list-promotions.js +6 -0
- package/dist/tools/list-rescue-flows.d.ts +3 -0
- package/dist/tools/list-rescue-flows.js +6 -0
- package/dist/tools/list-rule-versions.d.ts +3 -0
- package/dist/tools/list-rule-versions.js +9 -0
- package/dist/tools/next-step.js +3 -3
- package/dist/tools/preview-pricing.d.ts +3 -0
- package/dist/tools/preview-pricing.js +13 -0
- package/dist/tools/push-prices-to-stores.d.ts +3 -0
- package/dist/tools/push-prices-to-stores.js +9 -0
- package/dist/tools/recompute-prices.d.ts +3 -0
- package/dist/tools/recompute-prices.js +24 -0
- package/dist/tools/resolve-drift.d.ts +3 -0
- package/dist/tools/resolve-drift.js +15 -0
- package/dist/tools/restore-app.d.ts +3 -0
- package/dist/tools/restore-app.js +9 -0
- package/dist/tools/revert-app-autopilot.d.ts +3 -0
- package/dist/tools/revert-app-autopilot.js +9 -0
- package/dist/tools/rollback-rule.d.ts +3 -0
- package/dist/tools/rollback-rule.js +10 -0
- package/dist/tools/run-app-autopilot.d.ts +3 -0
- package/dist/tools/run-app-autopilot.js +9 -0
- package/dist/tools/set-country-price-override.d.ts +3 -0
- package/dist/tools/set-country-price-override.js +13 -0
- package/dist/tools/setup-wizard.js +1 -1
- package/dist/tools/start-experiment.d.ts +3 -0
- package/dist/tools/start-experiment.js +9 -0
- package/dist/tools/stop-experiment.d.ts +3 -0
- package/dist/tools/stop-experiment.js +9 -0
- package/dist/tools/sync-suggestions-count.d.ts +3 -0
- package/dist/tools/sync-suggestions-count.js +6 -0
- package/dist/tools/trigger-sync.d.ts +3 -0
- package/dist/tools/trigger-sync.js +6 -0
- package/dist/tools/update-app.d.ts +3 -0
- package/dist/tools/update-app.js +19 -0
- package/dist/tools/update-entitlement.d.ts +3 -0
- package/dist/tools/update-entitlement.js +13 -0
- package/dist/tools/update-experiment.d.ts +3 -0
- package/dist/tools/update-experiment.js +22 -0
- package/dist/tools/update-offering.d.ts +3 -0
- package/dist/tools/update-offering.js +31 -0
- package/dist/tools/update-paywall.d.ts +3 -0
- package/dist/tools/update-paywall.js +23 -0
- package/dist/tools/update-promotion.d.ts +3 -0
- package/dist/tools/update-promotion.js +20 -0
- package/dist/tools/update-rescue-flow.d.ts +3 -0
- package/dist/tools/update-rescue-flow.js +27 -0
- package/dist/types.d.ts +336 -0
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerCreateRescueFlowTool(server, client) {
|
|
3
|
+
server.tool('capivv_create_rescue_flow', [
|
|
4
|
+
'Create a cancellation rescue flow. Triggered when a user attempts to cancel; runs the configured steps (reason capture, retention offers, deflection) in priority order.',
|
|
5
|
+
'After creation, use capivv_update_rescue_flow to attach `conditions` (eligibility filters) and `steps` (the offer ladder) — both default to empty.',
|
|
6
|
+
].join(' '), {
|
|
7
|
+
name: z.string().describe('Display name (e.g. "Annual rescue ladder")'),
|
|
8
|
+
identifier: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe('Stable identifier the SDK uses to fetch this flow (e.g. "annual_rescue_v1")'),
|
|
11
|
+
description: z.string().optional().describe('Free-form description'),
|
|
12
|
+
priority: z
|
|
13
|
+
.number()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Priority (higher runs first when multiple flows match). Defaults to 0.'),
|
|
16
|
+
}, async (args) => {
|
|
17
|
+
const flow = await client.createRescueFlow(args);
|
|
18
|
+
return { content: [{ type: 'text', text: JSON.stringify(flow, null, 2) }] };
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeleteAppTool(server, client) {
|
|
3
|
+
server.tool('capivv_delete_app', 'Permanently delete an app and all its products, entitlements, prices, paywalls, etc. (cascades). Prefer capivv_archive_app for reversible removal.', {
|
|
4
|
+
app_id: z.string().describe('App ID to delete'),
|
|
5
|
+
}, async ({ app_id }) => {
|
|
6
|
+
await client.deleteApp(app_id);
|
|
7
|
+
return { content: [{ type: 'text', text: `App ${app_id} permanently deleted.` }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeleteEntitlementTool(server, client) {
|
|
3
|
+
server.tool('capivv_delete_entitlement', 'Delete an entitlement by ID. Cascades to grants and revocations. Will fail if the entitlement is still referenced by active products — detach them first.', {
|
|
4
|
+
entitlement_id: z.string().describe('Entitlement ID to delete'),
|
|
5
|
+
}, async ({ entitlement_id }) => {
|
|
6
|
+
await client.deleteEntitlement(entitlement_id);
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: 'text', text: `Entitlement ${entitlement_id} deleted.` }],
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeletePaywallTool(server, client) {
|
|
3
|
+
server.tool('capivv_delete_paywall', 'Delete a paywall by ID. The paywall is removed from the dashboard and stops being served to clients. Use capivv_list_paywalls to find the paywall_id.', {
|
|
4
|
+
paywall_id: z.string().describe('Paywall ID to delete'),
|
|
5
|
+
}, async ({ paywall_id }) => {
|
|
6
|
+
await client.deletePaywall(paywall_id);
|
|
7
|
+
return {
|
|
8
|
+
content: [
|
|
9
|
+
{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: `Paywall ${paywall_id} deleted.`,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeletePromotionTool(server, client) {
|
|
3
|
+
server.tool('capivv_delete_promotion', 'Delete a promotion by ID. Stops the promotion immediately and removes it from the dashboard. Active redemptions are preserved in the audit log. Use capivv_list_promotions to find the promotion_id.', {
|
|
4
|
+
promotion_id: z.string().describe('Promotion ID to delete'),
|
|
5
|
+
}, async ({ promotion_id }) => {
|
|
6
|
+
await client.deletePromotion(promotion_id);
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: 'text', text: `Promotion ${promotion_id} deleted.` }],
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeleteRescueFlowTool(server, client) {
|
|
3
|
+
server.tool('capivv_delete_rescue_flow', 'Delete a rescue flow by ID. The flow stops running immediately. Historical rescue events remain in analytics. Use capivv_list_rescue_flows to find the rescue_flow_id.', {
|
|
4
|
+
rescue_flow_id: z.string().describe('Rescue flow ID to delete'),
|
|
5
|
+
}, async ({ rescue_flow_id }) => {
|
|
6
|
+
await client.deleteRescueFlow(rescue_flow_id);
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: 'text', text: `Rescue flow ${rescue_flow_id} deleted.` }],
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDisconnectIntegrationTool(server, client) {
|
|
3
|
+
server.tool('capivv_disconnect_integration', 'Disconnect a store integration. Removes stored credentials and stops syncing. Useful when rotating an Apple .p8 or Google service account — call this, then capivv_connect_apple_integration / capivv_connect_google_integration with the new credentials.', {
|
|
4
|
+
provider: z
|
|
5
|
+
.enum(['apple_app_store', 'google_play', 'stripe'])
|
|
6
|
+
.describe('Which provider to disconnect.'),
|
|
7
|
+
}, async ({ provider }) => {
|
|
8
|
+
await client.disconnectIntegration(provider);
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: 'text', text: `Disconnected ${provider}.` }],
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetEntitlementTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_entitlement', 'Get a single entitlement by ID. Use capivv_list_entitlements to find the entitlement_id.', {
|
|
4
|
+
entitlement_id: z.string().describe('Entitlement ID'),
|
|
5
|
+
}, async ({ entitlement_id }) => {
|
|
6
|
+
const ent = await client.getEntitlement(entitlement_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(ent, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetExperimentSummaryTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_experiment_summary', 'Get full details for a single experiment: its variants, sample sizes, conversion rates, statistical significance, and recommendations. Use capivv_list_experiments to find the experiment_id.', {
|
|
4
|
+
experiment_id: z.string().describe('Experiment ID'),
|
|
5
|
+
}, async ({ experiment_id }) => {
|
|
6
|
+
const exp = await client.getExperiment(experiment_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(exp, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetOfferingTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_offering', 'Get a single offering by ID with full package details. Use capivv_list_offerings to find the offering_id.', {
|
|
4
|
+
offering_id: z.string().describe('Offering ID'),
|
|
5
|
+
}, async ({ offering_id }) => {
|
|
6
|
+
const offering = await client.getOffering(offering_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(offering, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerGetPaywallStatsTool(server, client) {
|
|
2
|
+
server.tool('capivv_get_paywall_stats', 'Get aggregated paywall stats for the workspace: total views, total conversions, and average conversion rate (across every paywall in the tenant). Use capivv_list_paywalls for per-paywall numbers.', async () => {
|
|
3
|
+
const stats = await client.getPaywallStats();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetProductTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_product', 'Get a single product by ID with full metadata, including the store_product_id when the product was created via Phase A end-to-end. Use capivv_list_products to find the product_id.', {
|
|
4
|
+
product_id: z.string().describe('Product ID'),
|
|
5
|
+
}, async ({ product_id }) => {
|
|
6
|
+
const product = await client.getProduct(product_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(product, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetRescueStatsTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_rescue_stats', 'Get aggregated rescue stats for the workspace: total cancellation attempts, successful saves, save rate, and recovered revenue. Defaults to the last 30 days.', {
|
|
4
|
+
days: z
|
|
5
|
+
.number()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe('Lookback window in days. Defaults to 30.'),
|
|
8
|
+
}, async ({ days }) => {
|
|
9
|
+
const stats = await client.getRescueStats(days ?? 30);
|
|
10
|
+
return { content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }] };
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerGetRuleTool(server, client) {
|
|
3
|
+
server.tool('capivv_get_rule', 'Get a single rule (entitlement-grant YAML logic) by ID. Use capivv_list_rules to find the rule_id.', {
|
|
4
|
+
rule_id: z.string().describe('Rule ID'),
|
|
5
|
+
}, async ({ rule_id }) => {
|
|
6
|
+
const rule = await client.getRuleById(rule_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(rule, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
package/dist/tools/index.js
CHANGED
|
@@ -22,6 +22,56 @@ import { registerVerifySetupTool } from './verify-setup.js';
|
|
|
22
22
|
import { registerWhoamiTool } from './whoami.js';
|
|
23
23
|
import { registerAutopilotStatusTool } from './autopilot-status.js';
|
|
24
24
|
import { registerApiKeyUsageTool } from './api-key-usage.js';
|
|
25
|
+
import { registerListPaywallsTool } from './list-paywalls.js';
|
|
26
|
+
import { registerCreatePaywallTool } from './create-paywall.js';
|
|
27
|
+
import { registerUpdatePaywallTool } from './update-paywall.js';
|
|
28
|
+
import { registerDeletePaywallTool } from './delete-paywall.js';
|
|
29
|
+
import { registerGetPaywallStatsTool } from './get-paywall-stats.js';
|
|
30
|
+
import { registerListPromotionsTool } from './list-promotions.js';
|
|
31
|
+
import { registerCreatePromotionTool } from './create-promotion.js';
|
|
32
|
+
import { registerUpdatePromotionTool } from './update-promotion.js';
|
|
33
|
+
import { registerDeletePromotionTool } from './delete-promotion.js';
|
|
34
|
+
import { registerListRescueFlowsTool } from './list-rescue-flows.js';
|
|
35
|
+
import { registerCreateRescueFlowTool } from './create-rescue-flow.js';
|
|
36
|
+
import { registerUpdateRescueFlowTool } from './update-rescue-flow.js';
|
|
37
|
+
import { registerDeleteRescueFlowTool } from './delete-rescue-flow.js';
|
|
38
|
+
import { registerGetRescueStatsTool } from './get-rescue-stats.js';
|
|
39
|
+
import { registerListPricingStrategiesTool } from './list-pricing-strategies.js';
|
|
40
|
+
import { registerCreatePricingStrategyTool } from './create-pricing-strategy.js';
|
|
41
|
+
import { registerPreviewPricingTool } from './preview-pricing.js';
|
|
42
|
+
import { registerRecomputePricesTool } from './recompute-prices.js';
|
|
43
|
+
import { registerPushPricesToStoresTool } from './push-prices-to-stores.js';
|
|
44
|
+
import { registerListChangeRequestsTool } from './list-change-requests.js';
|
|
45
|
+
import { registerApproveChangeRequestTool } from './approve-change-request.js';
|
|
46
|
+
import { registerSetCountryPriceOverrideTool } from './set-country-price-override.js';
|
|
47
|
+
import { registerCreateExperimentTool } from './create-experiment.js';
|
|
48
|
+
import { registerUpdateExperimentTool } from './update-experiment.js';
|
|
49
|
+
import { registerStartExperimentTool } from './start-experiment.js';
|
|
50
|
+
import { registerStopExperimentTool } from './stop-experiment.js';
|
|
51
|
+
import { registerGetExperimentSummaryTool } from './get-experiment-summary.js';
|
|
52
|
+
import { registerUpdateAppTool } from './update-app.js';
|
|
53
|
+
import { registerDeleteAppTool } from './delete-app.js';
|
|
54
|
+
import { registerArchiveAppTool } from './archive-app.js';
|
|
55
|
+
import { registerRestoreAppTool } from './restore-app.js';
|
|
56
|
+
import { registerRunAppAutopilotTool } from './run-app-autopilot.js';
|
|
57
|
+
import { registerRevertAppAutopilotTool } from './revert-app-autopilot.js';
|
|
58
|
+
import { registerGetEntitlementTool } from './get-entitlement.js';
|
|
59
|
+
import { registerUpdateEntitlementTool } from './update-entitlement.js';
|
|
60
|
+
import { registerDeleteEntitlementTool } from './delete-entitlement.js';
|
|
61
|
+
import { registerGetProductTool } from './get-product.js';
|
|
62
|
+
import { registerGetRuleTool } from './get-rule.js';
|
|
63
|
+
import { registerListRuleVersionsTool } from './list-rule-versions.js';
|
|
64
|
+
import { registerRollbackRuleTool } from './rollback-rule.js';
|
|
65
|
+
import { registerGetOfferingTool } from './get-offering.js';
|
|
66
|
+
import { registerUpdateOfferingTool } from './update-offering.js';
|
|
67
|
+
import { registerCheckDriftTool } from './check-drift.js';
|
|
68
|
+
import { registerResolveDriftTool } from './resolve-drift.js';
|
|
69
|
+
import { registerSyncSuggestionsCountTool } from './sync-suggestions-count.js';
|
|
70
|
+
import { registerTriggerSyncTool } from './trigger-sync.js';
|
|
71
|
+
import { registerListIntegrationsTool } from './list-integrations.js';
|
|
72
|
+
import { registerConnectAppleIntegrationTool } from './connect-apple-integration.js';
|
|
73
|
+
import { registerConnectGoogleIntegrationTool } from './connect-google-integration.js';
|
|
74
|
+
import { registerDisconnectIntegrationTool } from './disconnect-integration.js';
|
|
25
75
|
export function registerAllTools(server, client) {
|
|
26
76
|
// Identity — call this first to verify which workspace you're connected to
|
|
27
77
|
registerWhoamiTool(server, client);
|
|
@@ -58,4 +108,69 @@ export function registerAllTools(server, client) {
|
|
|
58
108
|
registerDeleteRuleTool(server, client);
|
|
59
109
|
// Experiments
|
|
60
110
|
registerListExperimentsTool(server, client);
|
|
111
|
+
// Paywalls (V8 Phase B.1)
|
|
112
|
+
registerListPaywallsTool(server, client);
|
|
113
|
+
registerCreatePaywallTool(server, client);
|
|
114
|
+
registerUpdatePaywallTool(server, client);
|
|
115
|
+
registerDeletePaywallTool(server, client);
|
|
116
|
+
registerGetPaywallStatsTool(server, client);
|
|
117
|
+
// Promotions (V8 Phase B.2)
|
|
118
|
+
registerListPromotionsTool(server, client);
|
|
119
|
+
registerCreatePromotionTool(server, client);
|
|
120
|
+
registerUpdatePromotionTool(server, client);
|
|
121
|
+
registerDeletePromotionTool(server, client);
|
|
122
|
+
// Rescue flows (V8 Phase B.3)
|
|
123
|
+
registerListRescueFlowsTool(server, client);
|
|
124
|
+
registerCreateRescueFlowTool(server, client);
|
|
125
|
+
registerUpdateRescueFlowTool(server, client);
|
|
126
|
+
registerDeleteRescueFlowTool(server, client);
|
|
127
|
+
registerGetRescueStatsTool(server, client);
|
|
128
|
+
// Pricing (V8 Phase B.4)
|
|
129
|
+
registerListPricingStrategiesTool(server, client);
|
|
130
|
+
registerCreatePricingStrategyTool(server, client);
|
|
131
|
+
registerPreviewPricingTool(server, client);
|
|
132
|
+
registerRecomputePricesTool(server, client);
|
|
133
|
+
registerPushPricesToStoresTool(server, client);
|
|
134
|
+
registerListChangeRequestsTool(server, client);
|
|
135
|
+
registerApproveChangeRequestTool(server, client);
|
|
136
|
+
registerSetCountryPriceOverrideTool(server, client);
|
|
137
|
+
// Experiment writes (V8 Phase B.5)
|
|
138
|
+
registerCreateExperimentTool(server, client);
|
|
139
|
+
registerUpdateExperimentTool(server, client);
|
|
140
|
+
registerStartExperimentTool(server, client);
|
|
141
|
+
registerStopExperimentTool(server, client);
|
|
142
|
+
registerGetExperimentSummaryTool(server, client);
|
|
143
|
+
// Apps gap-fillers (V8 Phase B.6)
|
|
144
|
+
registerUpdateAppTool(server, client);
|
|
145
|
+
registerDeleteAppTool(server, client);
|
|
146
|
+
registerArchiveAppTool(server, client);
|
|
147
|
+
registerRestoreAppTool(server, client);
|
|
148
|
+
registerRunAppAutopilotTool(server, client);
|
|
149
|
+
registerRevertAppAutopilotTool(server, client);
|
|
150
|
+
// Entitlements gap-fillers (V8 Phase B.7)
|
|
151
|
+
registerGetEntitlementTool(server, client);
|
|
152
|
+
registerUpdateEntitlementTool(server, client);
|
|
153
|
+
registerDeleteEntitlementTool(server, client);
|
|
154
|
+
// Products gap-filler (V8 Phase B.8)
|
|
155
|
+
registerGetProductTool(server, client);
|
|
156
|
+
// Rules gap-fillers (V8 Phase B.9)
|
|
157
|
+
registerGetRuleTool(server, client);
|
|
158
|
+
registerListRuleVersionsTool(server, client);
|
|
159
|
+
registerRollbackRuleTool(server, client);
|
|
160
|
+
// Offerings gap-fillers (V8 Phase B.10)
|
|
161
|
+
registerGetOfferingTool(server, client);
|
|
162
|
+
registerUpdateOfferingTool(server, client);
|
|
163
|
+
// Drift detection + remediation (V8 Phase C)
|
|
164
|
+
registerCheckDriftTool(server, client);
|
|
165
|
+
registerResolveDriftTool(server, client);
|
|
166
|
+
registerSyncSuggestionsCountTool(server, client);
|
|
167
|
+
registerTriggerSyncTool(server, client);
|
|
168
|
+
// Integrations management (V8.1 — added after the Interrupt customer
|
|
169
|
+
// hit a blocked-store-write because their integration was in a stale
|
|
170
|
+
// error state. The agent can now diagnose and fix integrations
|
|
171
|
+
// without bouncing the customer to the dashboard.)
|
|
172
|
+
registerListIntegrationsTool(server, client);
|
|
173
|
+
registerConnectAppleIntegrationTool(server, client);
|
|
174
|
+
registerConnectGoogleIntegrationTool(server, client);
|
|
175
|
+
registerDisconnectIntegrationTool(server, client);
|
|
61
176
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerListChangeRequestsTool(server, client) {
|
|
3
|
+
server.tool('capivv_list_change_requests', 'List pricing change requests that exceeded the strategy\'s guardrails and are waiting for human approval. Filter by status (pending / approved / rejected) or by product_id.', {
|
|
4
|
+
app_id: z.string().describe('App to scope the listing to'),
|
|
5
|
+
status: z
|
|
6
|
+
.string()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('Filter by status: pending, approved, or rejected'),
|
|
9
|
+
product_id: z.string().optional().describe('Filter by product'),
|
|
10
|
+
}, async ({ app_id, status, product_id }) => {
|
|
11
|
+
const requests = await client.listPricingChangeRequests(app_id, status, product_id);
|
|
12
|
+
return { content: [{ type: 'text', text: JSON.stringify(requests, null, 2) }] };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerListIntegrationsTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_integrations', 'List every store integration (Apple App Store, Google Play, Stripe) for the workspace with its status, last sync, and any error message. Useful for diagnosing why capivv_create_product failed — if the integration shows "error", the credentials are likely stale or revoked.', async () => {
|
|
3
|
+
const integrations = await client.listIntegrations();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(integrations, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerListPaywallsTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_paywalls', 'List every paywall in the workspace with its type, status, view / conversion counts, and config. Use this to find a paywall_id before calling capivv_update_paywall or capivv_delete_paywall.', async () => {
|
|
3
|
+
const paywalls = await client.listPaywalls();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(paywalls, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function registerListPricingStrategiesTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_pricing_strategies', 'List every pricing strategy across the workspace, including affordability tier bounds, blend weights (PPP / Big Mac / FX-neutral), and guardrails. Use this to find a strategy_id before previewing or recomputing prices.', async () => {
|
|
3
|
+
const strategies = await client.listPricingStrategies();
|
|
4
|
+
return {
|
|
5
|
+
content: [{ type: 'text', text: JSON.stringify(strategies, null, 2) }],
|
|
6
|
+
};
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerListPromotionsTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_promotions', 'List every promotion in the workspace with its campaign type, status, schedule, discount, and redemption count. Use this to find a promotion_id before calling capivv_update_promotion or capivv_delete_promotion.', async () => {
|
|
3
|
+
const promotions = await client.listPromotions();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(promotions, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerListRescueFlowsTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_rescue_flows', 'List every cancellation rescue flow in the workspace with its status, priority, conditions, and steps. Use this to find a rescue_flow_id before calling update / delete.', async () => {
|
|
3
|
+
const flows = await client.listRescueFlows();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(flows, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerListRuleVersionsTool(server, client) {
|
|
3
|
+
server.tool('capivv_list_rule_versions', 'List every saved version of a rule (history). Use capivv_rollback_rule with a version number to revert.', {
|
|
4
|
+
rule_id: z.string().describe('Rule ID'),
|
|
5
|
+
}, async ({ rule_id }) => {
|
|
6
|
+
const versions = await client.listRuleVersions(rule_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(versions, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
package/dist/tools/next-step.js
CHANGED
|
@@ -43,11 +43,11 @@ function buildSteps(state) {
|
|
|
43
43
|
total_steps: total,
|
|
44
44
|
title: 'Create products',
|
|
45
45
|
status: state.products > 0 ? 'done' : 'needed',
|
|
46
|
-
what: 'Create your subscription or in-app purchase products, linked to entitlements.',
|
|
46
|
+
what: 'Create your subscription or in-app purchase products, linked to entitlements. With a connected store integration, Capivv creates the product in Capivv AND in App Store Connect / Google Play in one call.',
|
|
47
47
|
how: state.apps > 0
|
|
48
|
-
? 'Use capivv_create_product with app_id, external_id (
|
|
48
|
+
? 'Use capivv_create_product with app_id, external_id (the store product ID you want — Capivv will create it in the store too), product_type, prices, and entitlement_ids. Or use capivv_import_products to pull existing store products into Capivv.'
|
|
49
49
|
: 'First complete Step 1 (create an app), then use capivv_create_product.',
|
|
50
|
-
why: 'Products
|
|
50
|
+
why: 'Products are end-to-end: Capivv writes to its database AND to the connected store(s) at the price you specify. Tier snapping is automatic and the response shows both the requested and the snapped price.',
|
|
51
51
|
});
|
|
52
52
|
// Step 5: Offerings
|
|
53
53
|
steps.push({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerPreviewPricingTool(server, client) {
|
|
3
|
+
server.tool('capivv_preview_pricing', 'Preview the prices a pricing strategy would compute for a product, without applying them. Returns proposed prices per country, the factor breakdown (FX / PPP / Big Mac contributions), and which countries would trigger the guardrails.', {
|
|
4
|
+
product_id: z.string().describe('Product to preview pricing for'),
|
|
5
|
+
strategy_id: z
|
|
6
|
+
.string()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('Strategy to use. Defaults to the product\'s assigned strategy.'),
|
|
9
|
+
}, async ({ product_id, strategy_id }) => {
|
|
10
|
+
const result = await client.previewPricing(product_id, strategy_id);
|
|
11
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerPushPricesToStoresTool(server, client) {
|
|
3
|
+
server.tool('capivv_push_prices_to_stores', 'Push the current Capivv prices for a product to the connected stores (App Store Connect / Google Play). Snaps each price to the nearest store tier as needed. Returns counts of pushed / failed / skipped (skipped = no integration connected for that platform).', {
|
|
4
|
+
product_id: z.string().describe('Product whose Capivv prices should be pushed to stores'),
|
|
5
|
+
}, async ({ product_id }) => {
|
|
6
|
+
const result = await client.pushPricesToStores(product_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerRecomputePricesTool(server, client) {
|
|
3
|
+
server.tool('capivv_recompute_prices', [
|
|
4
|
+
'Recompute prices and apply them to Capivv. Pass `product_id` to recompute one product, or `strategy_id` to recompute every product tied to that strategy.',
|
|
5
|
+
'Changes within the strategy\'s guardrails are auto-applied. Changes that exceed `max_auto_change_pct` / `max_auto_decrease_pct` are queued as change requests for human approval (use capivv_list_change_requests + capivv_approve_change_request).',
|
|
6
|
+
'This does NOT push to the stores — call capivv_push_prices_to_stores afterwards.',
|
|
7
|
+
].join(' '), {
|
|
8
|
+
product_id: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Product to recompute. Mutually exclusive with strategy_id.'),
|
|
12
|
+
strategy_id: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Strategy to recompute (applies to every product on it). Mutually exclusive with product_id.'),
|
|
16
|
+
reason: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Free-form reason for the recompute (logged on every change request). Defaults to "manual".'),
|
|
20
|
+
}, async (args) => {
|
|
21
|
+
const result = await client.recomputePrices(args);
|
|
22
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerResolveDriftTool(server, client) {
|
|
3
|
+
server.tool('capivv_resolve_drift', [
|
|
4
|
+
'Resolve a drift suggestion by ID. `accept` applies the store-side change to Capivv (e.g., imports the new product, updates the local price); `dismiss` marks the suggestion as ignored without changing anything.',
|
|
5
|
+
'For "Capivv has it but the store does not" cases, use capivv_create_product instead — that path re-creates the store-side record from Capivv via the Phase A helpers.',
|
|
6
|
+
].join(' '), {
|
|
7
|
+
suggestion_id: z.string().describe('Sync suggestion ID (returned by capivv_check_drift)'),
|
|
8
|
+
action: z
|
|
9
|
+
.enum(['accept', 'dismiss'])
|
|
10
|
+
.describe('"accept" applies the change to Capivv; "dismiss" ignores it.'),
|
|
11
|
+
}, async ({ suggestion_id, action }) => {
|
|
12
|
+
const suggestion = await client.resolveSyncSuggestion(suggestion_id, action);
|
|
13
|
+
return { content: [{ type: 'text', text: JSON.stringify(suggestion, null, 2) }] };
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerRestoreAppTool(server, client) {
|
|
3
|
+
server.tool('capivv_restore_app', 'Restore a previously archived app. Inverse of capivv_archive_app.', {
|
|
4
|
+
app_id: z.string().describe('App ID to restore'),
|
|
5
|
+
}, async ({ app_id }) => {
|
|
6
|
+
const app = await client.restoreApp(app_id);
|
|
7
|
+
return { content: [{ type: 'text', text: JSON.stringify(app, null, 2) }] };
|
|
8
|
+
});
|
|
9
|
+
}
|