mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 22:31:46 +00:00
fix(mcp): remove all file tools and remove ability to delete notifications
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user