Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions features/pilot-tools/campaigns/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ export async function getCampaign(token: string, id: string): Promise<Response>
return fetchWithRetry(apiUrl(`/api/v1/campaigns/${id}`), { headers: authHeaders(token) });
}

export async function getCampaignMemory(token: string, id: string): Promise<Response> {
return fetchWithRetry(apiUrl(`/api/v1/campaigns/${id}/memory`), { headers: authHeaders(token) });
}

export async function updateCampaignMemory(
token: string,
id: string,
patch: Record<string, unknown>,
): Promise<Response> {
return fetchWithRetry(apiUrl(`/api/v1/campaigns/${id}/memory`), {
method: "PATCH",
headers: authHeaders(token),
body: JSON.stringify(patch),
});
}

export async function createCampaign(token: string, body: Record<string, unknown>): Promise<Response> {
return fetchWithRetry(apiUrl(`/api/v1/campaigns`), {
method: "POST",
Expand Down
15 changes: 15 additions & 0 deletions features/pilot-tools/campaigns/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ export const getCampaignSchema = z.object({
id: z.string().uuid().describe("Campaign UUID"),
});

export const getCampaignMemorySchema = z.object({
...withToken,
id: z.string().uuid().describe("Campaign UUID"),
});

export const updateCampaignMemorySchema = z.object({
...withToken,
id: z.string().uuid().describe("Campaign UUID"),
memory: z
.record(z.unknown())
.describe(
"Partial memory object to merge; top-level keys replace (send the full array to change decisions/notes). e.g. { summary, icp, decisions: [], notes: [] }",
),
});

export const createCampaignSchema = z.object({
...withToken,
name: z.string().min(1).max(255).describe("Campaign name"),
Expand Down
13 changes: 13 additions & 0 deletions features/pilot-tools/campaigns/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ export function registerCampaignTools(server: McpServer): void {
inputSchema: S.getCampaignSchema,
}, async (input) => callApi(input.bearer_token, (t) => repo.getCampaign(t, input.id)));

server.registerTool("get_campaign_memory", {
title: "Get campaign memory",
description: "Read Max's durable memory for a campaign (ICP, decisions, notes). Recall this when working on one of several simultaneous campaigns so you keep them straight.",
inputSchema: S.getCampaignMemorySchema,
}, async (input) => callApi(input.bearer_token, (t) => repo.getCampaignMemory(t, input.id)));

server.registerTool("update_campaign_memory", {
title: "Update campaign memory",
description: "Record/update Max's durable memory for a campaign. Pass a partial 'memory' object (top-level keys merge; send the full array to change decisions/notes). Use it to remember ICP, decisions, and progress per campaign.",
inputSchema: S.updateCampaignMemorySchema,
}, async (input) => callApi(input.bearer_token, (t) =>
repo.updateCampaignMemory(t, input.id, input.memory as Record<string, unknown>)));

server.registerTool("create_campaign", {
title: "Create campaign",
description: "Create a new campaign in draft state. Requires name, included_lists, and accounts. Won't send until launched.",
Expand Down
Loading