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
| Name | Required | Description | Default |
|---|---|---|---|
| zip | Yes | Zurich city ZIP code (e.g. '8001', '8004', '8032'). Covers 8001–8099. | |
| month | No | Month number (1–12). Defaults to the current month. | |
| year | No | Year (e.g. 2026). Defaults to the current year. |
Implementation Reference
- src/modules/recycling.ts:233-276 (handler)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", }); } - src/modules/recycling.ts:233-275 (handler)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", }); - src/modules/recycling.ts:158-182 (schema)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.", }, }, }, }, - src/modules/recycling.ts:157-182 (schema)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.", }, }, }, }, - src/modules/recycling.ts:116-183 (registration)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.", }, }, }, }, ];