fix(mcp): bundle data with deprecation error and add verbatim instruction

Claude retried the tool silently and answered without mentioning the
notice. Two fixes:

1. Include actual trip data in the same isError response so no retry
   is needed and Claude has both the warning and the answer in one shot.

2. Reword the notice to instruct Claude to include the warning verbatim
   in its response before answering the user's question.
This commit is contained in:
jubnl
2026-04-10 03:15:07 +02:00
parent a74a6313dd
commit 81a360f9a7
2 changed files with 28 additions and 6 deletions
+24 -2
View File
@@ -130,8 +130,14 @@ export function registerTripTools(server: McpServer, userId: number, scopes: str
},
async ({ include_archived }) => {
const notice = getDeprecationNotice();
if (notice) return { isError: true as const, content: [{ type: 'text' as const, text: notice }] };
const trips = listTrips(userId, include_archived ? null : 0);
if (notice) return {
isError: true as const,
content: [
{ type: 'text' as const, text: notice },
{ type: 'text' as const, text: JSON.stringify({ trips }, null, 2) },
],
};
return ok({ trips });
}
);
@@ -170,7 +176,23 @@ export function registerTripTools(server: McpServer, userId: number, scopes: str
messageCount = countMessages(tripId);
}
const notice = getDeprecationNotice();
if (notice) return { isError: true as const, content: [{ type: 'text' as const, text: notice }] };
const data = {
...summary,
reservations: canReadRes ? summary.reservations : undefined,
packing: canReadPacking ? summary.packing : undefined,
budget: canReadBudget ? summary.budget : undefined,
collab_notes: canReadCollab ? summary.collab_notes : undefined,
todos,
pollCount,
messageCount,
};
if (notice) return {
isError: true as const,
content: [
{ type: 'text' as const, text: notice },
{ type: 'text' as const, text: JSON.stringify(data, null, 2) },
],
};
return ok({
...summary,
reservations: canReadRes ? summary.reservations : undefined,