@taiga-ai/mcp-server 0.14.0-rc.426 → 0.16.0-dev.433

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/src/tools/wait.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
+ import type { McpServer } from '@modelcontextprotocol/server';
2
2
  import { BUILD_RUN_TERMINAL_STATUSES, resolveAutoBuild } from '@taiga/types';
3
3
  import { z } from 'zod';
4
4
  import { TaigaApiError, type TaigaClient } from '../client.js';
@@ -49,7 +49,7 @@ type Verdict = { reached: true } | { reached: false; stoppedBecause: string } |
49
49
 
50
50
  interface Progress {
51
51
  progressToken: string | number | undefined;
52
- sendNotification: (notification: {
52
+ notify: (notification: {
53
53
  method: 'notifications/progress';
54
54
  params: { progressToken: string | number; progress: number; total: number; message: string };
55
55
  }) => Promise<void>;
@@ -128,7 +128,7 @@ async function waitFor(
128
128
  if (attempt > 0 && progress.progressToken !== undefined) {
129
129
  // Best effort: a progress line the client cannot take does not end the wait.
130
130
  await progress
131
- .sendNotification({
131
+ .notify({
132
132
  method: 'notifications/progress',
133
133
  params: {
134
134
  progressToken: progress.progressToken,
@@ -355,14 +355,14 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
355
355
  'call again to keep waiting. Conditions are states, not events: an initiative whose latest run is already ' +
356
356
  'settled answers run_settled at once; item is null when not even the first read answered in time. ' +
357
357
  'Planning takes minutes and a build up to an hour.',
358
- inputSchema: {
358
+ inputSchema: z.object({
359
359
  itemId: z.string().uuid().describe('Backlog item ID -- get from taiga_list_backlog_items'),
360
360
  until: z.enum(ITEM_CONDITIONS).describe('What to wait for'),
361
361
  timeoutSeconds,
362
- },
362
+ }),
363
363
  annotations: READ_ONLY,
364
364
  },
365
- (params, extra) =>
365
+ (params, ctx) =>
366
366
  runTool(async () => {
367
367
  const gate: GateDefault = { product: undefined };
368
368
  const read = async (signal: AbortSignal) => {
@@ -392,9 +392,9 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
392
392
  (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1000,
393
393
  options,
394
394
  {
395
- progressToken: extra._meta?.progressToken,
396
- sendNotification: extra.sendNotification,
397
- signal: extra.signal,
395
+ progressToken: ctx.mcpReq._meta?.progressToken,
396
+ notify: ctx.mcpReq.notify,
397
+ signal: ctx.mcpReq.signal,
398
398
  }
399
399
  );
400
400
  const { now, ...outcome } = result;
@@ -416,14 +416,14 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
416
416
  'changed waits on, since a person resuming the run is a change), or at the timeout with reached: false: ' +
417
417
  'call again to keep waiting. Conditions are states: a run already settled answers settled at once; run ' +
418
418
  'is null when not even the first read answered in time.',
419
- inputSchema: {
419
+ inputSchema: z.object({
420
420
  buildId: z.string().uuid().describe('Build run ID -- get from taiga_list_builds'),
421
421
  until: z.enum(BUILD_CONDITIONS).describe('What to wait for'),
422
422
  timeoutSeconds,
423
- },
423
+ }),
424
424
  annotations: READ_ONLY,
425
425
  },
426
- (params, extra) =>
426
+ (params, ctx) =>
427
427
  runTool(async () => {
428
428
  const result = await waitFor(
429
429
  async (signal) => (await client.getBuildRun(params.buildId, signal)).data as Row,
@@ -431,9 +431,9 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
431
431
  (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1000,
432
432
  options,
433
433
  {
434
- progressToken: extra._meta?.progressToken,
435
- sendNotification: extra.sendNotification,
436
- signal: extra.signal,
434
+ progressToken: ctx.mcpReq._meta?.progressToken,
435
+ notify: ctx.mcpReq.notify,
436
+ signal: ctx.mcpReq.signal,
437
437
  }
438
438
  );
439
439
  const { now, ...outcome } = result;
@@ -456,13 +456,13 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
456
456
  'a refresh. Returns the job as taiga_get_job reads it, with what came of an initiative request, as soon ' +
457
457
  'as it settles (reached: true), or at the timeout with reached: false: call again to keep waiting. Most ' +
458
458
  'jobs take a few minutes.',
459
- inputSchema: {
459
+ inputSchema: z.object({
460
460
  jobId: z.string().uuid().describe('Agent job ID -- a request tool returns it'),
461
461
  timeoutSeconds,
462
- },
462
+ }),
463
463
  annotations: READ_ONLY,
464
464
  },
465
- (params, extra) =>
465
+ (params, ctx) =>
466
466
  runTool(async () => {
467
467
  const result = await waitFor(
468
468
  async (signal) => (await client.getAgentJob(params.jobId, signal)).data as Row,
@@ -470,9 +470,9 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
470
470
  (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1000,
471
471
  options,
472
472
  {
473
- progressToken: extra._meta?.progressToken,
474
- sendNotification: extra.sendNotification,
475
- signal: extra.signal,
473
+ progressToken: ctx.mcpReq._meta?.progressToken,
474
+ notify: ctx.mcpReq.notify,
475
+ signal: ctx.mcpReq.signal,
476
476
  }
477
477
  );
478
478
  const { now, ...outcome } = result;