list_areas
Discover available neighborhoods and districts in a city to filter nightlife events, concerts, and music festivals by location.
Instructions
List distinct area/neighborhood names for a given city. Use this to discover valid area filters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | No | City slug (defaults to tokyo) |
Implementation Reference
- src/services/helpers.ts:38-75 (handler)The implementation of the `listAreas` function which fetches area data from Supabase for a given city and formats it.
export async function listAreas( supabase: SupabaseClient, config: AppConfig, citySlug?: string, ): Promise<{ city: string; areas: string[] }> { const slug = citySlug?.trim().toLowerCase() || config.defaultCity; const cityCtx = await getCityContext(supabase, slug, config.defaultCountryCode); if (!cityCtx) { throw new NightlifeError("INVALID_REQUEST", `City not found: ${slug}`); } const { data, error } = await supabase .from("venues") .select("city_en,city,city_ja") .eq("city_id", cityCtx.id); if (error) { throw new NightlifeError("INTERNAL_ERROR", `Failed to fetch areas: ${error.message}`); } const seen = new Set<string>(); const areas: string[] = []; for (const row of (data ?? []) as VenueAreaRow[]) { const raw = row.city_en || row.city || row.city_ja; if (!raw) continue; const normalized = raw.trim().toLowerCase(); if (normalized && !seen.has(normalized)) { seen.add(normalized); areas.push(raw.trim()); } } areas.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); return { city: cityCtx.slug, areas }; } - src/tools/helpers.ts:114-130 (registration)The tool registration for "list_areas" in the MCP tools definitions.
"list_areas", { description: "List distinct area/neighborhood names for a given city. Use this to discover valid area filters.", inputSchema: { city: z .string() .optional() .describe("City slug (defaults to tokyo)"), }, outputSchema: listAreasOutputSchema, }, async ({ city }) => runTool("list_areas", listAreasOutputSchema, async () => listAreas(deps.supabase, deps.config, city), ), ); - src/tools/helpers.ts:77-113 (schema)The schema definition for the "list_areas" tool output.
const listAreasOutputSchema = z.object({ city: z.string(), areas: z.array(z.string()), }); // --- Registration --- export function registerHelperTools(server: McpServer, deps: ToolDeps): void { server.registerTool( "list_cities", { description: "List all available cities with metadata. Use this to discover valid city slugs before calling other tools.", inputSchema: {}, outputSchema: listCitiesOutputSchema, }, async () => runTool("list_cities", listCitiesOutputSchema, async () => listCities(deps.supabase, deps.config.topLevelCities), ), ); server.registerTool( "list_genres", { description: "List all available genres. Use this to discover valid genre names before filtering events or venues.", inputSchema: {}, outputSchema: listGenresOutputSchema, }, async () => runTool("list_genres", listGenresOutputSchema, async () => listGenres(deps.supabase), ), ); server.registerTool(