Jake Shore d3382ec35a Update 6 MCP servers — fieldedge, lightspeed, squarespace, toast, touchbistro, servicetitan — 2026-02-12
=== UPDATES ===
- fieldedge: Added apps, tools, main server entry, full rebuild
- lightspeed: Added complete src/ directory with tools + apps
- squarespace: Full rebuild — new apps, clients, tools, types modules
- toast: Full rebuild — api-client, apps, tools, types
- touchbistro: Full rebuild — api-client, tools, types, gitignore
- servicetitan: Added 4 React UI apps (call-tracking, lead-source-analytics, performance-metrics, schedule-calendar)

All servers restructured from single-file to modular architecture.
2026-02-12 17:58:15 -05:00

200 lines
5.4 KiB
TypeScript

/**
* Analytics Tools
*/
import type { SquarespaceClient } from '../clients/squarespace.js';
export function createAnalyticsTools(client: SquarespaceClient) {
return [
{
name: 'squarespace_get_analytics',
description: 'Get analytics data for a site',
inputSchema: {
type: 'object',
properties: {
siteId: {
type: 'string',
description: 'The site ID',
},
startDate: {
type: 'string',
description: 'Start date (ISO 8601)',
},
endDate: {
type: 'string',
description: 'End date (ISO 8601)',
},
metrics: {
type: 'array',
description: 'Metrics to retrieve',
items: {
type: 'string',
enum: ['pageViews', 'uniqueVisitors', 'revenue', 'orders', 'conversionRate'],
},
},
},
required: ['siteId', 'startDate', 'endDate'],
},
handler: async (args: {
siteId: string;
startDate: string;
endDate: string;
metrics?: string[];
}) => {
const analytics = await client.getAnalytics(args.siteId, {
startDate: args.startDate,
endDate: args.endDate,
metrics: args.metrics,
});
return {
content: [
{
type: 'text',
text: JSON.stringify(analytics, null, 2),
},
],
};
},
},
{
name: 'squarespace_get_top_pages',
description: 'Get top performing pages by views',
inputSchema: {
type: 'object',
properties: {
siteId: {
type: 'string',
description: 'The site ID',
},
startDate: {
type: 'string',
description: 'Start date (ISO 8601)',
},
endDate: {
type: 'string',
description: 'End date (ISO 8601)',
},
limit: {
type: 'number',
description: 'Number of results (default: 10)',
},
},
required: ['siteId', 'startDate', 'endDate'],
},
handler: async (args: {
siteId: string;
startDate: string;
endDate: string;
limit?: number;
}) => {
const analytics = await client.getAnalytics(args.siteId, {
startDate: args.startDate,
endDate: args.endDate,
});
const topPages = (analytics.topPages || []).slice(0, args.limit || 10);
return {
content: [
{
type: 'text',
text: JSON.stringify(topPages, null, 2),
},
],
};
},
},
{
name: 'squarespace_get_top_products',
description: 'Get top selling products by revenue',
inputSchema: {
type: 'object',
properties: {
siteId: {
type: 'string',
description: 'The site ID',
},
startDate: {
type: 'string',
description: 'Start date (ISO 8601)',
},
endDate: {
type: 'string',
description: 'End date (ISO 8601)',
},
limit: {
type: 'number',
description: 'Number of results (default: 10)',
},
},
required: ['siteId', 'startDate', 'endDate'],
},
handler: async (args: {
siteId: string;
startDate: string;
endDate: string;
limit?: number;
}) => {
const analytics = await client.getAnalytics(args.siteId, {
startDate: args.startDate,
endDate: args.endDate,
});
const topProducts = (analytics.topProducts || []).slice(0, args.limit || 10);
return {
content: [
{
type: 'text',
text: JSON.stringify(topProducts, null, 2),
},
],
};
},
},
{
name: 'squarespace_get_revenue_report',
description: 'Get revenue summary for a period',
inputSchema: {
type: 'object',
properties: {
siteId: {
type: 'string',
description: 'The site ID',
},
startDate: {
type: 'string',
description: 'Start date (ISO 8601)',
},
endDate: {
type: 'string',
description: 'End date (ISO 8601)',
},
},
required: ['siteId', 'startDate', 'endDate'],
},
handler: async (args: { siteId: string; startDate: string; endDate: string }) => {
const analytics = await client.getAnalytics(args.siteId, {
startDate: args.startDate,
endDate: args.endDate,
metrics: ['revenue', 'orders', 'conversionRate'],
});
return {
content: [
{
type: 'text',
text: JSON.stringify(
{
period: `${args.startDate} to ${args.endDate}`,
revenue: analytics.metrics.revenue,
orders: analytics.metrics.orders,
averageOrderValue: analytics.metrics.averageOrderValue,
conversionRate: analytics.metrics.conversionRate,
},
null,
2
),
},
],
};
},
},
];
}