Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: add osm_id to update_place

unknown6aeec0ead1d2
diff --git a/server/src/mcp/tools.ts b/server/src/mcp/tools.ts
index bdbfd7f5d..933a996eb 100644
--- a/server/src/mcp/tools.ts
+++ b/server/src/mcp/tools.ts
@@ -228,13 +228,14 @@ export function registerTools(server: McpServer, userId: number): void {
website: z.string().max(500).optional(),
phone: z.string().max(50).optional(),
transport_mode: z.enum(['walking', 'driving', 'cycling', 'transit', 'flight']).optional(),
+ osm_id: z.string().optional().describe('OpenStreetMap ID from search_place (e.g. "way:12345") — create-only field, normally not updated'),
},
annotations: TOOL_ANNOTATIONS_WRITE,
},
- async ({ tripId, placeId, name, description, lat, lng, address, category_id, price, currency, place_time, end_time, duration_minutes, notes, website, phone, transport_mode }) => {
+ async ({ tripId, placeId, name, description, lat, lng, address, category_id, price, currency, place_time, end_time, duration_minutes, notes, website, phone, transport_mode, osm_id }) => {
if (isDemoUser(userId)) return demoDenied();
if (!canAccessTrip(tripId, userId)) return noAccess();
- const place = updatePlace(String(tripId), String(placeId), { name, description, lat, lng, address, category_id, price, currency, place_time, end_time, duration_minutes, notes, website, phone, transport_mode });
+ const place = updatePlace(String(tripId), String(placeId), { name, description, lat, lng, address, category_id, price, currency, place_time, end_time, duration_minutes, notes, website, phone, transport_mode, osm_id });
if (!place) return { content: [{ type: 'text' as const, text: 'Place not found.' }], isError: true };
safeBroadcast(tripId, 'place:updated', { place });
return ok({ place });
diff --git a/server/src/services/placeService.ts b/server/src/services/placeService.ts
index 640de1e33..23c7a464b 100644
--- a/server/src/services/placeService.ts
+++ b/server/src/services/placeService.ts
@@ -141,7 +141,7 @@ export function updatePlace(
category_id?: number; price?: number; currency?: string;
place_time?: string; end_time?: string;
duration_minutes?: number; notes?: string; image_url?: string;
- google_place_id?: string; website?: string; phone?: string;
+ google_place_id?: string; osm_id?: string; website?: string; phone?: string;
transport_mode?: string; tags?: number[];
},
) {
@@ -151,7 +151,7 @@ export function updatePlace(
const {
name, description, lat, lng, address, category_id, price, currency,
place_time, end_time,
- duration_minutes, notes, image_url, google_place_id, website, phone,
+ duration_minutes, notes, image_url, google_place_id, osm_id, website, phone,
transport_mode, tags,
} = body;
@@ -171,6 +171,7 @@ export function updatePlace(
notes = ?,
image_url = ?,
google_place_id = ?,
+ osm_id = ?,
website = ?,
phone = ?,
transport_mode = COALESCE(?, transport_mode),
@@ -191,6 +192,7 @@ export function updatePlace(
notes !== undefined ? notes : existingPlace.notes,
image_url !== undefined ? image_url : existingPlace.image_url,
google_place_id !== undefined ? google_place_id : existingPlace.google_place_id,
+ osm_id !== undefined ? osm_id : existingPlace.osm_id,
website !== undefined ? website : existingPlace.website,
phone !== undefined ? phone : existingPlace.phone,
transport_mode || null,