- Added new dependencies for mcp-server in pnpm-lock.yaml, including fastmcp and zod. - Updated pnpm-workspace.yaml to include mcp-server in the workspace packages. - Modified TeamDataService and TeamProvisioningService to exclude 'SendMessage' from tool usage counts, improving accuracy in tool tracking. - Enhanced ChatHistory component to display context injection percentages, improving user feedback on context usage. - Updated TeamDetailView to ensure session details are fetched periodically for active tabs, enhancing data freshness. - Improved ActivityTimeline styling for better visual separation of sessions and messages.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { z } from 'zod';
|
|
import { UserError } from 'fastmcp';
|
|
import type { FastMCP } from 'fastmcp';
|
|
import type { ITeamctlRunner } from '../teamctl-runner.js';
|
|
import { parseOkOutput } from '../output-parser.js';
|
|
import { teamNameSchema, taskIdSchema, memberNameSchema } from '../schemas.js';
|
|
|
|
export function register(server: FastMCP, runner: ITeamctlRunner): void {
|
|
server.addTool({
|
|
name: 'task_comment',
|
|
description: `Add a comment to a task. Sends an inbox notification to the task owner (unless the commenter is the owner).`,
|
|
annotations: {
|
|
readOnlyHint: false,
|
|
destructiveHint: false,
|
|
},
|
|
parameters: z.object({
|
|
team: teamNameSchema,
|
|
task_id: taskIdSchema,
|
|
text: z.string().min(1).max(10000).describe('Comment text'),
|
|
from: memberNameSchema.optional().describe('Author name (skips self-notification)'),
|
|
}),
|
|
execute: async (args) => {
|
|
const cliArgs = ['--team', args.team, 'task', 'comment', args.task_id, '--text', args.text];
|
|
|
|
if (args.from) cliArgs.push('--from', args.from);
|
|
|
|
const result = await runner.execute(cliArgs);
|
|
if (result.exitCode !== 0) {
|
|
throw new UserError(`Failed to add comment: ${result.stderr.trim() || result.stdout.trim()}`);
|
|
}
|
|
return parseOkOutput(result.stdout);
|
|
},
|
|
});
|
|
}
|