Skip to main content
Glama

get_waste_calendar

Retrieve monthly waste collection schedules for Zurich city by entering a ZIP code. View all collection events grouped by date for any specified month.

Instructions

Get a full monthly waste collection calendar for a Zurich city ZIP code. Returns all collection events grouped by date for the given month. Currently covers Zurich city only (ZIP codes 8001–8099). Powered by OpenERZ (openerz.metaodi.ch).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zipYesZurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099.
monthNoMonth number (1–12). Defaults to the current month.
yearNoYear (e.g. 2026). Defaults to the current year.

Implementation Reference

  • The tool handler for "get_waste_calendar" implemented inside the `handleRecycling` function.
    case "get_waste_calendar": {
      const zip = String(args.zip ?? "").trim();
      if (!zip) {
        throw new Error("zip is required (e.g. '8001')");
      }
    
      const now = new Date();
      const month = typeof args.month === "number"
        ? Math.max(1, Math.min(args.month, 12))
        : now.getMonth() + 1;
      const year = typeof args.year === "number"
        ? args.year
        : now.getFullYear();
    
      const { start, end } = monthRange(month, year);
    
      const entries = await fetchCalendar({ zip, start, end });
      const compact = entries.map(compactEntry);
    
      // Group by date
      const byDate: Record<string, string[]> = {};
      for (const e of compact) {
        if (!byDate[e.date]) byDate[e.date] = [];
        byDate[e.date].push(e.waste_type);
      }
    
      const calendar = Object.entries(byDate)
        .sort(([a], [b]) => a.localeCompare(b))
        .map(([date, types]) => ({ date, types }));
    
      const monthName = new Date(year, month - 1, 1).toLocaleString("en-US", { month: "long" });
    
      return JSON.stringify({
        zip,
        month,
        year,
        month_name: monthName,
        calendar,
        total_events: compact.length,
        collection_days: calendar.length,
        note: "Covers Zurich city ZIP codes 8001–8099 only.",
        source: "openerz.metaodi.ch",
      });
    }
  • The logic handling the 'get_waste_calendar' tool inside the handleRecycling function.
    case "get_waste_calendar": {
      const zip = String(args.zip ?? "").trim();
      if (!zip) {
        throw new Error("zip is required (e.g. '8001')");
      }
    
      const now = new Date();
      const month = typeof args.month === "number"
        ? Math.max(1, Math.min(args.month, 12))
        : now.getMonth() + 1;
      const year = typeof args.year === "number"
        ? args.year
        : now.getFullYear();
    
      const { start, end } = monthRange(month, year);
    
      const entries = await fetchCalendar({ zip, start, end });
      const compact = entries.map(compactEntry);
    
      // Group by date
      const byDate: Record<string, string[]> = {};
      for (const e of compact) {
        if (!byDate[e.date]) byDate[e.date] = [];
        byDate[e.date].push(e.waste_type);
      }
    
      const calendar = Object.entries(byDate)
        .sort(([a], [b]) => a.localeCompare(b))
        .map(([date, types]) => ({ date, types }));
    
      const monthName = new Date(year, month - 1, 1).toLocaleString("en-US", { month: "long" });
    
      return JSON.stringify({
        zip,
        month,
        year,
        month_name: monthName,
        calendar,
        total_events: compact.length,
        collection_days: calendar.length,
        note: "Covers Zurich city ZIP codes 8001–8099 only.",
        source: "openerz.metaodi.ch",
      });
  • The schema definition for the "get_waste_calendar" tool.
      name: "get_waste_calendar",
      description:
        "Get a full monthly waste collection calendar for a Zurich city ZIP code. " +
        "Returns all collection events grouped by date for the given month. " +
        "Currently covers Zurich city only (ZIP codes 8001–8099). " +
        "Powered by OpenERZ (openerz.metaodi.ch).",
      inputSchema: {
        type: "object",
        required: ["zip"],
        properties: {
          zip: {
            type: "string",
            description: "Zurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099.",
          },
          month: {
            type: "number",
            description: "Month number (1–12). Defaults to the current month.",
          },
          year: {
            type: "number",
            description: "Year (e.g. 2026). Defaults to the current year.",
          },
        },
      },
    },
  • The definition and input schema for the 'get_waste_calendar' tool.
    {
      name: "get_waste_calendar",
      description:
        "Get a full monthly waste collection calendar for a Zurich city ZIP code. " +
        "Returns all collection events grouped by date for the given month. " +
        "Currently covers Zurich city only (ZIP codes 8001–8099). " +
        "Powered by OpenERZ (openerz.metaodi.ch).",
      inputSchema: {
        type: "object",
        required: ["zip"],
        properties: {
          zip: {
            type: "string",
            description: "Zurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099.",
          },
          month: {
            type: "number",
            description: "Month number (1–12). Defaults to the current month.",
          },
          year: {
            type: "number",
            description: "Year (e.g. 2026). Defaults to the current year.",
          },
        },
      },
    },
  • The array where "get_waste_calendar" is registered within the `recyclingTools` list.
    export const recyclingTools = [
      {
        name: "get_waste_collection",
        description:
          "Get upcoming waste collection dates for a Zurich city ZIP code. Returns the next scheduled pickups sorted by date. " +
          "Currently covers Zurich city only (ZIP codes 8001–8099). " +
          "Powered by OpenERZ (openerz.metaodi.ch).",
        inputSchema: {
          type: "object",
          required: ["zip"],
          properties: {
            zip: {
              type: "string",
              description: "Zurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099.",
            },
            type: {
              type: "string",
              description:
                "Waste type to filter by (e.g. 'cardboard', 'waste', 'paper', 'organic', 'textile', 'special', 'mobile'). " +
                "If omitted, returns all types.",
              enum: SUPPORTED_WASTE_TYPES,
            },
            limit: {
              type: "number",
              description: "Maximum number of upcoming collection dates to return. Default: 5.",
            },
          },
        },
      },
      {
        name: "list_waste_types",
        description:
          "List all supported waste collection types for Zurich city. " +
          "Returns each type with its description and local name. " +
          "Currently covers Zurich city only (ZIP codes 8001–8099). " +
          "Powered by OpenERZ (openerz.metaodi.ch).",
        inputSchema: {
          type: "object",
          properties: {},
        },
      },
      {
        name: "get_waste_calendar",
        description:
          "Get a full monthly waste collection calendar for a Zurich city ZIP code. " +
          "Returns all collection events grouped by date for the given month. " +
          "Currently covers Zurich city only (ZIP codes 8001–8099). " +
          "Powered by OpenERZ (openerz.metaodi.ch).",
        inputSchema: {
          type: "object",
          required: ["zip"],
          properties: {
            zip: {
              type: "string",
              description: "Zurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099.",
            },
            month: {
              type: "number",
              description: "Month number (1–12). Defaults to the current month.",
            },
            year: {
              type: "number",
              description: "Year (e.g. 2026). Defaults to the current year.",
            },
          },
        },
      },
    ];

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/vikramgorla/mcp-swiss'

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