fix(mcp): remove all file tools and remove ability to delete notifications

This commit is contained in:
jubnl
2026-04-09 18:17:31 +02:00
parent 63784d86a3
commit 059a0a24c5
5 changed files with 1 additions and 796 deletions
+1 -51
View File
@@ -4,8 +4,7 @@ import { isDemoUser } from '../../services/authService';
import {
getNotifications, getUnreadCount,
markRead as markNotificationRead, markUnread as markNotificationUnread,
markAllRead, deleteNotification, deleteAll as deleteAllNotifications,
respondToBoolean,
markAllRead,
} from '../../services/inAppNotifications';
import {
TOOL_ANNOTATIONS_READONLY, TOOL_ANNOTATIONS_WRITE,
@@ -93,53 +92,4 @@ export function registerNotificationTools(server: McpServer, userId: number): vo
return ok({ success: true, count });
}
);
server.registerTool(
'delete_notification',
{
description: 'Delete a single in-app notification.',
inputSchema: {
notificationId: z.number().int().positive(),
},
annotations: TOOL_ANNOTATIONS_DELETE,
},
async ({ notificationId }) => {
if (isDemoUser(userId)) return demoDenied();
const success = deleteNotification(notificationId, userId);
if (!success) return { content: [{ type: 'text' as const, text: 'Notification not found.' }], isError: true };
return ok({ success: true });
}
);
server.registerTool(
'delete_all_notifications',
{
description: "Delete all in-app notifications for the current user.",
inputSchema: {},
annotations: TOOL_ANNOTATIONS_DELETE,
},
async () => {
if (isDemoUser(userId)) return demoDenied();
const count = deleteAllNotifications(userId);
return ok({ success: true, count });
}
);
server.registerTool(
'respond_to_notification',
{
description: 'Respond to a boolean (yes/no) notification such as a trip invite or poll.',
inputSchema: {
notificationId: z.number().int().positive(),
response: z.enum(['positive', 'negative']),
},
annotations: TOOL_ANNOTATIONS_NON_IDEMPOTENT,
},
async ({ notificationId, response }) => {
if (isDemoUser(userId)) return demoDenied();
const result = await respondToBoolean(notificationId, userId, response);
if (!result.success) return { content: [{ type: 'text' as const, text: result.error ?? 'Failed to respond.' }], isError: true };
return ok({ notification: result.notification });
}
);
}