The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
import {
demoDenied,
errorResult,
ok,
okCompact,
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 '../../../src/nest-mcp';
import { describe, expect, it } from 'vitest';
describe('result helpers', () => {
it('ok() wraps data as one pretty-printed JSON text block, without isError', () => {
const result = ok({ a: 1 });
expect(result).toEqual({ content: [{ type: 'text', text: JSON.stringify({ a: 1 }, null, 2) }] });
expect('isError' in result).toBe(false);
});
it('okCompact() wraps data as one line of JSON, without isError', () => {
const result = okCompact({ a: 1, b: [2, 3] });
expect(result).toEqual({ content: [{ type: 'text', text: '{"a":1,"b":[2,3]}' }] });
expect('isError' in result).toBe(false);
});
it('errorResult() carries the message verbatim with isError', () => {
expect(errorResult('Tag not found.')).toEqual({
content: [{ type: 'text', text: 'Tag not found.' }],
isError: true,
});
});
it('demoDenied() uses the canned demo-mode message', () => {
expect(demoDenied()).toEqual({
content: [{ type: 'text', text: 'Write operations are disabled in demo mode.' }],
isError: true,
});
});
});
describe('tool annotation presets', () => {
it('encode the read/write/delete/idempotency matrix', () => {
expect(TOOL_ANNOTATIONS_READONLY).toEqual({
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
});
expect(TOOL_ANNOTATIONS_WRITE).toEqual({
readOnlyHint: false,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
});
expect(TOOL_ANNOTATIONS_DELETE).toEqual({
readOnlyHint: false,
destructiveHint: true,
idempotentHint: true,
openWorldHint: false,
});
expect(TOOL_ANNOTATIONS_NON_IDEMPOTENT).toEqual({
readOnlyHint: false,
destructiveHint: false,
idempotentHint: false,
openWorldHint: false,
});
});
it('open-world variants only flip openWorldHint', () => {
expect(TOOL_ANNOTATIONS_OPEN_WORLD_READONLY).toEqual({ ...TOOL_ANNOTATIONS_READONLY, openWorldHint: true });
expect(TOOL_ANNOTATIONS_OPEN_WORLD_NON_IDEMPOTENT).toEqual({
...TOOL_ANNOTATIONS_NON_IDEMPOTENT,
openWorldHint: true,
});
});
});