@letpeoplework/lighthouse-mcp-core 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25,6 +25,7 @@ __export(index_exports, {
25
25
  registerMcpTools: () => registerMcpTools
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
+ var import_toon = require("@toon-format/toon");
28
29
  var import_zod = require("zod");
29
30
  var getMcpCorePackageContract = () => ({
30
31
  name: "@letpeoplework/lighthouse-mcp-core",
@@ -236,6 +237,13 @@ var toolDefinitions = [
236
237
  }
237
238
  }
238
239
  ];
240
+ var encodePayload = (value) => {
241
+ try {
242
+ return (0, import_toon.encode)(value);
243
+ } catch {
244
+ return JSON.stringify(value);
245
+ }
246
+ };
239
247
  var getSuccessToolResult = (text) => ({
240
248
  isError: false,
241
249
  content: [
@@ -352,7 +360,7 @@ var createMcpCoreRuntime = (dependencies) => ({
352
360
  const connections = await client.listWorkTrackingConnections();
353
361
  if (connections.ok) {
354
362
  return getSuccessToolResult(
355
- `worktracking: ${JSON.stringify(connections.value)}`
363
+ `worktracking: ${encodePayload(connections.value)}`
356
364
  );
357
365
  }
358
366
  return getErrorToolResult(
@@ -367,7 +375,7 @@ var createMcpCoreRuntime = (dependencies) => ({
367
375
  const connection = await client.getWorkTrackingConnection(id);
368
376
  if (connection.ok) {
369
377
  return getSuccessToolResult(
370
- `worktracking: ${JSON.stringify(connection.value)}`
378
+ `worktracking: ${encodePayload(connection.value)}`
371
379
  );
372
380
  }
373
381
  return getErrorToolResult(
@@ -377,7 +385,7 @@ var createMcpCoreRuntime = (dependencies) => ({
377
385
  if (name === "lighthouse.team.list") {
378
386
  const teams = await client.listTeams();
379
387
  if (teams.ok) {
380
- return getSuccessToolResult(`teams: ${JSON.stringify(teams.value)}`);
388
+ return getSuccessToolResult(`teams: ${encodePayload(teams.value)}`);
381
389
  }
382
390
  return getErrorToolResult(
383
391
  `teams: ${teams.error.category} (${teams.error.reason})`
@@ -390,7 +398,7 @@ var createMcpCoreRuntime = (dependencies) => ({
390
398
  }
391
399
  const team = await client.getTeam(id);
392
400
  if (team.ok) {
393
- return getSuccessToolResult(`team: ${JSON.stringify(team.value)}`);
401
+ return getSuccessToolResult(`team: ${encodePayload(team.value)}`);
394
402
  }
395
403
  return getErrorToolResult(
396
404
  `team: ${team.error.category} (${team.error.reason})`
@@ -413,7 +421,7 @@ var createMcpCoreRuntime = (dependencies) => ({
413
421
  const portfolios = await client.listPortfolios();
414
422
  if (portfolios.ok) {
415
423
  return getSuccessToolResult(
416
- `portfolios: ${JSON.stringify(portfolios.value)}`
424
+ `portfolios: ${encodePayload(portfolios.value)}`
417
425
  );
418
426
  }
419
427
  return getErrorToolResult(
@@ -428,7 +436,7 @@ var createMcpCoreRuntime = (dependencies) => ({
428
436
  const portfolio = await client.getPortfolio(id);
429
437
  if (portfolio.ok) {
430
438
  return getSuccessToolResult(
431
- `portfolio: ${JSON.stringify(portfolio.value)}`
439
+ `portfolio: ${encodePayload(portfolio.value)}`
432
440
  );
433
441
  }
434
442
  return getErrorToolResult(
@@ -457,7 +465,7 @@ var createMcpCoreRuntime = (dependencies) => ({
457
465
  const result = await client.getTeamThroughput(id, range);
458
466
  if (result.ok) {
459
467
  return getSuccessToolResult(
460
- `team throughput: ${JSON.stringify(result.value)}`
468
+ `team throughput: ${encodePayload(result.value)}`
461
469
  );
462
470
  }
463
471
  return getErrorToolResult(
@@ -473,7 +481,7 @@ var createMcpCoreRuntime = (dependencies) => ({
473
481
  const result = await client.getTeamCycleTimePercentiles(id, range);
474
482
  if (result.ok) {
475
483
  return getSuccessToolResult(
476
- `team cycleTimePercentiles: ${JSON.stringify(result.value)}`
484
+ `team cycleTimePercentiles: ${encodePayload(result.value)}`
477
485
  );
478
486
  }
479
487
  return getErrorToolResult(
@@ -489,7 +497,7 @@ var createMcpCoreRuntime = (dependencies) => ({
489
497
  const result = await client.getPortfolioThroughput(id, range);
490
498
  if (result.ok) {
491
499
  return getSuccessToolResult(
492
- `portfolio throughput: ${JSON.stringify(result.value)}`
500
+ `portfolio throughput: ${encodePayload(result.value)}`
493
501
  );
494
502
  }
495
503
  return getErrorToolResult(
@@ -505,7 +513,7 @@ var createMcpCoreRuntime = (dependencies) => ({
505
513
  const result = await client.getFeaturesByIds(ids);
506
514
  if (result.ok) {
507
515
  return getSuccessToolResult(
508
- `features: ${JSON.stringify(result.value)}`
516
+ `features: ${encodePayload(result.value)}`
509
517
  );
510
518
  }
511
519
  return getErrorToolResult(
@@ -519,7 +527,7 @@ var createMcpCoreRuntime = (dependencies) => ({
519
527
  const result = await client.getFeaturesByReferences(refs);
520
528
  if (result.ok) {
521
529
  return getSuccessToolResult(
522
- `features: ${JSON.stringify(result.value)}`
530
+ `features: ${encodePayload(result.value)}`
523
531
  );
524
532
  }
525
533
  return getErrorToolResult(
@@ -538,7 +546,7 @@ var createMcpCoreRuntime = (dependencies) => ({
538
546
  const result = await client.getFeatureWorkItems(id);
539
547
  if (result.ok) {
540
548
  return getSuccessToolResult(
541
- `feature workitems: ${JSON.stringify(result.value)}`
549
+ `feature workitems: ${encodePayload(result.value)}`
542
550
  );
543
551
  }
544
552
  return getErrorToolResult(
@@ -555,7 +563,7 @@ var createMcpCoreRuntime = (dependencies) => ({
555
563
  const result = await client.listDeliveries(id);
556
564
  if (result.ok) {
557
565
  return getSuccessToolResult(
558
- `deliveries: ${JSON.stringify(result.value)}`
566
+ `deliveries: ${encodePayload(result.value)}`
559
567
  );
560
568
  }
561
569
  return getErrorToolResult(
@@ -575,9 +583,7 @@ var createMcpCoreRuntime = (dependencies) => ({
575
583
  targetDate
576
584
  });
577
585
  if (result.ok) {
578
- return getSuccessToolResult(
579
- `forecast: ${JSON.stringify(result.value)}`
580
- );
586
+ return getSuccessToolResult(`forecast: ${encodePayload(result.value)}`);
581
587
  }
582
588
  return getErrorToolResult(
583
589
  `forecast: ${result.error.category} (${result.error.reason})`
@@ -605,9 +611,7 @@ var createMcpCoreRuntime = (dependencies) => ({
605
611
  historicalEndDate
606
612
  });
607
613
  if (result.ok) {
608
- return getSuccessToolResult(
609
- `backtest: ${JSON.stringify(result.value)}`
610
- );
614
+ return getSuccessToolResult(`backtest: ${encodePayload(result.value)}`);
611
615
  }
612
616
  return getErrorToolResult(
613
617
  `backtest: ${result.error.category} (${result.error.reason})`
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/index.ts
2
+ import { encode } from "@toon-format/toon";
2
3
  import { z } from "zod";
3
4
  var getMcpCorePackageContract = () => ({
4
5
  name: "@letpeoplework/lighthouse-mcp-core",
@@ -210,6 +211,13 @@ var toolDefinitions = [
210
211
  }
211
212
  }
212
213
  ];
214
+ var encodePayload = (value) => {
215
+ try {
216
+ return encode(value);
217
+ } catch {
218
+ return JSON.stringify(value);
219
+ }
220
+ };
213
221
  var getSuccessToolResult = (text) => ({
214
222
  isError: false,
215
223
  content: [
@@ -326,7 +334,7 @@ var createMcpCoreRuntime = (dependencies) => ({
326
334
  const connections = await client.listWorkTrackingConnections();
327
335
  if (connections.ok) {
328
336
  return getSuccessToolResult(
329
- `worktracking: ${JSON.stringify(connections.value)}`
337
+ `worktracking: ${encodePayload(connections.value)}`
330
338
  );
331
339
  }
332
340
  return getErrorToolResult(
@@ -341,7 +349,7 @@ var createMcpCoreRuntime = (dependencies) => ({
341
349
  const connection = await client.getWorkTrackingConnection(id);
342
350
  if (connection.ok) {
343
351
  return getSuccessToolResult(
344
- `worktracking: ${JSON.stringify(connection.value)}`
352
+ `worktracking: ${encodePayload(connection.value)}`
345
353
  );
346
354
  }
347
355
  return getErrorToolResult(
@@ -351,7 +359,7 @@ var createMcpCoreRuntime = (dependencies) => ({
351
359
  if (name === "lighthouse.team.list") {
352
360
  const teams = await client.listTeams();
353
361
  if (teams.ok) {
354
- return getSuccessToolResult(`teams: ${JSON.stringify(teams.value)}`);
362
+ return getSuccessToolResult(`teams: ${encodePayload(teams.value)}`);
355
363
  }
356
364
  return getErrorToolResult(
357
365
  `teams: ${teams.error.category} (${teams.error.reason})`
@@ -364,7 +372,7 @@ var createMcpCoreRuntime = (dependencies) => ({
364
372
  }
365
373
  const team = await client.getTeam(id);
366
374
  if (team.ok) {
367
- return getSuccessToolResult(`team: ${JSON.stringify(team.value)}`);
375
+ return getSuccessToolResult(`team: ${encodePayload(team.value)}`);
368
376
  }
369
377
  return getErrorToolResult(
370
378
  `team: ${team.error.category} (${team.error.reason})`
@@ -387,7 +395,7 @@ var createMcpCoreRuntime = (dependencies) => ({
387
395
  const portfolios = await client.listPortfolios();
388
396
  if (portfolios.ok) {
389
397
  return getSuccessToolResult(
390
- `portfolios: ${JSON.stringify(portfolios.value)}`
398
+ `portfolios: ${encodePayload(portfolios.value)}`
391
399
  );
392
400
  }
393
401
  return getErrorToolResult(
@@ -402,7 +410,7 @@ var createMcpCoreRuntime = (dependencies) => ({
402
410
  const portfolio = await client.getPortfolio(id);
403
411
  if (portfolio.ok) {
404
412
  return getSuccessToolResult(
405
- `portfolio: ${JSON.stringify(portfolio.value)}`
413
+ `portfolio: ${encodePayload(portfolio.value)}`
406
414
  );
407
415
  }
408
416
  return getErrorToolResult(
@@ -431,7 +439,7 @@ var createMcpCoreRuntime = (dependencies) => ({
431
439
  const result = await client.getTeamThroughput(id, range);
432
440
  if (result.ok) {
433
441
  return getSuccessToolResult(
434
- `team throughput: ${JSON.stringify(result.value)}`
442
+ `team throughput: ${encodePayload(result.value)}`
435
443
  );
436
444
  }
437
445
  return getErrorToolResult(
@@ -447,7 +455,7 @@ var createMcpCoreRuntime = (dependencies) => ({
447
455
  const result = await client.getTeamCycleTimePercentiles(id, range);
448
456
  if (result.ok) {
449
457
  return getSuccessToolResult(
450
- `team cycleTimePercentiles: ${JSON.stringify(result.value)}`
458
+ `team cycleTimePercentiles: ${encodePayload(result.value)}`
451
459
  );
452
460
  }
453
461
  return getErrorToolResult(
@@ -463,7 +471,7 @@ var createMcpCoreRuntime = (dependencies) => ({
463
471
  const result = await client.getPortfolioThroughput(id, range);
464
472
  if (result.ok) {
465
473
  return getSuccessToolResult(
466
- `portfolio throughput: ${JSON.stringify(result.value)}`
474
+ `portfolio throughput: ${encodePayload(result.value)}`
467
475
  );
468
476
  }
469
477
  return getErrorToolResult(
@@ -479,7 +487,7 @@ var createMcpCoreRuntime = (dependencies) => ({
479
487
  const result = await client.getFeaturesByIds(ids);
480
488
  if (result.ok) {
481
489
  return getSuccessToolResult(
482
- `features: ${JSON.stringify(result.value)}`
490
+ `features: ${encodePayload(result.value)}`
483
491
  );
484
492
  }
485
493
  return getErrorToolResult(
@@ -493,7 +501,7 @@ var createMcpCoreRuntime = (dependencies) => ({
493
501
  const result = await client.getFeaturesByReferences(refs);
494
502
  if (result.ok) {
495
503
  return getSuccessToolResult(
496
- `features: ${JSON.stringify(result.value)}`
504
+ `features: ${encodePayload(result.value)}`
497
505
  );
498
506
  }
499
507
  return getErrorToolResult(
@@ -512,7 +520,7 @@ var createMcpCoreRuntime = (dependencies) => ({
512
520
  const result = await client.getFeatureWorkItems(id);
513
521
  if (result.ok) {
514
522
  return getSuccessToolResult(
515
- `feature workitems: ${JSON.stringify(result.value)}`
523
+ `feature workitems: ${encodePayload(result.value)}`
516
524
  );
517
525
  }
518
526
  return getErrorToolResult(
@@ -529,7 +537,7 @@ var createMcpCoreRuntime = (dependencies) => ({
529
537
  const result = await client.listDeliveries(id);
530
538
  if (result.ok) {
531
539
  return getSuccessToolResult(
532
- `deliveries: ${JSON.stringify(result.value)}`
540
+ `deliveries: ${encodePayload(result.value)}`
533
541
  );
534
542
  }
535
543
  return getErrorToolResult(
@@ -549,9 +557,7 @@ var createMcpCoreRuntime = (dependencies) => ({
549
557
  targetDate
550
558
  });
551
559
  if (result.ok) {
552
- return getSuccessToolResult(
553
- `forecast: ${JSON.stringify(result.value)}`
554
- );
560
+ return getSuccessToolResult(`forecast: ${encodePayload(result.value)}`);
555
561
  }
556
562
  return getErrorToolResult(
557
563
  `forecast: ${result.error.category} (${result.error.reason})`
@@ -579,9 +585,7 @@ var createMcpCoreRuntime = (dependencies) => ({
579
585
  historicalEndDate
580
586
  });
581
587
  if (result.ok) {
582
- return getSuccessToolResult(
583
- `backtest: ${JSON.stringify(result.value)}`
584
- );
588
+ return getSuccessToolResult(`backtest: ${encodePayload(result.value)}`);
585
589
  }
586
590
  return getErrorToolResult(
587
591
  `backtest: ${result.error.category} (${result.error.reason})`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letpeoplework/lighthouse-mcp-core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Shared MCP semantics for Lighthouse",
5
5
  "repository": "https://github.com/LetPeopleWork/lighthouse-clients",
6
6
  "type": "module",
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.26.0",
27
+ "@toon-format/toon": "^2.1.0",
27
28
  "zod": "^3.24.1",
28
29
  "@letpeoplework/lighthouse-client": "0.8.0"
29
30
  },