Skip to main content
Glama
c0dr

Canteen MCP

by c0dr

get_lunch_menu

Retrieve the daily lunch menu from the canteen for a specified date using a structured API, enabling easy integration and timely access to meal information.

Instructions

Get the lunch menu from the canteen for a specific date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesThe date to get the menu for (YYYY-MM-DD)

Implementation Reference

  • The execute handler for the get_lunch_menu tool. It fetches the lunch menu from an external API using axios for the specified date and returns the JSON response.
    execute: async (args) => {
      try {
        const response = await axios.get(process.env.API_URL!, {
          params: { date: args.date }
        });
        return JSON.stringify(response.data, null, 2);
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Failed to fetch menu: ${error.message}`);
        }
        throw error;
      }
  • Zod schema defining the input parameters for the get_lunch_menu tool, requiring a 'date' string that must be a valid date.
    parameters: z.object({
      date: z.string().date(),
    }),
  • src/server.ts:35-59 (registration)
    Registration of the get_lunch_menu tool via server.addTool, including annotations, description, name, parameters schema, and inline handler function.
    server.addTool({
      annotations: {
        openWorldHint: true, // This tool interacts with external API
        readOnlyHint: true, // This tool doesn't modify anything
        title: "Lunch Menu",
      },
      description: "Get the lunch menu from the canteen for a specific date",
      execute: async (args) => {
        try {
          const response = await axios.get(process.env.API_URL!, {
            params: { date: args.date }
          });
          return JSON.stringify(response.data, null, 2);
        } catch (error) {
          if (axios.isAxiosError(error)) {
            throw new Error(`Failed to fetch menu: ${error.message}`);
          }
          throw error;
        }
      },
      name: "get_lunch_menu",
      parameters: z.object({
        date: z.string().date(),
      }),
    });
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/c0dr/canteen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server