Files
TREK/server/src/mcp/tools/_shared.ts
T
Maurice 3fdae47041 chore: drop the exports the reworked server modules left without an importer
knip found them once the server lanes and the client ratchets met: re-exports
and helpers that moved into place-import, nest-rpc and auth-core but kept an
export nothing reads, the demo-denied helper the central MCP gate replaced,
and two settings keys only the selector uses. @OptionalAuth stays exported
as the documented opt-out and is marked @public. The baselines for knip and
the unused en keys drop to the merged tree.
2026-10-10 21:52:09 +02:00

31 lines
1.1 KiB
TypeScript

import { errorResult } from '../../nest-mcp';
// Generic MCP result helpers and annotation presets live in src/nest-mcp
// (single source for the decorator-based domains). Re-exported so the
// @McpController files keep importing from here. Everything below is PURE —
// the impure guards (hasTripPermission/isAdminUser/safeBroadcast) moved onto
// the injectable McpToolGuardsService (src/nest/mcp-shared/).
export {
errorResult,
ok,
TOOL_ANNOTATIONS_DELETE,
TOOL_ANNOTATIONS_NON_IDEMPOTENT,
TOOL_ANNOTATIONS_OPEN_WORLD_NON_IDEMPOTENT,
TOOL_ANNOTATIONS_OPEN_WORLD_READONLY,
TOOL_ANNOTATIONS_READONLY,
TOOL_ANNOTATIONS_WRITE,
} from '../../nest-mcp';
export function noAccess() {
return errorResult('Trip not found or access denied.');
}
export function permissionDenied() {
return errorResult('You do not have permission to perform this action on this trip.');
}
/** Error response for admin-only tools, reproducing the REST `{ error: 'Admin access required' }` string. */
export function adminRequired() {
return errorResult('Admin access required');
}