diff --git a/src/tools/builtin/messaging.ts b/src/tools/builtin/messaging.ts index 88151c6..34f71cd 100644 --- a/src/tools/builtin/messaging.ts +++ b/src/tools/builtin/messaging.ts @@ -1,5 +1,6 @@ import { ToolHandler } from '../base/ToolHandler'; import { NatsClient } from '../../nats/NatsClient'; +import { z } from 'zod'; // Detect current developer role from workspace function detectRole(): string { @@ -14,29 +15,12 @@ export class SendMessageTool extends ToolHandler { name = 'send_message'; description = 'Send real-time message to another developer via NATS'; - inputSchema = { - type: 'object' as const, - properties: { - to: { - type: 'string', - description: 'Recipient role: admin-dev, api-dev, or web-dev', - enum: ['admin-dev', 'api-dev', 'web-dev'], - }, - subject: { - type: 'string', - description: 'Message subject/title', - }, - message: { - type: 'string', - description: 'Message content', - }, - data: { - type: 'object', - description: 'Optional structured data', - }, - }, - required: ['to', 'subject', 'message'], - }; + schema = z.object({ + to: z.enum(['admin-dev', 'api-dev', 'web-dev']).describe('Recipient role'), + subject: z.string().describe('Message subject/title'), + message: z.string().describe('Message content'), + data: z.record(z.any()).optional().describe('Optional structured data'), + }); constructor(private natsClient: NatsClient) { super(); @@ -72,17 +56,9 @@ export class ReceiveMessagesTool extends ToolHandler { name = 'receive_messages'; description = 'Receive real-time messages from other developers via NATS'; - inputSchema = { - type: 'object' as const, - properties: { - limit: { - type: 'number', - description: 'Maximum number of messages to return (default: 10)', - default: 10, - }, - }, - required: [], - }; + schema = z.object({ + limit: z.number().default(10).describe('Maximum number of messages to return'), + }); private messages: any[] = [];