- Multi-file architecture with API client, comprehensive types, 13 tool domains - 87 total tools covering customers, jobs, invoices, estimates, equipment, technicians, scheduling, inventory, payments, reporting, locations, service agreements, tasks - 16 dark-themed React MCP apps (Dashboard, Customers, Jobs, Scheduling, Invoices, Estimates, Technicians, Equipment, Inventory, Payments, Service Agreements, Reports, Tasks, Calendar, Map View, Price Book) - Full TypeScript support with zero compilation errors - Comprehensive README with API coverage details - Bearer token authentication with rate limiting and error handling
116 lines
3.7 KiB
TypeScript
116 lines
3.7 KiB
TypeScript
import type { ToastClient } from '../clients/toast.js';
|
|
import type {
|
|
Restaurant,
|
|
RevenueCenter,
|
|
Table,
|
|
ServiceArea,
|
|
DiningOption,
|
|
} from '../types/index.js';
|
|
|
|
export function createConfigurationTools(client: ToastClient) {
|
|
return {
|
|
toast_get_restaurant: {
|
|
description: 'Get restaurant configuration and details',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional if set in config)' },
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const restaurant = await client.get<Restaurant>(`/restaurants/v1/restaurants/${guid}`);
|
|
return restaurant;
|
|
},
|
|
},
|
|
|
|
toast_list_revenue_centers: {
|
|
description: 'List all revenue centers for a restaurant',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional)' },
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const revenueCenters = await client.get<RevenueCenter[]>(
|
|
`/config/v2/revenueCenters`,
|
|
{ restaurantGuid: guid }
|
|
);
|
|
return { revenueCenters, count: revenueCenters.length };
|
|
},
|
|
},
|
|
|
|
toast_list_tables: {
|
|
description: 'List all tables for a restaurant',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional)' },
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const tables = await client.get<Table[]>(`/config/v2/tables`, {
|
|
restaurantGuid: guid,
|
|
});
|
|
return { tables, count: tables.length };
|
|
},
|
|
},
|
|
|
|
toast_get_table: {
|
|
description: 'Get a specific table by GUID',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
tableGuid: { type: 'string', description: 'Table GUID' },
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional)' },
|
|
},
|
|
required: ['tableGuid'],
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const table = await client.get<Table>(`/config/v2/tables/${args.tableGuid}`, {
|
|
restaurantGuid: guid,
|
|
});
|
|
return table;
|
|
},
|
|
},
|
|
|
|
toast_list_service_areas: {
|
|
description: 'List all service areas for a restaurant',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional)' },
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const serviceAreas = await client.get<ServiceArea[]>(`/config/v2/serviceAreas`, {
|
|
restaurantGuid: guid,
|
|
});
|
|
return { serviceAreas, count: serviceAreas.length };
|
|
},
|
|
},
|
|
|
|
toast_list_dining_options: {
|
|
description: 'List all dining options for a restaurant',
|
|
parameters: {
|
|
type: 'object',
|
|
properties: {
|
|
restaurantGuid: { type: 'string', description: 'Restaurant GUID (optional)' },
|
|
},
|
|
},
|
|
handler: async (args: any) => {
|
|
const guid = args.restaurantGuid || client.getRestaurantGuid();
|
|
const diningOptions = await client.get<DiningOption[]>(`/config/v2/diningOptions`, {
|
|
restaurantGuid: guid,
|
|
});
|
|
return { diningOptions, count: diningOptions.length };
|
|
},
|
|
},
|
|
};
|
|
}
|