posterly-mcp-server 0.63.0 → 0.66.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 -1
- package/dist/lib/api-client.d.ts +66 -3
- package/dist/lib/api-client.js +20 -3
- package/dist/lib/format.d.ts +13 -0
- package/dist/lib/format.js +42 -0
- package/dist/lib/tool-registry.d.ts +1 -1
- package/dist/lib/tool-registry.js +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/tools/find-slot.js +14 -7
- package/dist/tools/get-signup-session.js +2 -1
- package/dist/tools/list-brands.d.ts +2 -2
- package/dist/tools/list-comments.d.ts +2 -2
- package/dist/tools/list-conversations.d.ts +2 -2
- package/dist/tools/manage-extra-account.d.ts +8 -0
- package/dist/tools/manage-extra-account.js +17 -5
- package/dist/tools/manage-plan.d.ts +2 -2
- package/dist/tools/manage-plan.js +2 -2
- package/dist/tools/pause-subscription.js +1 -1
- package/dist/tools/start-signup.d.ts +2 -2
- package/dist/tools/start-signup.js +9 -3
- package/dist/tools/upgrade-subscription.d.ts +14 -2
- package/dist/tools/upgrade-subscription.js +26 -7
- package/dist/tools/whoami.js +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/tool-registry.json +16 -0
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ Add the same server definition to your Cursor MCP settings:
|
|
|
123
123
|
|
|
124
124
|
## Available tools
|
|
125
125
|
|
|
126
|
-
`posterly-mcp-server@0.
|
|
126
|
+
`posterly-mcp-server@0.66.0` exposes 75 tools covering 127 actions. The hosted HTTP endpoint exposes the same catalog minus the three signup tools: 72 tools covering 124 actions.
|
|
127
127
|
|
|
128
128
|
Many tools pick what to do with one parameter: `view` (reads), `action` (writes), or `type`. A few pick their mode from which parameters you pass (for example `update_post` with `status` changes the status instead of editing). Every tool description names all of its views and actions.
|
|
129
129
|
|
package/dist/lib/api-client.d.ts
CHANGED
|
@@ -760,6 +760,9 @@ export type UpgradeQuote = {
|
|
|
760
760
|
charge_today_cents: number;
|
|
761
761
|
charge_today: string;
|
|
762
762
|
currency: string;
|
|
763
|
+
/** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
|
|
764
|
+
proration_date: number;
|
|
765
|
+
quote_expires_at: string | null;
|
|
763
766
|
current_recurring_cents: number | null;
|
|
764
767
|
new_recurring_cents: number;
|
|
765
768
|
new_recurring: string;
|
|
@@ -767,6 +770,10 @@ export type UpgradeQuote = {
|
|
|
767
770
|
account_limit_after: number;
|
|
768
771
|
included_credits_before: number;
|
|
769
772
|
included_credits_after: number;
|
|
773
|
+
api_addon_note?: string;
|
|
774
|
+
combined_recurring_cents?: number;
|
|
775
|
+
combined_recurring?: string;
|
|
776
|
+
includes_api_addon?: boolean;
|
|
770
777
|
};
|
|
771
778
|
export type UpgradeQuoteResponse = {
|
|
772
779
|
dry_run: true;
|
|
@@ -849,6 +856,9 @@ export type ExtraAccountsQuote = {
|
|
|
849
856
|
charge_today_cents: number;
|
|
850
857
|
charge_today: string;
|
|
851
858
|
currency: string;
|
|
859
|
+
/** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
|
|
860
|
+
proration_date: number;
|
|
861
|
+
quote_expires_at: string | null;
|
|
852
862
|
};
|
|
853
863
|
export type ExtraAccountsQuoteResponse = {
|
|
854
864
|
dry_run: true;
|
|
@@ -916,6 +926,14 @@ export interface Slot {
|
|
|
916
926
|
time: string;
|
|
917
927
|
local_time: string;
|
|
918
928
|
}
|
|
929
|
+
/** Where a slot response's timezone came from when the caller passed none. */
|
|
930
|
+
export type SlotTimezoneSource = 'requested' | 'workspace' | 'profile' | 'utc';
|
|
931
|
+
export interface AvailableSlotsResponse {
|
|
932
|
+
slots: Slot[];
|
|
933
|
+
/** The timezone local_time is in. Missing from older API deployments. */
|
|
934
|
+
timezone?: string;
|
|
935
|
+
timezone_source?: SlotTimezoneSource;
|
|
936
|
+
}
|
|
919
937
|
export type SuggestedSlotBasis = 'yours' | 'platform' | 'default';
|
|
920
938
|
export interface SuggestedSlot extends Slot {
|
|
921
939
|
basis: SuggestedSlotBasis;
|
|
@@ -933,6 +951,7 @@ export interface SuggestedTimesWeeklyRating {
|
|
|
933
951
|
}
|
|
934
952
|
export interface SuggestedSlotsResponse {
|
|
935
953
|
timezone: string;
|
|
954
|
+
timezone_source?: SlotTimezoneSource;
|
|
936
955
|
basis: SuggestedSlotBasis;
|
|
937
956
|
basis_label: string;
|
|
938
957
|
slots: SuggestedSlot[];
|
|
@@ -1404,6 +1423,25 @@ export interface PublicSignupPaymentAgentWallet {
|
|
|
1404
1423
|
how?: string;
|
|
1405
1424
|
spend_request?: PublicSignupPaymentAgentWalletSpendRequest;
|
|
1406
1425
|
}
|
|
1426
|
+
/** Recurring price once the free trial ends (or from today when there is no trial). */
|
|
1427
|
+
export interface PublicSignupRecurringCharge {
|
|
1428
|
+
amount_cents?: number;
|
|
1429
|
+
amount_display?: string;
|
|
1430
|
+
currency?: string;
|
|
1431
|
+
interval?: string;
|
|
1432
|
+
items?: Array<{
|
|
1433
|
+
name?: string;
|
|
1434
|
+
amount_cents?: number;
|
|
1435
|
+
}>;
|
|
1436
|
+
/** Days until the first charge: the trial length, or 0 when Checkout charges today. */
|
|
1437
|
+
first_charge_in_days?: number;
|
|
1438
|
+
/** 0 on a trial, the full first period when the account already had a trial. */
|
|
1439
|
+
charged_today_cents?: number;
|
|
1440
|
+
price_source?: string;
|
|
1441
|
+
/** One plain sentence for the agent to relay to the person. */
|
|
1442
|
+
description?: string;
|
|
1443
|
+
[key: string]: unknown;
|
|
1444
|
+
}
|
|
1407
1445
|
export interface PublicSignupPayment {
|
|
1408
1446
|
amount?: number | null;
|
|
1409
1447
|
currency?: string;
|
|
@@ -1419,8 +1457,15 @@ export interface PublicSignupPayment {
|
|
|
1419
1457
|
checkout_redirect_url?: string;
|
|
1420
1458
|
pay_with?: string;
|
|
1421
1459
|
agent_wallet?: PublicSignupPaymentAgentWallet;
|
|
1460
|
+
after_trial?: PublicSignupRecurringCharge | null;
|
|
1422
1461
|
[key: string]: unknown;
|
|
1423
1462
|
}
|
|
1463
|
+
/**
|
|
1464
|
+
* One line with the price after the trial, from the server's own sentence.
|
|
1465
|
+
* Empty when the server did not send one (older deployments), so the tool
|
|
1466
|
+
* never invents a price.
|
|
1467
|
+
*/
|
|
1468
|
+
export declare function signupRecurringChargeLine(afterTrial: PublicSignupRecurringCharge | null | undefined): string;
|
|
1424
1469
|
/** True when this signup Checkout is the card-backed free trial (nothing due today). */
|
|
1425
1470
|
export declare function signupCheckoutIsTrial(payment: PublicSignupPayment | null | undefined): boolean;
|
|
1426
1471
|
/**
|
|
@@ -1661,27 +1706,45 @@ export declare class PosterlyClient {
|
|
|
1661
1706
|
tier: SubscriptionTierName;
|
|
1662
1707
|
interval?: 'month' | 'year';
|
|
1663
1708
|
workspace_id?: string;
|
|
1709
|
+
add_api_addon?: boolean;
|
|
1664
1710
|
}): Promise<UpgradeQuoteResponse>;
|
|
1665
|
-
/**
|
|
1711
|
+
/**
|
|
1712
|
+
* Applies the upgrade and charges the saved card. Only call after a quote was shown and approved.
|
|
1713
|
+
* The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
|
|
1714
|
+
* when the price or quote moved.
|
|
1715
|
+
*/
|
|
1666
1716
|
upgradeSubscription(data: {
|
|
1667
1717
|
tier: SubscriptionTierName;
|
|
1668
1718
|
interval?: 'month' | 'year';
|
|
1669
1719
|
request_id?: string;
|
|
1670
1720
|
workspace_id?: string;
|
|
1721
|
+
/** The quote's charge_today_cents. */
|
|
1722
|
+
expected_amount_cents: number;
|
|
1723
|
+
/** The quote's proration_date. */
|
|
1724
|
+
proration_date: number;
|
|
1671
1725
|
/** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
|
|
1672
1726
|
expected_current_tier?: SubscriptionTierName;
|
|
1673
1727
|
expected_interval?: UpgradeInterval;
|
|
1728
|
+
add_api_addon?: boolean;
|
|
1674
1729
|
}): Promise<UpgradeSubscriptionResponse>;
|
|
1675
1730
|
/** Exact price of a change; charges nothing. */
|
|
1676
1731
|
quoteExtraAccounts(data: {
|
|
1677
1732
|
extra_accounts: number;
|
|
1678
1733
|
workspace_id?: string;
|
|
1679
1734
|
}): Promise<ExtraAccountsQuoteResponse>;
|
|
1680
|
-
/**
|
|
1735
|
+
/**
|
|
1736
|
+
* Applies the change and charges the saved card. Only call after a quote was shown and approved.
|
|
1737
|
+
* The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
|
|
1738
|
+
* when the price or quote moved.
|
|
1739
|
+
*/
|
|
1681
1740
|
setExtraAccounts(data: {
|
|
1682
1741
|
extra_accounts: number;
|
|
1683
1742
|
request_id?: string;
|
|
1684
1743
|
workspace_id?: string;
|
|
1744
|
+
/** The quote's charge_today_cents. */
|
|
1745
|
+
expected_amount_cents: number;
|
|
1746
|
+
/** The quote's proration_date. */
|
|
1747
|
+
proration_date: number;
|
|
1685
1748
|
/** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
|
|
1686
1749
|
expected_current_extra_accounts?: number;
|
|
1687
1750
|
expected_interval?: 'month' | 'year';
|
|
@@ -1952,7 +2015,7 @@ export declare class PosterlyClient {
|
|
|
1952
2015
|
timezone?: string;
|
|
1953
2016
|
count?: number;
|
|
1954
2017
|
workspace_id?: string;
|
|
1955
|
-
}): Promise<
|
|
2018
|
+
}): Promise<AvailableSlotsResponse>;
|
|
1956
2019
|
/** Best times by engagement for the given accounts (GET /slots/suggested). */
|
|
1957
2020
|
findSuggestedSlots(params: {
|
|
1958
2021
|
account_ids: string[];
|
package/dist/lib/api-client.js
CHANGED
|
@@ -63,6 +63,15 @@ function postFilterParams(params) {
|
|
|
63
63
|
searchParams.set('timezone', params.timezone);
|
|
64
64
|
return searchParams;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* One line with the price after the trial, from the server's own sentence.
|
|
68
|
+
* Empty when the server did not send one (older deployments), so the tool
|
|
69
|
+
* never invents a price.
|
|
70
|
+
*/
|
|
71
|
+
export function signupRecurringChargeLine(afterTrial) {
|
|
72
|
+
const description = typeof afterTrial?.description === 'string' ? afterTrial.description.trim() : '';
|
|
73
|
+
return description ? `Price: ${description}` : '';
|
|
74
|
+
}
|
|
66
75
|
/** True when this signup Checkout is the card-backed free trial (nothing due today). */
|
|
67
76
|
export function signupCheckoutIsTrial(payment) {
|
|
68
77
|
if (!payment)
|
|
@@ -330,7 +339,11 @@ export class PosterlyClient {
|
|
|
330
339
|
async quoteUpgrade(data) {
|
|
331
340
|
return this.request('POST', '/subscription/upgrade', { ...data, dry_run: true });
|
|
332
341
|
}
|
|
333
|
-
/**
|
|
342
|
+
/**
|
|
343
|
+
* Applies the upgrade and charges the saved card. Only call after a quote was shown and approved.
|
|
344
|
+
* The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
|
|
345
|
+
* when the price or quote moved.
|
|
346
|
+
*/
|
|
334
347
|
async upgradeSubscription(data) {
|
|
335
348
|
return this.request('POST', '/subscription/upgrade', data);
|
|
336
349
|
}
|
|
@@ -338,7 +351,11 @@ export class PosterlyClient {
|
|
|
338
351
|
async quoteExtraAccounts(data) {
|
|
339
352
|
return this.request('POST', '/subscription/extra-accounts', { ...data, dry_run: true });
|
|
340
353
|
}
|
|
341
|
-
/**
|
|
354
|
+
/**
|
|
355
|
+
* Applies the change and charges the saved card. Only call after a quote was shown and approved.
|
|
356
|
+
* The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
|
|
357
|
+
* when the price or quote moved.
|
|
358
|
+
*/
|
|
342
359
|
async setExtraAccounts(data) {
|
|
343
360
|
return this.request('POST', '/subscription/extra-accounts', data);
|
|
344
361
|
}
|
|
@@ -585,7 +602,7 @@ export class PosterlyClient {
|
|
|
585
602
|
searchParams.set('workspace_id', params.workspace_id);
|
|
586
603
|
const qs = searchParams.toString();
|
|
587
604
|
const data = await this.request('GET', `/slots/next${qs ? `?${qs}` : ''}`);
|
|
588
|
-
return data.slots;
|
|
605
|
+
return { ...data, slots: Array.isArray(data?.slots) ? data.slots : [] };
|
|
589
606
|
}
|
|
590
607
|
/** Best times by engagement for the given accounts (GET /slots/suggested). */
|
|
591
608
|
async findSuggestedSlots(params) {
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -61,6 +61,19 @@ export declare function dashboardUrlForPostList(posts: Array<Pick<Post, 'schedul
|
|
|
61
61
|
* both surfaces.
|
|
62
62
|
*/
|
|
63
63
|
export declare function starGlyphs(stars: unknown, estimated?: boolean): string;
|
|
64
|
+
/**
|
|
65
|
+
* One line naming the timezone a slot result is in and where it came from
|
|
66
|
+
* (the API's timezone and timezone_source). When nothing was passed and
|
|
67
|
+
* nothing is saved the API falls back to UTC: that is said outright, with
|
|
68
|
+
* what to do about it, so UTC times are never read as the user's clock.
|
|
69
|
+
* The hosted and npm renderers keep this wording identical.
|
|
70
|
+
*/
|
|
71
|
+
export declare function slotTimeZoneNote(data: {
|
|
72
|
+
timezone?: unknown;
|
|
73
|
+
timezone_source?: unknown;
|
|
74
|
+
} | null | undefined): string | null;
|
|
75
|
+
/** The slot's calendar day in the slot timezone, so Date agrees with Local time. */
|
|
76
|
+
export declare function slotLocalDate(value: string | null | undefined, timeZone: unknown): string;
|
|
64
77
|
export declare function truncateText(value: string | null | undefined, max?: number): string;
|
|
65
78
|
export declare function formatAccountLabel(account: Account): string;
|
|
66
79
|
export declare function formatConnectedAccounts(accounts?: Account[]): string;
|
package/dist/lib/format.js
CHANGED
|
@@ -148,6 +148,48 @@ export function starGlyphs(stars, estimated = false) {
|
|
|
148
148
|
const glyphs = '★'.repeat(n) + '☆'.repeat(5 - n);
|
|
149
149
|
return estimated ? `${glyphs} (est.)` : glyphs;
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* One line naming the timezone a slot result is in and where it came from
|
|
153
|
+
* (the API's timezone and timezone_source). When nothing was passed and
|
|
154
|
+
* nothing is saved the API falls back to UTC: that is said outright, with
|
|
155
|
+
* what to do about it, so UTC times are never read as the user's clock.
|
|
156
|
+
* The hosted and npm renderers keep this wording identical.
|
|
157
|
+
*/
|
|
158
|
+
export function slotTimeZoneNote(data) {
|
|
159
|
+
const timezone = typeof data?.timezone === 'string' ? data.timezone.trim() : '';
|
|
160
|
+
if (!timezone)
|
|
161
|
+
return null;
|
|
162
|
+
switch (data?.timezone_source) {
|
|
163
|
+
case 'requested':
|
|
164
|
+
return `Timezone: ${timezone} (the timezone you passed).`;
|
|
165
|
+
case 'workspace':
|
|
166
|
+
return `Timezone: ${timezone} (the workspace timezone; no timezone was passed).`;
|
|
167
|
+
case 'profile':
|
|
168
|
+
return `Timezone: ${timezone} (the user's saved timezone; no timezone was passed).`;
|
|
169
|
+
case 'utc':
|
|
170
|
+
return `Timezone: ${timezone} (FALLBACK: no timezone was passed and none is saved for this user or workspace). These local times are UTC, which is probably not the user's clock. Ask the user for their IANA timezone (for example Europe/London), call find_available_slot again with timezone, and save it with complete_onboarding (timezone only) so later calls use it.`;
|
|
171
|
+
default:
|
|
172
|
+
return `Timezone: ${timezone}.`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/** The slot's calendar day in the slot timezone, so Date agrees with Local time. */
|
|
176
|
+
export function slotLocalDate(value, timeZone) {
|
|
177
|
+
if (!value)
|
|
178
|
+
return 'n/a';
|
|
179
|
+
const date = new Date(value);
|
|
180
|
+
if (Number.isNaN(date.getTime()))
|
|
181
|
+
return String(value);
|
|
182
|
+
const options = { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' };
|
|
183
|
+
if (typeof timeZone === 'string' && timeZone.trim()) {
|
|
184
|
+
try {
|
|
185
|
+
return date.toLocaleDateString('en-US', { ...options, timeZone: timeZone.trim() });
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// Unknown zone name: fall back to the default below.
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return date.toLocaleDateString('en-US', options);
|
|
192
|
+
}
|
|
151
193
|
export function truncateText(value, max = 80) {
|
|
152
194
|
const text = value?.trim() || '';
|
|
153
195
|
if (!text)
|
|
@@ -244,5 +244,5 @@ export declare function resolveCalledTool(registry: ToolRegistry, calledName: st
|
|
|
244
244
|
* all on by default, how to load fewer, and how preview then confirm works.
|
|
245
245
|
*/
|
|
246
246
|
/** Issue #1683: AI app signups onboard in the chat, and returning users are never asked again. */
|
|
247
|
-
export declare const ONBOARDING_INSTRUCTION = "Start each session with whoami. If onboarding.completed is false, run onboarding in this chat: ask what to call the user and their IANA timezone, save them with complete_onboarding, then offer create_connect_session for their first network (its link opens the network sign-in directly). Never send the user to /onboarding-v2, and never ask the onboarding questions again once onboarding.completed is true.";
|
|
247
|
+
export declare const ONBOARDING_INSTRUCTION = "Start each session with whoami. If onboarding.completed is false, run onboarding in this chat before scheduling anything: ask what to call the user and their IANA timezone (only the timezone when onboarding.instruction says so), save them with complete_onboarding, then offer create_connect_session for their first network (its link opens the network sign-in directly). Never send the user to /onboarding-v2, and never ask the onboarding questions again once onboarding.completed is true.";
|
|
248
248
|
export declare function toolsetInstructions(registry: ToolRegistry, surface: ToolSurface): string;
|
|
@@ -396,7 +396,7 @@ export function resolveCalledTool(registry, calledName) {
|
|
|
396
396
|
* all on by default, how to load fewer, and how preview then confirm works.
|
|
397
397
|
*/
|
|
398
398
|
/** Issue #1683: AI app signups onboard in the chat, and returning users are never asked again. */
|
|
399
|
-
export const ONBOARDING_INSTRUCTION = 'Start each session with whoami. If onboarding.completed is false, run onboarding in this chat: ask what to call the user and their IANA timezone, save them with complete_onboarding, then offer create_connect_session for their first network (its link opens the network sign-in directly). Never send the user to /onboarding-v2, and never ask the onboarding questions again once onboarding.completed is true.';
|
|
399
|
+
export const ONBOARDING_INSTRUCTION = 'Start each session with whoami. If onboarding.completed is false, run onboarding in this chat before scheduling anything: ask what to call the user and their IANA timezone (only the timezone when onboarding.instruction says so), save them with complete_onboarding, then offer create_connect_session for their first network (its link opens the network sign-in directly). Never send the user to /onboarding-v2, and never ask the onboarding questions again once onboarding.completed is true.';
|
|
400
400
|
export function toolsetInstructions(registry, surface) {
|
|
401
401
|
const sets = Object.entries(registry.toolsets)
|
|
402
402
|
.filter(([, set]) => !set.surfaces || set.surfaces.includes(surface))
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const POSTERLY_MCP_VERSION = "0.
|
|
1
|
+
export declare const POSTERLY_MCP_VERSION = "0.66.0";
|
package/dist/lib/version.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
// tool set (minus the intentional pre-auth signup tools that only this stdio
|
|
6
6
|
// package exposes). `npm run check:mcp-parity` enforces both the version match
|
|
7
7
|
// and the tool-list match, and runs in the pre-commit hook.
|
|
8
|
-
export const POSTERLY_MCP_VERSION = '0.
|
|
8
|
+
export const POSTERLY_MCP_VERSION = '0.66.0';
|
package/dist/tools/find-slot.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { formatIsoTimestamp, mdEmpty, mdTable, mdTitle, slotLocalDate, slotTimeZoneNote, starGlyphs } from '../lib/format.js';
|
|
3
3
|
const SUGGESTED_BASIS_LABELS = {
|
|
4
4
|
yours: 'Based on your posts',
|
|
5
5
|
platform: 'Popular on this platform',
|
|
6
6
|
default: 'Good default',
|
|
7
7
|
};
|
|
8
|
+
const SLOT_SCHEDULE_HINT = 'Pass the UTC value to create_post as scheduled_at.';
|
|
9
|
+
const SLOT_UNKNOWN_TIMEZONE_HINT = 'Local time uses the timezone you passed, or, if you left it out, the saved timezone, then UTC.';
|
|
8
10
|
export const findSlotTool = {
|
|
9
11
|
name: 'find_available_slot',
|
|
10
|
-
description: 'Find available time slots for posting. Respects a 1-hour gap between posts and preferred hours (8am-10pm in the given timezone). Returns up to 10 slots.
|
|
12
|
+
description: 'Find available time slots for posting. Respects a 1-hour gap between posts and preferred hours (8am-10pm in the given timezone). Returns up to 10 slots. Without timezone it uses the saved user timezone (in a shared workspace, the timezone of that workspace first), then UTC; the result names the timezone used and where it came from, and says so when it fell back to UTC. Each slot includes the UTC instant to pass as scheduled_at. Pass workspace_id to only avoid collisions with posts in that workspace. strategy "best_engagement" (needs account_ids) ranks the next 7 days by when these accounts get the most engagement, with a 1-5 star rating and a reason per slot.',
|
|
11
13
|
inputSchema: z.object({
|
|
12
14
|
account_ids: z
|
|
13
15
|
.array(z.string())
|
|
@@ -16,7 +18,7 @@ export const findSlotTool = {
|
|
|
16
18
|
timezone: z
|
|
17
19
|
.string()
|
|
18
20
|
.optional()
|
|
19
|
-
.describe('IANA timezone (e.g. Asia/Dubai, Europe/London). Defaults to
|
|
21
|
+
.describe('IANA timezone (e.g. Asia/Dubai, Europe/London). Defaults to the saved user timezone (in a shared workspace, the timezone of that workspace first), then UTC.'),
|
|
20
22
|
count: z
|
|
21
23
|
.number()
|
|
22
24
|
.min(1)
|
|
@@ -48,10 +50,12 @@ export const findSlotTool = {
|
|
|
48
50
|
if (slots.length === 0) {
|
|
49
51
|
return mdEmpty('suggested slots', 'No suggested slots are free in the next 7 days.');
|
|
50
52
|
}
|
|
53
|
+
const timeZoneNote = slotTimeZoneNote(result);
|
|
51
54
|
const basis = result.basis_label || SUGGESTED_BASIS_LABELS[result.basis] || 'Good default';
|
|
52
55
|
return [
|
|
53
56
|
mdTitle(`Best times to post (${slots.length})`),
|
|
54
|
-
`Basis: ${basis}
|
|
57
|
+
`Basis: ${basis}`,
|
|
58
|
+
...(timeZoneNote ? [timeZoneNote] : []),
|
|
55
59
|
// local_time already carries the date in the requested timezone, so
|
|
56
60
|
// no separate Date column (a machine-local date could disagree).
|
|
57
61
|
mdTable(['Option', 'Local time', 'UTC', 'Rating', 'Why'], slots.map((slot, index) => [
|
|
@@ -63,19 +67,22 @@ export const findSlotTool = {
|
|
|
63
67
|
])),
|
|
64
68
|
].join('\n\n');
|
|
65
69
|
}
|
|
66
|
-
const
|
|
70
|
+
const result = await client.findAvailableSlots(input);
|
|
71
|
+
const slots = result.slots;
|
|
67
72
|
if (slots.length === 0) {
|
|
68
73
|
return mdEmpty('available slots', 'No available posting slots were found in the next 14 days.');
|
|
69
74
|
}
|
|
75
|
+
const timeZoneNote = slotTimeZoneNote(result);
|
|
70
76
|
return [
|
|
71
77
|
mdTitle(`Available posting slots (${slots.length})`),
|
|
78
|
+
...(timeZoneNote ? [timeZoneNote] : []),
|
|
72
79
|
mdTable(['Option', 'Local time', 'Date', 'UTC'], slots.map((slot, index) => [
|
|
73
80
|
index + 1,
|
|
74
81
|
slot.local_time,
|
|
75
|
-
|
|
82
|
+
slotLocalDate(slot.time, result.timezone),
|
|
76
83
|
formatIsoTimestamp(slot.time),
|
|
77
84
|
])),
|
|
78
|
-
|
|
85
|
+
timeZoneNote ? SLOT_SCHEDULE_HINT : `${SLOT_SCHEDULE_HINT} ${SLOT_UNKNOWN_TIMEZONE_HINT}`,
|
|
79
86
|
].join('\n\n');
|
|
80
87
|
},
|
|
81
88
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { signupCheckoutChargeLine, signupCheckoutIsTrial, } from '../lib/api-client.js';
|
|
2
|
+
import { signupCheckoutChargeLine, signupCheckoutIsTrial, signupRecurringChargeLine, } from '../lib/api-client.js';
|
|
3
3
|
export const getSignupSessionTool = {
|
|
4
4
|
name: 'get_signup_session',
|
|
5
5
|
description: 'Poll a public posterly signup session created by start_signup. Use this to narrate the free trial (card saved, nothing charged today), password setup, and agent access status before a posterly API key is installed. An account that already had a trial is charged at checkout instead. Keep updates user-facing; do not narrate raw HTTP, curl, or API plumbing.',
|
|
@@ -39,6 +39,7 @@ function formatSignupSession(session, includeRaw) {
|
|
|
39
39
|
agentPay?.client_secret ? `PaymentIntent client_secret: ${agentPay.client_secret}` : '',
|
|
40
40
|
agentPay?.confirm_url ? `Confirm URL: ${agentPay.confirm_url}` : '',
|
|
41
41
|
!agentPay?.enabled ? signupCheckoutChargeLine(payment) : '',
|
|
42
|
+
signupRecurringChargeLine(payment?.after_trial),
|
|
42
43
|
!agentPay?.enabled && payment?.agent_wallet?.how
|
|
43
44
|
? `Agent wallet option: ${payment.agent_wallet.how}`
|
|
44
45
|
: '',
|
|
@@ -16,11 +16,11 @@ export declare const listBrandsTool: {
|
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
workspace_id?: string | undefined;
|
|
18
18
|
brand_id?: string | undefined;
|
|
19
|
-
view?: "brand" | "
|
|
19
|
+
view?: "brand" | "profile" | "accounts" | "brands" | undefined;
|
|
20
20
|
}, {
|
|
21
21
|
workspace_id?: string | undefined;
|
|
22
22
|
brand_id?: string | undefined;
|
|
23
|
-
view?: "brand" | "
|
|
23
|
+
view?: "brand" | "profile" | "accounts" | "brands" | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
26
26
|
legacySchemas: {
|
|
@@ -35,8 +35,8 @@ export declare const listCommentsTool: {
|
|
|
35
35
|
workspace_id?: string | undefined;
|
|
36
36
|
limit?: number | undefined;
|
|
37
37
|
offset?: number | undefined;
|
|
38
|
-
since?: string | undefined;
|
|
39
38
|
filter?: "all" | "unread" | "flagged" | undefined;
|
|
39
|
+
since?: string | undefined;
|
|
40
40
|
search?: string | undefined;
|
|
41
41
|
until?: string | undefined;
|
|
42
42
|
comment_id?: string | undefined;
|
|
@@ -46,8 +46,8 @@ export declare const listCommentsTool: {
|
|
|
46
46
|
workspace_id?: string | undefined;
|
|
47
47
|
limit?: number | undefined;
|
|
48
48
|
offset?: number | undefined;
|
|
49
|
-
since?: string | undefined;
|
|
50
49
|
filter?: "all" | "unread" | "flagged" | undefined;
|
|
50
|
+
since?: string | undefined;
|
|
51
51
|
search?: string | undefined;
|
|
52
52
|
until?: string | undefined;
|
|
53
53
|
comment_id?: string | undefined;
|
|
@@ -40,8 +40,8 @@ export declare const listConversationsTool: {
|
|
|
40
40
|
workspace_id?: string | undefined;
|
|
41
41
|
limit?: number | undefined;
|
|
42
42
|
offset?: number | undefined;
|
|
43
|
-
since?: string | undefined;
|
|
44
43
|
filter?: "all" | "unread" | "starred" | "archived" | undefined;
|
|
44
|
+
since?: string | undefined;
|
|
45
45
|
search?: string | undefined;
|
|
46
46
|
until?: string | undefined;
|
|
47
47
|
conversation_id?: string | undefined;
|
|
@@ -51,8 +51,8 @@ export declare const listConversationsTool: {
|
|
|
51
51
|
workspace_id?: string | undefined;
|
|
52
52
|
limit?: number | undefined;
|
|
53
53
|
offset?: number | undefined;
|
|
54
|
-
since?: string | undefined;
|
|
55
54
|
filter?: "all" | "unread" | "starred" | "archived" | undefined;
|
|
55
|
+
since?: string | undefined;
|
|
56
56
|
search?: string | undefined;
|
|
57
57
|
until?: string | undefined;
|
|
58
58
|
conversation_id?: string | undefined;
|
|
@@ -12,6 +12,8 @@ type ManageExtraAccountInput = {
|
|
|
12
12
|
workspace_id?: string;
|
|
13
13
|
expected_current_extra_accounts?: number;
|
|
14
14
|
expected_interval?: 'month' | 'year';
|
|
15
|
+
expected_amount_cents?: number;
|
|
16
|
+
proration_date?: number;
|
|
15
17
|
confirm?: boolean;
|
|
16
18
|
preview_id?: string;
|
|
17
19
|
};
|
|
@@ -24,6 +26,8 @@ export declare const manageExtraAccountTool: {
|
|
|
24
26
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
25
27
|
expected_current_extra_accounts: z.ZodOptional<z.ZodNumber>;
|
|
26
28
|
expected_interval: z.ZodOptional<z.ZodEnum<["month", "year"]>>;
|
|
29
|
+
expected_amount_cents: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
proration_date: z.ZodOptional<z.ZodNumber>;
|
|
27
31
|
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
28
32
|
preview_id: z.ZodOptional<z.ZodString>;
|
|
29
33
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -34,6 +38,8 @@ export declare const manageExtraAccountTool: {
|
|
|
34
38
|
preview_id?: string | undefined;
|
|
35
39
|
expected_current_extra_accounts?: number | undefined;
|
|
36
40
|
expected_interval?: "month" | "year" | undefined;
|
|
41
|
+
expected_amount_cents?: number | undefined;
|
|
42
|
+
proration_date?: number | undefined;
|
|
37
43
|
}, {
|
|
38
44
|
action: "set";
|
|
39
45
|
extra_accounts: number;
|
|
@@ -42,6 +48,8 @@ export declare const manageExtraAccountTool: {
|
|
|
42
48
|
preview_id?: string | undefined;
|
|
43
49
|
expected_current_extra_accounts?: number | undefined;
|
|
44
50
|
expected_interval?: "month" | "year" | undefined;
|
|
51
|
+
expected_amount_cents?: number | undefined;
|
|
52
|
+
proration_date?: number | undefined;
|
|
45
53
|
}>;
|
|
46
54
|
execute(client: PosterlyClient, input: ManageExtraAccountInput, ctx: ToolContext): Promise<string>;
|
|
47
55
|
};
|
|
@@ -47,13 +47,15 @@ export function formatExtraAccountsQuote(q) {
|
|
|
47
47
|
}
|
|
48
48
|
export const manageExtraAccountTool = {
|
|
49
49
|
name: 'manage_extra_account',
|
|
50
|
-
description: 'Buy, raise, lower, or remove Agency extra-account slots. MONEY: raising charges the saved card. Owner only; billing:write. action=set (extra_accounts = desired TOTAL, 0 removes all; add 20+ at a time). Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id
|
|
50
|
+
description: 'Buy, raise, lower, or remove Agency extra-account slots. MONEY: raising charges the saved card exactly the quoted amount. Owner only; billing:write. action=set (extra_accounts = desired TOTAL, 0 removes all; add 20+ at a time). Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id, the expected_ fields and proration_date from the quote. A changed price is refused. 3D Secure or a decline returns a payment link; nothing is added.',
|
|
51
51
|
inputSchema: z.object({
|
|
52
52
|
action: z.enum(['set']),
|
|
53
53
|
extra_accounts: z.number().int().min(0),
|
|
54
54
|
workspace_id: z.string().optional(),
|
|
55
55
|
expected_current_extra_accounts: z.number().int().min(0).optional(),
|
|
56
56
|
expected_interval: z.enum(['month', 'year']).optional(),
|
|
57
|
+
expected_amount_cents: z.number().int().min(0).optional(),
|
|
58
|
+
proration_date: z.number().int().min(0).optional(),
|
|
57
59
|
confirm: z.boolean().optional(),
|
|
58
60
|
preview_id: z.string().optional(),
|
|
59
61
|
}),
|
|
@@ -63,8 +65,9 @@ export const manageExtraAccountTool = {
|
|
|
63
65
|
const workspace = call.workspace_id ? { workspace_id: call.workspace_id } : {};
|
|
64
66
|
// A preview is only issued for a change posterly can actually make: price
|
|
65
67
|
// it first, and answer a failed quote with an error and NO preview_id. The
|
|
66
|
-
// quote's current total
|
|
67
|
-
// so the confirm must repeat them
|
|
68
|
+
// quote's current total, interval, charge today and proration_date are
|
|
69
|
+
// pinned into the previewed args, so the confirm must repeat them: the API
|
|
70
|
+
// refuses a stale quote and charges only the quoted amount.
|
|
68
71
|
let quote = null;
|
|
69
72
|
let previewArgs = args;
|
|
70
73
|
if (call.confirm !== true) {
|
|
@@ -81,6 +84,8 @@ export const manageExtraAccountTool = {
|
|
|
81
84
|
...args,
|
|
82
85
|
expected_current_extra_accounts: quote.current_extra_accounts,
|
|
83
86
|
expected_interval: quote.interval,
|
|
87
|
+
expected_amount_cents: quote.charge_today_cents,
|
|
88
|
+
proration_date: quote.proration_date,
|
|
84
89
|
};
|
|
85
90
|
}
|
|
86
91
|
return previewThenConfirm({
|
|
@@ -97,11 +102,16 @@ export const manageExtraAccountTool = {
|
|
|
97
102
|
['extra_accounts', quote.new_extra_accounts],
|
|
98
103
|
['expected_current_extra_accounts', quote.current_extra_accounts],
|
|
99
104
|
['expected_interval', quote.interval],
|
|
105
|
+
['expected_amount_cents', String(quote.charge_today_cents)],
|
|
106
|
+
['proration_date', String(quote.proration_date)],
|
|
100
107
|
])),
|
|
101
108
|
].filter(Boolean).join('\n\n'),
|
|
102
109
|
run: async () => {
|
|
103
|
-
if (typeof call.expected_current_extra_accounts !== 'number'
|
|
104
|
-
|
|
110
|
+
if (typeof call.expected_current_extra_accounts !== 'number'
|
|
111
|
+
|| !call.expected_interval
|
|
112
|
+
|| typeof call.expected_amount_cents !== 'number'
|
|
113
|
+
|| typeof call.proration_date !== 'number') {
|
|
114
|
+
throw new Error('Confirm needs expected_current_extra_accounts, expected_interval, expected_amount_cents and proration_date from the preview. Get a new preview.');
|
|
105
115
|
}
|
|
106
116
|
// The same preview_id always maps to the same request_id, so a replayed
|
|
107
117
|
// confirm can never buy twice.
|
|
@@ -112,6 +122,8 @@ export const manageExtraAccountTool = {
|
|
|
112
122
|
extra_accounts: call.extra_accounts,
|
|
113
123
|
expected_current_extra_accounts: call.expected_current_extra_accounts,
|
|
114
124
|
expected_interval: call.expected_interval,
|
|
125
|
+
expected_amount_cents: call.expected_amount_cents,
|
|
126
|
+
proration_date: call.proration_date,
|
|
115
127
|
...(requestId ? { request_id: requestId } : {}),
|
|
116
128
|
...workspace,
|
|
117
129
|
});
|
|
@@ -10,12 +10,12 @@ export declare const managePlanTool: {
|
|
|
10
10
|
interval: z.ZodOptional<z.ZodEnum<["week", "month", "year"]>>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
action: "list" | "confirm_link";
|
|
13
|
-
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
14
13
|
interval?: "week" | "month" | "year" | undefined;
|
|
14
|
+
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
action: "list" | "confirm_link";
|
|
17
|
-
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
18
17
|
interval?: "week" | "month" | "year" | undefined;
|
|
18
|
+
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
19
19
|
}>;
|
|
20
20
|
execute(client: PosterlyClient, input: unknown, ctx: ToolContext): Promise<string>;
|
|
21
21
|
};
|
|
@@ -31,7 +31,7 @@ function formatPlans(data) {
|
|
|
31
31
|
function formatConfirm(data) {
|
|
32
32
|
return [
|
|
33
33
|
mdTitle('Confirm link, nothing charged'),
|
|
34
|
-
data?.instructions || 'Send this link to the human. They confirm the price.
|
|
34
|
+
data?.instructions || 'Send this link to the human. They confirm the price. Opening it does not charge the card.',
|
|
35
35
|
mdSection('Link', mdKeyValue([
|
|
36
36
|
['Confirm URL', data?.confirm_url || 'n/a'],
|
|
37
37
|
['Expires', data?.expires_at || 'n/a'],
|
|
@@ -43,7 +43,7 @@ function formatConfirm(data) {
|
|
|
43
43
|
}
|
|
44
44
|
export const managePlanTool = {
|
|
45
45
|
name: 'manage_plan',
|
|
46
|
-
description: 'Plans and the paid-plan link. action=list: plans, prices and the charge today to start the paid plan. action=confirm_link: a single-use 30-minute link for the human to confirm the price; omit tier and interval to start the current plan.
|
|
46
|
+
description: 'Plans and the paid-plan link. action=list: plans, prices and the charge today to start the paid plan. action=confirm_link: a single-use 30-minute link for the human to confirm the price; omit tier and interval to start the current plan. This tool never charges the card (upgrade_subscription and manage_extra_account charge it only after the user agrees to their quote). A trial link needs billing:read. Changing a paid plan also needs billing:write.',
|
|
47
47
|
inputSchema: z.object({
|
|
48
48
|
action: z.enum(['list', 'confirm_link']),
|
|
49
49
|
tier: z.enum(TIERS).optional(),
|
|
@@ -10,7 +10,7 @@ function formatPaused(result) {
|
|
|
10
10
|
}
|
|
11
11
|
export const pauseSubscriptionTool = {
|
|
12
12
|
name: 'pause_subscription',
|
|
13
|
-
description: "Pause the authenticated user's posterly subscription for 30 days (one pause allowed per 90-day cooldown). Billing action; requires the billing:write scope. Only call after the user explicitly confirms.",
|
|
13
|
+
description: "Pause the authenticated user's posterly subscription for 30 days (one pause allowed per 90-day cooldown). A free trial cannot be paused (409 trial_not_pausable). Billing action; requires the billing:write scope. Only call after the user explicitly confirms.",
|
|
14
14
|
inputSchema: z.object({
|
|
15
15
|
confirm: z.literal(true).describe('Must be true after the user explicitly confirms pausing the subscription.'),
|
|
16
16
|
}),
|
|
@@ -14,9 +14,9 @@ export declare const startSignupTool: {
|
|
|
14
14
|
tos_accepted: z.ZodOptional<z.ZodBoolean>;
|
|
15
15
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
interval: "month";
|
|
17
18
|
email: string;
|
|
18
19
|
tier: "starter" | "pro" | "power_user" | "agency";
|
|
19
|
-
interval: "month";
|
|
20
20
|
api_addon: boolean;
|
|
21
21
|
return_path: string;
|
|
22
22
|
source: string;
|
|
@@ -25,10 +25,10 @@ export declare const startSignupTool: {
|
|
|
25
25
|
tos_accepted?: boolean | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
email: string;
|
|
28
|
+
interval?: "month" | undefined;
|
|
28
29
|
name?: string | undefined;
|
|
29
30
|
debug?: boolean | undefined;
|
|
30
31
|
tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
31
|
-
interval?: "month" | undefined;
|
|
32
32
|
api_addon?: boolean | undefined;
|
|
33
33
|
return_path?: string | undefined;
|
|
34
34
|
source?: string | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { signupCheckoutChargeLine, signupCheckoutIsTrial, } from '../lib/api-client.js';
|
|
2
|
+
import { signupCheckoutChargeLine, signupCheckoutIsTrial, signupRecurringChargeLine, } from '../lib/api-client.js';
|
|
3
3
|
const DEFAULT_RETURN_PATH = '/dashboard/api?api_signup=success';
|
|
4
4
|
export const startSignupTool = {
|
|
5
5
|
name: 'start_signup',
|
|
6
|
-
description: 'Start the public posterly signup for a user before posterly API access exists. A new account starts a 7-day free trial: Stripe Checkout collects a card, nothing is charged today, and the card is charged on day 8 unless the paid plan starts sooner. API and MCP stay limited during the trial. The API add-on is still required. Returns a signup poll URL, a browser Checkout handoff URL, and a payment object for that Checkout session (trial length, whether anything is charged today, merchant, and agent-wallet instructions). An account that already had a trial is charged at checkout instead. The user still sets a password and approves social OAuth in the browser. Never ask for card numbers, a posterly password, or social passwords in chat.',
|
|
6
|
+
description: 'Start the public posterly signup for a user before posterly API access exists. A new account starts a 7-day free trial: Stripe Checkout collects a card, nothing is charged today, and the card is charged on day 8 unless the paid plan starts sooner. API and MCP stay limited during the trial. The API add-on is still required. Returns a signup poll URL, a browser Checkout handoff URL, and a payment object for that Checkout session (trial length, whether anything is charged today, the price charged every month after the trial, merchant, and agent-wallet instructions). Tell the user that price before they open Checkout. An account that already had a trial is charged at checkout instead. The user still sets a password and approves social OAuth in the browser. Never ask for card numbers, a posterly password, or social passwords in chat.',
|
|
7
7
|
inputSchema: z.object({
|
|
8
8
|
email: z
|
|
9
9
|
.string()
|
|
@@ -72,6 +72,11 @@ function formatSignupStart(response, includeRaw) {
|
|
|
72
72
|
const message = session?.status_message || response.status_message;
|
|
73
73
|
const agentPay = response.agent_pay || session?.agent_pay;
|
|
74
74
|
const payment = response.payment || session?.payment;
|
|
75
|
+
const billingAfterTrial = response.billing?.after_trial;
|
|
76
|
+
const afterTrial = payment?.after_trial ||
|
|
77
|
+
(billingAfterTrial && typeof billingAfterTrial === 'object'
|
|
78
|
+
? billingAfterTrial
|
|
79
|
+
: null);
|
|
75
80
|
const lines = [
|
|
76
81
|
'posterly signup started.',
|
|
77
82
|
sessionId ? `Signup session: ${sessionId}` : '',
|
|
@@ -86,6 +91,7 @@ function formatSignupStart(response, includeRaw) {
|
|
|
86
91
|
agentPay?.confirm_url ? `Confirm URL: ${agentPay.confirm_url}` : '',
|
|
87
92
|
agentPay?.pay_instructions ? `Pay instructions: ${agentPay.pay_instructions}` : '',
|
|
88
93
|
!agentPay?.enabled ? signupCheckoutChargeLine(payment) : '',
|
|
94
|
+
signupRecurringChargeLine(afterTrial),
|
|
89
95
|
!agentPay?.enabled && payment?.agent_wallet?.how
|
|
90
96
|
? `Agent wallet option: ${payment.agent_wallet.how}`
|
|
91
97
|
: '',
|
|
@@ -114,7 +120,7 @@ function formatSignupStart(response, includeRaw) {
|
|
|
114
120
|
]
|
|
115
121
|
: signupCheckoutIsTrial(payment)
|
|
116
122
|
? [
|
|
117
|
-
'1. Send the Checkout handoff URL to the user so they can save a card in their browser. Nothing is charged today. Use the raw Stripe checkout URL only if you preserve the full URL including any fragment. posterly does not email this link, so do not tell the user to check their inbox at this stage.',
|
|
123
|
+
'1. Send the Checkout handoff URL to the user so they can save a card in their browser. Nothing is charged today. Tell the user the price line above before they open it. Use the raw Stripe checkout URL only if you preserve the full URL including any fragment. posterly does not email this link, so do not tell the user to check their inbox at this stage.',
|
|
118
124
|
'2. If you complete Checkout yourself, use only a reusable card the person has approved for recurring posterly charges. A one-time virtual card fails when the trial ends. Follow the agent wallet option above. Never paste card numbers into chat or send them to posterly.',
|
|
119
125
|
'3. Call get_signup_session with the signup session ID until the status changes.',
|
|
120
126
|
'4. Tell the user when posterly sends the password setup email.',
|
|
@@ -11,8 +11,11 @@ type UpgradeSubscriptionInput = {
|
|
|
11
11
|
workspace_id?: string;
|
|
12
12
|
expected_current_tier?: SubscriptionTierName;
|
|
13
13
|
expected_interval?: 'week' | 'month' | 'year';
|
|
14
|
+
expected_amount_cents?: number;
|
|
15
|
+
proration_date?: number;
|
|
14
16
|
confirm?: boolean;
|
|
15
17
|
preview_id?: string;
|
|
18
|
+
add_api_addon?: boolean;
|
|
16
19
|
};
|
|
17
20
|
export declare const upgradeSubscriptionTool: {
|
|
18
21
|
name: string;
|
|
@@ -23,24 +26,33 @@ export declare const upgradeSubscriptionTool: {
|
|
|
23
26
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
24
27
|
expected_current_tier: z.ZodOptional<z.ZodEnum<["starter", "pro", "power_user", "agency"]>>;
|
|
25
28
|
expected_interval: z.ZodOptional<z.ZodEnum<["week", "month", "year"]>>;
|
|
29
|
+
expected_amount_cents: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
proration_date: z.ZodOptional<z.ZodNumber>;
|
|
26
31
|
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
27
32
|
preview_id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
add_api_addon: z.ZodOptional<z.ZodBoolean>;
|
|
28
34
|
}, "strip", z.ZodTypeAny, {
|
|
29
35
|
tier: "starter" | "pro" | "power_user" | "agency";
|
|
30
36
|
workspace_id?: string | undefined;
|
|
37
|
+
interval?: "month" | "year" | undefined;
|
|
31
38
|
confirm?: boolean | undefined;
|
|
32
39
|
preview_id?: string | undefined;
|
|
33
|
-
interval?: "month" | "year" | undefined;
|
|
34
40
|
expected_interval?: "week" | "month" | "year" | undefined;
|
|
41
|
+
expected_amount_cents?: number | undefined;
|
|
42
|
+
proration_date?: number | undefined;
|
|
35
43
|
expected_current_tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
44
|
+
add_api_addon?: boolean | undefined;
|
|
36
45
|
}, {
|
|
37
46
|
tier: "starter" | "pro" | "power_user" | "agency";
|
|
38
47
|
workspace_id?: string | undefined;
|
|
48
|
+
interval?: "month" | "year" | undefined;
|
|
39
49
|
confirm?: boolean | undefined;
|
|
40
50
|
preview_id?: string | undefined;
|
|
41
|
-
interval?: "month" | "year" | undefined;
|
|
42
51
|
expected_interval?: "week" | "month" | "year" | undefined;
|
|
52
|
+
expected_amount_cents?: number | undefined;
|
|
53
|
+
proration_date?: number | undefined;
|
|
43
54
|
expected_current_tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
|
|
55
|
+
add_api_addon?: boolean | undefined;
|
|
44
56
|
}>;
|
|
45
57
|
execute(client: PosterlyClient, input: UpgradeSubscriptionInput, ctx: ToolContext): Promise<string>;
|
|
46
58
|
};
|
|
@@ -45,7 +45,8 @@ export function formatUpgradeQuote(q) {
|
|
|
45
45
|
const chargeLine = q.trialing
|
|
46
46
|
? 'Nothing is charged today because the subscription is on a trial. The trial continues and the new price starts when it ends.'
|
|
47
47
|
: `The saved card on file is charged ${q.charge_today || usdFromCents(q.charge_today_cents)} today (${q.interval_changes ? 'the unused time on the current plan is credited, and the new billing period starts today' : 'prorated for the rest of this billing period'}) when this is confirmed. Prices are before any discount on the subscription, and discounts carry over. If the card needs confirmation or declines, nothing changes and a payment link is returned instead.`;
|
|
48
|
-
|
|
48
|
+
const addonNote = q.api_addon_note?.trim() || '';
|
|
49
|
+
return [mdSection(`Upgrade to ${q.new_tier_name}`, mdKeyValue(rows)), chargeLine, addonNote].filter(Boolean).join('\n\n');
|
|
49
50
|
}
|
|
50
51
|
export function formatUpgradeResult(d) {
|
|
51
52
|
if (d.status === 'payment_required') {
|
|
@@ -78,15 +79,18 @@ export function formatUpgradeResult(d) {
|
|
|
78
79
|
}
|
|
79
80
|
export const upgradeSubscriptionTool = {
|
|
80
81
|
name: 'upgrade_subscription',
|
|
81
|
-
description: 'Upgrade to a strictly higher plan. MONEY: charges the saved card (prorated). Owner only. Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id
|
|
82
|
+
description: 'Upgrade to a strictly higher plan. MONEY: charges the saved card exactly the quoted amount (prorated). Owner only. Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id, the expected_ fields and proration_date. A changed price is refused. If the quote mentions AI agent access, mention that option once. Set add_api_addon true only when the user asks to add it. 3D Secure or a decline returns a payment link; nothing changes.',
|
|
82
83
|
inputSchema: z.object({
|
|
83
84
|
tier: z.enum(TIER_VALUES),
|
|
84
85
|
interval: z.enum(['month', 'year']).optional(),
|
|
85
86
|
workspace_id: z.string().optional(),
|
|
86
87
|
expected_current_tier: z.enum(TIER_VALUES).optional(),
|
|
87
88
|
expected_interval: z.enum(['week', 'month', 'year']).optional(),
|
|
89
|
+
expected_amount_cents: z.number().int().min(0).optional(),
|
|
90
|
+
proration_date: z.number().int().min(0).optional(),
|
|
88
91
|
confirm: z.boolean().optional(),
|
|
89
92
|
preview_id: z.string().optional(),
|
|
93
|
+
add_api_addon: z.boolean().optional().describe('Add AI agent access on this upgrade. Set only when the user asks. Never set it on your own.'),
|
|
90
94
|
}),
|
|
91
95
|
async execute(client, input, ctx) {
|
|
92
96
|
const { args } = validateArgs(ctx, 'upgrade_subscription', input);
|
|
@@ -95,12 +99,14 @@ export const upgradeSubscriptionTool = {
|
|
|
95
99
|
const makeBase = () => ({
|
|
96
100
|
tier: call.tier,
|
|
97
101
|
...(call.interval ? { interval: call.interval } : {}),
|
|
102
|
+
...(call.add_api_addon === true ? { add_api_addon: true } : {}),
|
|
98
103
|
...(call.workspace_id ? { workspace_id: call.workspace_id } : {}),
|
|
99
104
|
});
|
|
100
105
|
// A preview is only issued for a change posterly can actually make: price
|
|
101
106
|
// it first, and answer a failed quote with an error and NO preview_id. The
|
|
102
|
-
// quote's current plan
|
|
103
|
-
// the confirm must repeat them
|
|
107
|
+
// quote's current plan, interval, charge today and proration_date are
|
|
108
|
+
// pinned into the previewed args, so the confirm must repeat them: the API
|
|
109
|
+
// refuses a stale quote and charges only the quoted amount.
|
|
104
110
|
let quote = null;
|
|
105
111
|
let previewArgs = args;
|
|
106
112
|
if (call.confirm !== true) {
|
|
@@ -117,11 +123,16 @@ export const upgradeSubscriptionTool = {
|
|
|
117
123
|
// ask to repeat, so it is dropped from the previewed args: the confirm
|
|
118
124
|
// then binds to exactly the fields listed under "Fields to repeat on
|
|
119
125
|
// confirm".
|
|
126
|
+
// add_api_addon follows the same rule: it is bound only when the quote
|
|
127
|
+
// includes the add-on, matching "Fields to repeat on confirm".
|
|
120
128
|
const { interval: _noopInterval, ...rest } = args;
|
|
129
|
+
const { add_api_addon: _unusedAddon, ...bound } = (quote.interval_changes ? args : rest);
|
|
121
130
|
previewArgs = {
|
|
122
|
-
...(quote.
|
|
131
|
+
...(quote.includes_api_addon === true ? { ...bound, add_api_addon: true } : bound),
|
|
123
132
|
expected_current_tier: quote.current_tier,
|
|
124
133
|
expected_interval: quote.current_interval,
|
|
134
|
+
expected_amount_cents: quote.charge_today_cents,
|
|
135
|
+
proration_date: quote.proration_date,
|
|
125
136
|
};
|
|
126
137
|
}
|
|
127
138
|
else if (call.interval && call.interval === call.expected_interval) {
|
|
@@ -143,13 +154,19 @@ export const upgradeSubscriptionTool = {
|
|
|
143
154
|
mdSection('Fields to repeat on confirm', mdKeyValue([
|
|
144
155
|
['tier', quote.new_tier],
|
|
145
156
|
...(quote.interval_changes ? [['interval', quote.interval]] : []),
|
|
157
|
+
...(quote.includes_api_addon ? [['add_api_addon', 'true']] : []),
|
|
146
158
|
['expected_current_tier', quote.current_tier],
|
|
147
159
|
['expected_interval', quote.current_interval],
|
|
160
|
+
['expected_amount_cents', String(quote.charge_today_cents)],
|
|
161
|
+
['proration_date', String(quote.proration_date)],
|
|
148
162
|
])),
|
|
149
163
|
].join('\n\n'),
|
|
150
164
|
run: async () => {
|
|
151
|
-
if (!call.expected_current_tier
|
|
152
|
-
|
|
165
|
+
if (!call.expected_current_tier
|
|
166
|
+
|| !call.expected_interval
|
|
167
|
+
|| typeof call.expected_amount_cents !== 'number'
|
|
168
|
+
|| typeof call.proration_date !== 'number') {
|
|
169
|
+
throw new Error('Confirm needs expected_current_tier, expected_interval, expected_amount_cents and proration_date from the preview. Get a new preview.');
|
|
153
170
|
}
|
|
154
171
|
// The same preview_id always maps to the same request_id, so a replayed
|
|
155
172
|
// confirm can never upgrade twice.
|
|
@@ -160,6 +177,8 @@ export const upgradeSubscriptionTool = {
|
|
|
160
177
|
...makeBase(),
|
|
161
178
|
expected_current_tier: call.expected_current_tier,
|
|
162
179
|
expected_interval: call.expected_interval,
|
|
180
|
+
expected_amount_cents: call.expected_amount_cents,
|
|
181
|
+
proration_date: call.proration_date,
|
|
163
182
|
...(requestId ? { request_id: requestId } : {}),
|
|
164
183
|
});
|
|
165
184
|
return formatUpgradeResult(result);
|
package/dist/tools/whoami.js
CHANGED
|
@@ -6,7 +6,7 @@ import { validateArgs } from '../lib/tool-runtime.js';
|
|
|
6
6
|
const NPM_LATEST_URL = 'https://registry.npmjs.org/posterly-mcp-server/latest';
|
|
7
7
|
export const whoamiTool = {
|
|
8
8
|
name: 'whoami',
|
|
9
|
-
description: 'Who you are and how posterly is connected. view=identity (default): the authenticated user, API key scopes, workspaces, and onboarding next step. Pass include=api_keys to also list this account\'s API keys (name, prefix, scopes, created, last used). The secret is never included. Call this first. If onboarding.completed is false, run onboarding IN THIS conversation: ask what to call the user and their IANA timezone, save them with complete_onboarding, then offer create_connect_session; do not send the user to /onboarding-v2. If onboarding.completed is true, never ask the onboarding questions again. view=status: MCP server version, latest npm version, endpoint and API key health, and update guidance; works before POSTERLY_API_KEY is configured.',
|
|
9
|
+
description: 'Who you are and how posterly is connected. view=identity (default): the authenticated user, API key scopes, workspaces, and onboarding next step. Pass include=api_keys to also list this account\'s API keys (name, prefix, scopes, created, last used). The secret is never included. Call this first. If onboarding.completed is false, run onboarding IN THIS conversation before scheduling anything: ask what to call the user and their IANA timezone, save them with complete_onboarding, then offer create_connect_session; do not send the user to /onboarding-v2. If onboarding.completed is true, never ask the onboarding questions again. view=status: MCP server version, latest npm version, endpoint and API key health, and update guidance; works before POSTERLY_API_KEY is configured.',
|
|
10
10
|
inputSchema: z.object({
|
|
11
11
|
view: z
|
|
12
12
|
.enum(['identity', 'status'])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posterly-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"mcpName": "io.github.awpthorp/posterly",
|
|
5
5
|
"description": "MCP server for posterly: schedule and publish social media posts across 18 platforms from any MCP client (Claude, ChatGPT, Cursor, Windsurf, Cline, and more)",
|
|
6
6
|
"license": "MIT",
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.awpthorp/posterly",
|
|
4
4
|
"title": "posterly",
|
|
5
5
|
"description": "Validate, schedule, publish, and analyze social content across 18 platforms with posterly.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.66.0",
|
|
7
7
|
"websiteUrl": "https://www.poster.ly/mcp",
|
|
8
8
|
"icons": [
|
|
9
9
|
{
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{
|
|
23
23
|
"registryType": "npm",
|
|
24
24
|
"identifier": "posterly-mcp-server",
|
|
25
|
-
"version": "0.
|
|
25
|
+
"version": "0.66.0",
|
|
26
26
|
"transport": {
|
|
27
27
|
"type": "stdio"
|
|
28
28
|
},
|
package/tool-registry.json
CHANGED
|
@@ -2480,6 +2480,14 @@
|
|
|
2480
2480
|
"month",
|
|
2481
2481
|
"year"
|
|
2482
2482
|
]
|
|
2483
|
+
},
|
|
2484
|
+
"expected_amount_cents": {
|
|
2485
|
+
"type": "integer",
|
|
2486
|
+
"min": 0
|
|
2487
|
+
},
|
|
2488
|
+
"proration_date": {
|
|
2489
|
+
"type": "integer",
|
|
2490
|
+
"min": 0
|
|
2483
2491
|
}
|
|
2484
2492
|
}
|
|
2485
2493
|
}
|
|
@@ -2520,6 +2528,14 @@
|
|
|
2520
2528
|
"month",
|
|
2521
2529
|
"year"
|
|
2522
2530
|
]
|
|
2531
|
+
},
|
|
2532
|
+
"expected_amount_cents": {
|
|
2533
|
+
"type": "integer",
|
|
2534
|
+
"min": 0
|
|
2535
|
+
},
|
|
2536
|
+
"proration_date": {
|
|
2537
|
+
"type": "integer",
|
|
2538
|
+
"min": 0
|
|
2523
2539
|
}
|
|
2524
2540
|
}
|
|
2525
2541
|
}
|