154 lines
5.5 KiB
JavaScript
154 lines
5.5 KiB
JavaScript
import { z } from 'zod';
|
|
export function registerMenusTools(client) {
|
|
return [
|
|
{
|
|
name: 'toast_list_menus',
|
|
description: 'List all menus for the restaurant',
|
|
inputSchema: z.object({}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.list();
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_get_menu',
|
|
description: 'Get details of a specific menu',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.get(args.menuGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_list_menu_groups',
|
|
description: 'List all groups in a menu',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.listGroups(args.menuGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_get_menu_group',
|
|
description: 'Get details of a specific menu group',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
groupGuid: z.string().describe('Menu group GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.getGroup(args.menuGuid, args.groupGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_list_menu_items',
|
|
description: 'List all items in a menu or menu group',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
groupGuid: z.string().optional().describe('Menu group GUID (optional)'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.listItems(args.menuGuid, args.groupGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_get_menu_item',
|
|
description: 'Get details of a specific menu item',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
itemGuid: z.string().describe('Menu item GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.getItem(args.menuGuid, args.itemGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_list_item_modifiers',
|
|
description: 'List all modifier groups for a menu item',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
itemGuid: z.string().describe('Menu item GUID'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.listModifiers(args.menuGuid, args.itemGuid);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
{
|
|
name: 'toast_update_item_price',
|
|
description: 'Update the price of a menu item',
|
|
inputSchema: z.object({
|
|
menuGuid: z.string().describe('Menu GUID'),
|
|
itemGuid: z.string().describe('Menu item GUID'),
|
|
price: z.number().describe('New price in cents (e.g., 1299 for $12.99)'),
|
|
}),
|
|
execute: async (args) => {
|
|
const result = await client.menus.updatePrice(args.menuGuid, args.itemGuid, args.price);
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
];
|
|
}
|
|
//# sourceMappingURL=menus-tools.js.map
|