export function formatCampaignResponse(campaign: any, action: string = 'retrieved') {
return {
content: [
{
type: 'text',
text: `π§ **Campaign ${action} Successfully!**\n\n` +
`β
**Campaign ID:** ${campaign.data.id}\n` +
`β
**Name:** ${campaign.data.name}\n` +
`β
**Subject:** ${campaign.data.subject}\n` +
`β
**Status:** ${campaign.data.status}\n` +
`β
**Created:** ${campaign.data.created_on}\n\n` +
`**Full Response:**\n${JSON.stringify(campaign, null, 2)}`,
},
],
};
}
export function formatSuccessResponse(message: string, data?: any) {
const content = `β
**${message}**\n\n` +
(data ? `**Full Response:**\n${JSON.stringify(data, null, 2)}` : '');
return {
content: [
{
type: 'text',
text: content,
},
],
};
}
export function formatListResponse(items: any[], title: string, formatter: (item: any, index: number) => string) {
const total = items.length;
const displayItems = items.slice(0, 10);
return {
content: [
{
type: 'text',
text: `π **${title} (${total} total)**\n\n` +
`**Showing ${displayItems.length} items:**\n\n` +
(displayItems.map(formatter).join('\n\n') || 'No items found.') +
(total > 10 ? `\n\n**... and ${total - 10} more items**` : '') +
`\n\n**Full Response:**\n${JSON.stringify(items, null, 2)}`,
},
],
};
}
// Additional formatting utilities for logs and reports
export function formatSectionHeader(title: string): string {
return `## ${title}`;
}
export function formatKeyValue(key: string, value: string): string {
return `**${key}:** ${value}`;
}
export function formatList(items: string[]): string {
return items.map(item => `β’ ${item}`).join('\n');
}