From 3ccafb9a7b9ecf10817052351c590a9bcc11370d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Apr 2026 16:05:08 +0200 Subject: [PATCH] fix(mcp): add missing fields to update_place and create_collab_note pinned support --- server/src/mcp/tools.ts | 16 ++++++++++++---- server/src/services/collabService.ts | 9 +++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/server/src/mcp/tools.ts b/server/src/mcp/tools.ts index 9d539492..bdbfd7f5 100644 --- a/server/src/mcp/tools.ts +++ b/server/src/mcp/tools.ts @@ -218,16 +218,23 @@ export function registerTools(server: McpServer, userId: number): void { lat: z.number().optional(), lng: z.number().optional(), address: z.string().max(500).optional(), + category_id: z.number().int().positive().optional().describe('Category ID — use list_categories'), + price: z.number().optional(), + currency: z.string().length(3).optional(), + place_time: z.string().max(50).optional().describe('Scheduled time (e.g. "09:00")'), + end_time: z.string().max(50).optional().describe('End time (e.g. "11:00")'), + duration_minutes: z.number().int().positive().optional(), notes: z.string().max(2000).optional(), website: z.string().max(500).optional(), phone: z.string().max(50).optional(), + transport_mode: z.enum(['walking', 'driving', 'cycling', 'transit', 'flight']).optional(), }, annotations: TOOL_ANNOTATIONS_WRITE, }, - async ({ tripId, placeId, name, description, lat, lng, address, notes, website, phone }) => { + async ({ tripId, placeId, name, description, lat, lng, address, category_id, price, currency, place_time, end_time, duration_minutes, notes, website, phone, transport_mode }) => { if (isDemoUser(userId)) return demoDenied(); if (!canAccessTrip(tripId, userId)) return noAccess(); - const place = updatePlace(String(tripId), String(placeId), { name, description, lat, lng, address, notes, website, phone }); + 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 }); if (!place) return { content: [{ type: 'text' as const, text: 'Place not found.' }], isError: true }; safeBroadcast(tripId, 'place:updated', { place }); return ok({ place }); @@ -861,13 +868,14 @@ export function registerTools(server: McpServer, userId: number): void { content: z.string().max(10000).optional(), category: z.string().max(100).optional().describe('Note category (e.g. "Ideas", "To-do", "General")'), color: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe('Hex color for the note card'), + pinned: z.boolean().optional().default(false).describe('Pin the note to the top'), }, annotations: TOOL_ANNOTATIONS_NON_IDEMPOTENT, }, - async ({ tripId, title, content, category, color }) => { + async ({ tripId, title, content, category, color, pinned }) => { if (isDemoUser(userId)) return demoDenied(); if (!canAccessTrip(tripId, userId)) return noAccess(); - const note = createCollabNote(tripId, userId, { title, content, category, color }); + const note = createCollabNote(tripId, userId, { title, content, category, color, pinned }); safeBroadcast(tripId, 'collab:note:created', { note }); return ok({ note }); } diff --git a/server/src/services/collabService.ts b/server/src/services/collabService.ts index 38c0be28..7f0b8b0e 100644 --- a/server/src/services/collabService.ts +++ b/server/src/services/collabService.ts @@ -117,11 +117,12 @@ export function listNotes(tripId: string | number) { return notes.map(formatNote); } -export function createNote(tripId: string | number, userId: number, data: { title: string; content?: string; category?: string; color?: string; website?: string }) { +export function createNote(tripId: string | number, userId: number, data: { title: string; content?: string; category?: string; color?: string; website?: string; pinned?: boolean }) { + const pinned = data.pinned ? 1 : 0; const result = db.prepare(` - INSERT INTO collab_notes (trip_id, user_id, title, content, category, color, website) - VALUES (?, ?, ?, ?, ?, ?, ?) - `).run(tripId, userId, data.title, data.content || null, data.category || 'General', data.color || '#6366f1', data.website || null); + INSERT INTO collab_notes (trip_id, user_id, title, content, category, color, website, pinned) + VALUES (?, ?, ?, ?, ?, ?, ?, ?) + `).run(tripId, userId, data.title, data.content || null, data.category || 'General', data.color || '#6366f1', data.website || null, pinned); const note = db.prepare(` SELECT n.*, u.username, u.avatar FROM collab_notes n JOIN users u ON n.user_id = u.id WHERE n.id = ?