mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-23 23:31:47 +00:00
fix(mcp): embed deprecation notice as JSON field instead of separate content item
Claude.ai filters out prepended content items as metadata but must process top-level JSON fields as response data, making it far more likely to surface the notice to the user.
This commit is contained in:
@@ -131,9 +131,9 @@ export function registerTripTools(server: McpServer, userId: number, scopes: str
|
|||||||
async ({ include_archived }) => {
|
async ({ include_archived }) => {
|
||||||
const notice = getDeprecationNotice();
|
const notice = getDeprecationNotice();
|
||||||
const trips = listTrips(userId, include_archived ? null : 0);
|
const trips = listTrips(userId, include_archived ? null : 0);
|
||||||
const result = ok({ trips });
|
// Embed notice as a top-level JSON field so Claude processes it as data,
|
||||||
if (notice) return { content: [{ type: 'text' as const, text: notice }, ...result.content] };
|
// not as a separate content annotation it can silently ignore.
|
||||||
return result;
|
return ok({ ...(notice ? { _deprecation_notice: notice } : {}), trips });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -171,7 +171,8 @@ export function registerTripTools(server: McpServer, userId: number, scopes: str
|
|||||||
messageCount = countMessages(tripId);
|
messageCount = countMessages(tripId);
|
||||||
}
|
}
|
||||||
const notice = getDeprecationNotice();
|
const notice = getDeprecationNotice();
|
||||||
const result = ok({
|
return ok({
|
||||||
|
...(notice ? { _deprecation_notice: notice } : {}),
|
||||||
...summary,
|
...summary,
|
||||||
reservations: canReadRes ? summary.reservations : undefined,
|
reservations: canReadRes ? summary.reservations : undefined,
|
||||||
packing: canReadPacking ? summary.packing : undefined,
|
packing: canReadPacking ? summary.packing : undefined,
|
||||||
@@ -181,8 +182,6 @@ export function registerTripTools(server: McpServer, userId: number, scopes: str
|
|||||||
pollCount,
|
pollCount,
|
||||||
messageCount,
|
messageCount,
|
||||||
});
|
});
|
||||||
if (notice) return { content: [{ type: 'text' as const, text: notice }, ...result.content] };
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user